I have an automated system coded (single instrument/timeframe). I am experiencing a technical problem in which my order cancels itself immediately after placing. This occurs randomly and therefore I am unable to reproduce the trace here now.
I have already set my liveuntilcanceled to true:
long_entry_order=EnterLongLimit(0,true,qty_1_first _target, entry_price, "long_signal");
SetStopLoss("long_signal", CalculationMode.Ticks, ticks_stoploss, false);
90% of the times it works perfectly but occassionally, it cancels my order immediately after it has been placed.
In order to rectify the problem, I have tried to resubmit the order when a cancelled order is detected:
protected override void OnOrderUpdate(IOrder order)
if(order.Name=="long_signal" && order.OrderState==OrderState.Cancelled )
{
long_entry_order=EnterLongLimit(0,true,qty_1_first _target, entry_price, "long_signal");
SetStopLoss("long_signal", CalculationMode.Ticks, ticks_stoploss, false);
}
The above doesnt work in live trading. The order wont re-submit. I tested the above in simulation mode by manually cancelling the order in superdom. It works fine under this situation, the order got resubmitted. However, it simply doesnt resubmit when the order was cancelled automatically and unexpectedly (as opposed to manual cancel in superdom).
I have searched the entire forum but couldnt find the solution. My major difficulty is that this error seems to be random, i dont know when it will happen.
I am living in GMT+8 timezone, my system trade for me while i am asleep so this error is critical to my trading.
Your help is much appreciated! Thank you.
Comment