•You may call this method from within the strategy OnBarUpdate() method should you wish to dynamically change the stop loss price while in an open position
•Should you call this method to dynamically change the stop loss price in the strategy OnBarUpdate() method, you should always reset the stop loss price / offset value when your strategy is flat otherwise, the last price/offset value set will be used to generate your stop loss order on your next open position
Despite resetting it to zero it's still using the stop price of the previous trade when testing in market replay.
I even print out the value that SetStopLoss() is using on the line immediately prior to the line SetStopLoss() is and the value that is being printed is correct, while the value that shows up in the error message and in the log shows that the value is from the previous trade.
I'm not sure what to do here does anyone have any pointers??
Edit:
This is a crazy update. I'm currently looking at a session that I actually traded live using a previous version of this strategy. Live it handled it no problem. In market replay I went back and replayed it with both the current version and the version I used to trade it live and both times I got this situation I described in this post. Weird that it would happen in market replay but not in real life.
Comment