Hi Everyone,
I have a strategy where the exit positions are executed via a nested if loop, first by stop loss, then by trailing stop. Hence, I would find it logical for the stop loss to be prioritized over the trailing stop.
However, I find that when a daily bar is long enough to include the prices for both the stop loss and trailing stop, the exit is randomly executed via the stop loss and trailing stop instead of the former.
Is this right?
Please refer to the following screenshots for more details. It shows the graphical results of the same code, same period, same dataset, but with different exit prices.
Position is exited at Trailing Stop of 138.26
Position is exited at Stop Loss of 145.41
I have a strategy where the exit positions are executed via a nested if loop, first by stop loss, then by trailing stop. Hence, I would find it logical for the stop loss to be prioritized over the trailing stop.
However, I find that when a daily bar is long enough to include the prices for both the stop loss and trailing stop, the exit is randomly executed via the stop loss and trailing stop instead of the former.
Is this right?
Please refer to the following screenshots for more details. It shows the graphical results of the same code, same period, same dataset, but with different exit prices.
Position is exited at Trailing Stop of 138.26
Position is exited at Stop Loss of 145.41
Rename
Yes, it will be randomly determined unless the PlaceTrade statements contain the same "group code" as a parameter.
If they do, WL8 will prune the exits so that the one closest to the current price is prioritized.
Here is another recent post with more details:
https://www.wealth-lab.com/Discussion/Why-CloseAtTrailingStop-failed-to-close-position-9784
If they do, WL8 will prune the exits so that the one closest to the current price is prioritized.
Here is another recent post with more details:
https://www.wealth-lab.com/Discussion/Why-CloseAtTrailingStop-failed-to-close-position-9784
Your Response
Post
Edit Post
Login is required