The conditions for creating an MIT order look like this, where I basically wait for the right time and submit a request to another function to submit the order.
if (orderRecordMaster.OrderStatsProfit > profitHardFloorP && orderRecordMaster.OrderStatsProfit > orderRecordMaster.OrderStatsTrailingStopProfit && orderRecordMaster.OrderStatsProfit < targetTakeProfit) { if (orderRecordMaster.ExitOrder == null) { orderRecordMaster.OrderStatsTrailingStop = GetCurrentAsk(0) - (profitHardFloorP * TickSize); double stop = (double)orderRecordMaster.OrderStatsTrailingStop; double limit = stop - stopLimitSpread; orderRecordMaster.OrderStatsTrailingStopProfit = orderRecordMaster.OrderStatsProfit; // Add MIT exit order ExitOrderFunction(orderRecordMaster.EntryOrder.Quantity, orderRecordMaster, "Add EXIT $", false, (orderRecordMaster.EntryOrder.OrderAction == OrderAction.SellShort ? ExitOrderType.ExitShortStopProfitable : ExitOrderType.ExitLongStopProfitable), OrderType.MIT, stop, limit); }
if(orderType == OrderType.MIT) { ExitLongMIT(0,true,QuantityVal,stopPrice,thisOrderRecordMaster.ExitOrderUUID, thisOrderRecordMaster.EntryOrderUUID); }
if(order.OrderAction == OrderAction.Sell) { if(order.OrderType == OrderType.MIT && order.OrderState == OrderState.Working) { Draw.Dot(this, "dbffsdgwgf"+CurrentBar, true, 0,order.StopPrice, Brushes.Orange); }
The red dot is the MIT order being created, from OnOrderUpdate()
The orange dot is the MIT order being filled, from OnOrderUpdate()
I'm not modifying the order, so why isn't it waiting until price drops below the orange dot to fill the order? I've tried all time in force, even though it shouldn't matter, and the order should be open perpetually.
Comment