My strategy has code for a breakeven situation where, for example, it gets to the entry price +5 points and it then moves SL to entry +2. I’ve had situations where if there’s a sudden move in the opposite direction, the SL isn’t accepted.
That’s fine, but I get an error message like the below and then the strategy terminates.
I’d be happy that the SL didn’t set and then have another go at setting it when entry +5 is reached again, but with the strategy terminated I’m stuck.
Other platforms just say ‘no can do’ and carry on. Surely NT should be able to do that.
Am I missing something in my strategy that would make it tolerate such conditions?
Maybe have a wider stop? Your stop is too tight once it goes into profit. It could come back before your stop is even set. If you still want this then you should just programmatically track it instead of using an OCO. I wouldn’t though because you’ll most likely get stopped out most of the time.
IgnoreAllErrors keeps the strategy running, but then a rejected stop leaves you without one, so handle it yourself. In OnOrderUpdate, check for order.OrderState == OrderState.Rejected on your stop and decide what happens: exit at market, or put the stop back at the last valid price. Better still, check before you move it: for a long, the new stop must be below GetCurrentBid() (above GetCurrentAsk() for a short). If price is already through your breakeven level, exit instead of submitting a stop that will be rejected. That way the reject never happens and the position always has protection. Happy to help further, feel free to DM me.