PositionModify , change TP but leaving SL the same

 

do i have to get the SL value and place it again if i want to change only TP value ? 

cause placing a 0 delete my SL value . 

thanks !

 
Mohamed Mostafa Mohamed Sonbol:

do i have to get the SL value and place it again if i want to change only TP value ? 

cause placing a 0 delete my SL value . 

thanks !

Hi!
Yes
 
Mohamed Mostafa Mohamed Sonbol: do i have to get the SL value and place it again if i want to change only TP value ?  cause placing a 0 delete my SL value . 

Yes, for the PositionModify method function, you have to supply both the Stop-Loss and Take-Profit prices, even if you only want to change one of them.

Please refer to the documentation ...

Parameters

sl

[in] The new price by which the Stop Loss will trigger (or the previous value, if the change is not necessary).

tp

[in] The new price by which the Take Profit will trigger (or the previous value, if the change is not necessary).

Documentation on MQL5: Standard Library / Trade Classes / CTrade / PositionModify
Documentation on MQL5: Standard Library / Trade Classes / CTrade / PositionModify
  • www.mql5.com
PositionModify(const string,double,double) - CTrade - Trade Classes - Standard Library - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5