I have an account with Oanda with a Margin Available of 646 and margin used of 400. I have two open positions in EURUSD and USDJPY. When I try to run my live algorithm, I get the following error:

Selling Power for crypto GBPUSD = -4479.3158132487667371388301621 New Order Event: Time: 1/10/2018 6:21:00 PM OrderID: 10 Symbol: GBPUSD Status: Invalid Message: Insufficient buying power to complete order Order Error: id: 10, Insufficient buying power to complete order (Value:-270.389).

I don't have any open positions in GBPUSD, yet it shows that my selling power is negative. -4479 is actually my (cash balance - open positions). Does that mean there is no way to place an order if I have open positions utilizing margin? I can go to the Oanda website and place the same order without any errors. I have set the brokerage model to Margin, and added leverage:

 

self.SetBrokerageModel(BrokerageName.OandaBrokerage, AccountType.Margin) self.AddForex("GBPUSD", Resolution.Minute, Market.Oanda, leverage=2.0)

Author