angelohomen:
Hey guys, I'm having issues about getting partials and realizing breakevens. The code I've used is this. Can anyone see what's wrong about that?
Try coding this way:
for(int i=0;i<PositionsTotal();i++){ ulong iTicket=PositionGetTicket(i); if(PositionGetString(POSITION_SYMBOL)==_Symbol){ if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY){ double PClose=PositionGetDouble(POSITION_PRICE_OPEN)+Distance*_Point; // PartialClose target if(PositionGetDouble(POSITION_PRICE_CURRENT)>PClose&& (PositionGetDouble(POSITION_SL)<PositionGetDouble(POSITION_PRICE_OPEN))){ if(!trade.PositionClosePartial(iTicket,NormalizeDouble(PositionGetDouble(POSITION_VOLUME)*Percent,2),ULONG_MAX)){ //PartialClose volume Print("PositionClosePartial error ",trade.ResultRetcode()); } else if(!trade.PositionModify(iTicket,PositionGetDouble(POSITION_PRICE_OPEN),PositionGetDouble(POSITION_TP)){ // Breakeven Print("PositionModify error ",trade.ResultRetcode()); }
David Diez:
It worked! Thank you so much!
Try coding this way:
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
Hey guys, I'm having issues about getting partials and realizing breakevens. The code I've used is this. Can anyone see what's wrong about that?