def enterMarketOrderPosition(self, symbol, position, posSize, tp, sl): """Enter a position (either Position.LONG or Position.Short) for the given symbol with the position size using a market order. Associated take-profit (tp) and stop-loss (sl) orders are entered.""" self.associatedOrdersLock.acquire() self.notionalValue = self.liquidContract.AskPrice * self.forexPair.SymbolProperties.ContractMultiplier self.Debug(f"Sym: {symbol} Margin: {self.Portfolio.MarginRemaining} Price: {self.liquidContract.LastPrice} NotionalValue: {self.notionalValue} Pos: {position} Size: {posSize}, Tp: {tp}, Sl: {sl}") if position == Position.LONG: self.Buy(symbol, posSize) takeProfitOrderTicket = self.LimitOrder(symbol, -posSize, tp) stopLossOrderTicket = self.StopMarketOrder(symbol, -posSize, sl) elif position == Position.SHORT: self.Sell(symbol, posSize) takeProfitOrderTicket = self.LimitOrder(symbol, posSize, tp) stopLossOrderTicket = self.StopMarketOrder(symbol, posSize, sl) # associate the take-profit and stop-loss orders with one another self.associatedOrders[takeProfitOrderTicket.OrderId] = stopLossOrderTicket self.associatedOrders[stopLossOrderTicket.OrderId] = takeProfitOrderTicket self.associatedOrdersLock.release() self.trendNumTrades += 1

I'm using the IB account to trade Euro Futures Contract, but I don't understand why I'm getting the following warnings. I've tried changing the percision in round from 2-5, but nothing works. Why the LimitPricing rounded to 0?

Sym: 6E XFD7HH3CBY0X Margin: 999992.6 Price: 1.09485 NotionalValue: 136906.25 Pos: Position.SHORT Size: 1, Tp: 1.16054, Sl: 1.16054 61 | 21:06:26: Backtest Handled Error: Warning: To meet brokerage precision requirements, order LimitPrice was rounded to 0 from 1.16054 Warning: To meet brokerage precision requirements, order StopPrice was rounded to 0 from 1.16054

 

Author