Download MetaTrader 5

Experts: Trailing Stop EA

To add comments, please log in or register
Automated-Trading
Admin
105107
Automated-Trading  

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
268
rafat darwish  
still dont know how to use it? :(
Umar Ismail
11903
Umar Ismail  
rafat:
still dont know how to use it? :(
you must adjust the number of tickets,
only for one order
Hongliang Liu
1276
Hongliang Liu  
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
541
Lorenzo Faveri  

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
65
muruez  

how it work ?

muruez
65
muruez  

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
30209
Mohammad Soubra  

thanks

good code 

***** 

To add comments, please log in or register