How do I get a trigger when opening position is modified

 

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.

 
Sien_account :

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
  • www.mql5.com
Советник-утилита: звук и Push-сообщение при входе и выходе из сделки
 
Vladimir Karputov:

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.

Reason: