When I am testing my strategy via Market Replay on ES 12-20 Futures, timeframe is 5 min Heiken-Ashi, then 4.11.2020 the strategy always generates the error "Buy stop or buy stop limit orders can't be placed below the market". I included simplified script to reproduce the error.
When I was debugging the script, I found that the Short entry got filled at price 3415 and the Stop Loss order should be being placed at 2416 but current bid & ask prices are 3416,75 and 3417,25 respectively.
Seems that there is some data issue but the problem is in the platform behavior: the strategy stops but the main order stays active without stop loss and profit target. So I have two questions:
- How to fix this data issue?
- Can I somehow prevent strategy to be stopped (for example, to bypass the error or set the custom handler for this error to automatically close active position)?
Comment