Thanks, appears to work on all orders , It may be necessary to add a magic filter ( or not depending on your purpose)
Your code doesn't work. It triggers the commencement of a trailing SL, though the SL then moves with the price, and doesn't "stop" anything.
Please don't post code snippets like this unless it actually works. Seriously frustrating when newcomers are looking for code examples and find untested code.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Code Block for "Trailing Stop" based on current market price. (Ask / Bid):
This code block loops through all opened position and do trailing based on Ask and Bid prices.
Author: Hapu Arachchilage Tharindu Lakmal