it's better to use this method of modification:
double OP_double,TP_double; int P_type,P_opentime; string P_symbol; if(PositionsTotal()>0) { for(int i=PositionsTotal();i>=0;i--) { if(PositionGetTicket(i)) { OP_double=double (PositionGetDouble(POSITION_PRICE_OPEN)); TP_double=double (PositionGetDouble(POSITION_TP)); P_type=int(PositionGetInteger(POSITION_TYPE)); P_opentime=int(PositionGetInteger(POSITION_TIME)); P_symbol=string(PositionGetString(POSITION_SYMBOL)); if(P_symbol==Symbol()) { if(P_type==0 && Sar_array_base[1]>OP_double && Sar_array_base[1]<Low_base[1] && Sar_time_base[1]>P_opentime) { trade.PositionModify(PositionGetInteger(POSITION_TICKET),Sar_array_base[1],TP_double); } if(P_type==1 && Sar_array_base[1]<OP_double && Sar_array_base[1]>High_base[1] && Sar_time_base[1]>P_opentime) { trade.PositionModify(PositionGetInteger(POSITION_TICKET),Sar_array_base[1],TP_double); } } } } }
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
Parabolic_TrailingStop:
A utility for applying trailing stop based on the "Parabolic SAR" indicator.
Author: Almat Kaldybay