Download MetaTrader 5

need help to put a trailing stop works

To add comments, please log in or register
sylvain claverie
812
sylvain claverie  
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
1076
ffoorr  

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

input double TrailingStop =30;

ffoorr
1076
ffoorr  

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
1076
ffoorr  

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  

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
1076
ffoorr  
It don't work,
sylvain claverie
812
sylvain claverie  
ddee:
Il ne fonctionne pas,

actually trailing sop does not work
sylvain claverie
812
sylvain claverie  
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