Hey guys, how do I get a trigger when opening position is modified? By modified I mean when the Stoploss or take profit is changed, or the position itself is partially closed.
I have tried to use PositionTotal() but it only changes when position is opened or closed.
Would anyone like to point out which function should I use to find the trigger?
Thank you.
Try this code: Triggered on Open, Close or Partial Close - Sound Alert Entry Out
If you need to catch the triggering of Stop Loss, then this code - Example: tracking the triggering of Stop Loss or Take Profit
![Sound Alert Entry Out Sound Alert Entry Out](https://c.mql5.com/36/46/sound-alert-entry-out.jpg)
- www.mql5.com
Try this code: Triggered on Open, Close or Partial Close - Sound Alert Entry Out
If you need to catch the triggering of Stop Loss, then this code - Example: tracking the triggering of Stop Loss or Take Profit
Thank you Valdimir, I studied the code you provided and found they only trigger after there is a trade transaction. What i want is a trigger that works when just randomly moving stoploss take profit value without a transaction or a deal happening.
I just solved the problem by calculate the total SL/TP value and compare them with value before last tick, in ontick() function within expert advisor. I thought it would lag my computer since it is calculating value every tick but it didn't.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hey guys, how do I get a trigger when opening position is modified? By modified I mean when the Stoploss or take profit is changed, or the position itself is partially closed.
I have tried to use PositionTotal() but it only changes when position is opened or closed.
Would anyone like to point out which function should I use to find the trigger?
Thank you.