The strategy looks for "Profit target" or "Stop loss" events in OnOrderUpdate()
If the event is detected, flags are set in OnOrderUpdate() and an attempt to reverse the position with SetProfitTarget(), SetStopLoss(), EnterLongLimit() or EnterShortLimit() is done in OnBarUpdate().
The problem is sometimes my order gets ignored according to this link.
So I am thinking of inserting a small 100ms delay (I'm guessing) within OnBarUpdate() right after the event is detected and right before the flag is set to initiated the reverse position in OnBarUpdate()
So I use the following code in OnOrderUpdate()
var t = Task.Run(async delegate { await Task.Delay(100); }); t.Wait();
Comment