Download MetaTrader 5
To add comments, please log in or register
Interested in MQL5 features? Find them in documentation!
sylvain claverie
651
sylvain claverie 2014.04.19 15:04 
hello. excuse me for English I speak French and I used google translation. 1 EA here which I wanted to add one trailing stop. compiling all goes well and does not work. Can you tell me why and especially what I need to change to make it work. thank you very much for your help
Files:
nouveau.mq4 9 kb
ffoorr
984
ffoorr 2014.04.19 15:30  

if someone' broker is in 5 Digits, the trailing stop can not be under 50 points, try 55 point

input double TrailingStop =30;

ffoorr
984
ffoorr 2014.04.19 15:38  

Or add a line to avoid a trailing stop too low :

   if(TrailingStop>0 && TrailingStop > MarketInfo(Symbol(), MODE_STOPLEVEL)  )
              {
               if(Bid-OrderOpenPrice()>Point*TrailingStop)
                 {
                  if(OrderStopLoss()<Bid-Point*TrailingStop)
                    {
                     //--- modify order and exit
                     OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point*TrailingStop,OrderTakeProfit(),0,Green);
                     return;
                    }
                 }
}
ffoorr
984
ffoorr 2014.04.19 15:45  

And add an alert :


 if( TrailingStop < MarketInfo(Symbol(), MODE_STOPLEVEL)
                                             Alert(" Trailing stop too low");

Or Print(" Trailing stop too low", (string) TrailingStop  );


SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.04.19 16:16  

ffoorr, you just need to click edit and edit your post. No need to post new one if you are the last poster.

Your effort is appreciated though, thank you for that.

ffoorr
984
ffoorr 2014.04.19 17:19  
It don't work,
sylvain claverie
651
sylvain claverie 2014.04.19 21:32  
ddee:
Il ne fonctionne pas,

actually trailing sop does not work
sylvain claverie
651
sylvain claverie 2014.04.19 23:37  
KANABA :

Pas Effectivement fuite sop ne de FONCTIONNE

thank you for your help I just move the location of my trailing stop orders and I will always work attached file thank you again
Files:
/
To add comments, please log in or register