In order to handle this error, I am utilizing this code as instructed in ninja traders guide in the link above:
This is inside onStateChange():
if(State == State.Configure)
{
RealtimeErrorHandling = RealtimeErrorHandling.StopCancelCloseIgnoreRejects ; //to stop the strategy from closing itself
}
This is inside onOrderUpdate():
if(order_One.OrderState == OrderState.Rejected || order_Two.OrderState == OrderState.Rejected)
{
SetStopLoss("One", CalculationMode.Ticks, (beOffset * -1) - 10 * TickSize, false); //this time try to move the stop 10 ticks lower than where you tried the first time and got rejected
}
My problem is that for some reason, when I check "enable strategy", it immediately turns back off and nothing happens. BUT if I comment out the section of code inside of onOrderChange() Then it loads just fine.
Someone, please help me do this order handling thing correctly.

Comment