I have faced a weird issue with error about stop loss above/below the market. The error itself is not problem for me. Let's consider it step by step. The strategy (ES, 987 ticks) implements the following scenario:
1. The position is flat. Stop loss is placed for 40 ticks. Let's call it "original" SL.
2. The strategy get short signal and places entry order with entry price 4300.75 (3 contracts) (stop price = 4300.75 + 40 * 0.25 = 4310.75)
3. The strategy get target profit 1 signal by indicators and places exit order with exit price 4300.00 (2 contracts)
4. The strategy places breakeven for the rest 1 contract as stop loss: SetStopLoss(CalculationMode.Price, 4300.75). This way "original" SL is changed.
5. Error occurs "Sim_v4_es_987, Stop price can't be changed below the market. affected Order: BuyToCover 1 StopMarket @ 4310.75".
I understand, the stop price is too close to the entry price. I guess the price movement possibly was so fast that stop price got below the market. It is clear to me. The unclear thing is why I see that error window for hundreds times? I guess it is displayed at each tick until the current bar is closed. The number of ticks is 987. My trading environment was heavy loaded. There is no any loop in the strategy logic because breakeven was placed in OnOrderUpdate method once TP1 has been filled. I think the loop was somewhere inside NT8 logic... Also it is unclear to me why there is 4310.75 value in the text of error and not 4300.75?
Here is log imported from NT8 as excel file in the attachmrnt. You can check weird behaviour of error message from November 2, 3:52pm. Is it possible to be explained and what will be your suggestions? Thank you.
Comment