Download MetaTrader 5
To add comments, please log in or register
MQL5 Reference is available in 8 languages. Learn MQL5 in the language that suits you best!
Automated-Trading
Admin
88437
Automated-Trading 2014.12.10 10:06 

Trailing Stop EA:

The TrailingStop EA manages an open position with a trader supplied Trailing Stop. If the trailing stop is less than the allowed stop, the EA changes it to the allowed minimum stop.

Trader can run the EA on any chart even if the ticket number (s)he supplied is for a different symbol.

Author: Mustafa Doruk Basar

rafat darwish
273
rafat darwish 2015.01.12 07:34  
still dont know how to use it? :(
Umar Ismail
9529
Umar Ismail 2015.01.13 18:21  
rafat:
still dont know how to use it? :(
you must adjust the number of tickets,
only for one order
Hongliang Liu
1195
Hongliang Liu 2015.01.14 10:47  
when the order has not set stop loss,OrderStopLoss() return is 0,the following OrderModify will never called
   if(OrderType()==OP_SELL) 
   {
      StopLoss = MarketInfo(OrderSymbol(),MODE_ASK)+(trailing_points*Point);
      if(StopLoss<OrderStopLoss()) 
      {
         otic=OrderModify(OrderTicket(),OrderOpenPrice(),StopLoss,OrderTakeProfit(),0,CLR_NONE);
      }
   }
Lorenzo Faveri
587
Lorenzo Faveri 2015.03.28 11:26  

I solved this way:

 StopLoss=MarketInfo(OrderSymbol(),MODE_ASK)+(trailing_points*Point);//mod 
              
               if(StopLoss<OrdineStoploss || OrderStopLoss()==0) //mod
                 {
                  otic=OrderModify(OrderTicket(),OrderOpenPrice(),StopLoss,OrderTakeProfit(),0,clrRed);
muruez
36
muruez 2015.06.26 15:00  

how it work ?

muruez
36
muruez 2015.08.01 16:34  

how to make this ea work without using the ticket number?

so it can take care all the open trade on the chart. 

Mohammad Soubra
18523
Mohammad Soubra 2016.04.12 21:33  

thanks

good code 

***** 

/
To add comments, please log in or register