Download MetaTrader 5

Newbie needs help with PositionModify please

To add comments, please log in or register

Hi all,

I am using CTrade class to do a trailling stop. It works perfectly but the problem is that  my EA after doesn't open more positions.

If i leave my trailing stop, my EA is working without problems but if i put the trailing stop, at the moment that one position is using the trailing, the EA doesnt work more.

I have used this "trade.SetExpertMagicNumber(magicNumber);" because i was reading the CTrade class and the method "PositionModify" needs the magic number, i am not sure. 

Please, i dont know what to do to work it. 


With trailing Stop 


 Without trailingStop


testing only buy_positions 


           if(profit>=StopLoss){ //int StopLoss=400 int TP=800
                  Print("Todo bien: ",trade.ResultRetcode()," , ",trade.ResultRetcodeDescription());
                  Print("Todo mal: ",trade.ResultRetcode()," , ",trade.ResultRetcodeDescription());
                  vendido=false; //to check the EA doesn't open 2 positions at same time
               if(pr<=-StopLoss){ //StopLoss int 400


 Greetings and thx



Joao Felipe Gomes de Araujo
Joao Felipe Gomes de Araujo  
To add comments, please log in or register