Download MetaTrader 5

Experts: Trailing

To add comments, please log in or register
Learn operation principles of Trading Signals for MetaTrader.
Automated-Trading
Admin
99101
Automated-Trading 2015.01.19 11:49 

Trailing:

The Expert Advisor can be used for Trailing and hidden Take Profit/Stop Loss.

Author: adam malik kasang

Larrydeelf
163
Larrydeelf 2015.02.11 20:21  
I just downloaded your trailing EA but I am sure how to input the trailing to breakeven point when action moves in a profit position
npielea
26
npielea 2015.02.12 14:25  

hello,

do you have an instruction file for this EA? How does it work?

tvargek
9
tvargek 2015.04.19 10:36  

hello

i'm in need of your help if you would help. i modified your ea so that trailing stop is 'invisible' but it doesn't work with buy, only with sell.

i'm not that good in programming so maybe you can find what is wrong...here is the modified part :

int Magic=0;
double TrailingPrice=0;
int PriceSwitch=0;
  
for(int cnt=0;cnt<OrdersTotal();cnt++)
     {
      OrderSelect(cnt, SELECT_BY_POS, MODE_TRADES);
      if( OrderSymbol()==Symbol() && OrderMagicNumber()==Magic)        
        {
         if(OrderType()==OP_BUY)
           {
            if(Bid-OrderOpenPrice()>=TakeProfit*Point|| OrderOpenPrice()-Ask>StopLoss*Point)
              {
               OrderClose(OrderTicket(),OrderLots(),Bid,0,CLR_NONE); return(0);
              }
            if(Trailing>0)
              {
               if((Bid-OrderOpenPrice())>(Point*Trailing))
                 {
                  if(TrailingPrice=0)
                     {
                     TrailingPrice=OrderOpenPrice();
                     }
                   if((Bid-(Point*Trailing))>TrailingPrice)
                     {
                     TrailingPrice=(Bid-(Point*Trailing));
                     }
                   if((Bid-(Point*Trailing))<TrailingPrice)
                     {
                     OrderClose(OrderTicket(),OrderLots(),Bid,0,CLR_NONE);
                     TrailingPrice=0;
                     return (0);             
                     }
                 }
              }
           }
         if(OrderType()==OP_SELL)
           {
            if(OrderOpenPrice()-Ask>=TakeProfit*Point|| Bid-OrderOpenPrice()>StopLoss*Point)
              {
               OrderClose(OrderTicket(),OrderLots(),Ask,0,CLR_NONE); return(0);
              }
            if(Trailing>0)
              {
               if((OrderOpenPrice()-Ask)>(Point*Trailing))
                 {
                  if(TrailingPrice=0)
                     {
                     TrailingPrice=OrderOpenPrice();
                     }
                   if((Ask+(Point*Trailing))<TrailingPrice)
                     {
                     TrailingPrice=(Ask+(Point*Trailing));
                     }
                   if((Ask+(Point*Trailing))>TrailingPrice)
                     {
                     OrderClose(OrderTicket(),OrderLots(),Ask,0,CLR_NONE);
                     TrailingPrice=0;
                     return (0);             
                     }
                 }
              }
           }
         }
       }


  return(0);
shtereff
572
shtereff 2015.08.26 11:35  

Can you share set file please? 

Gr8code
26
Gr8code 2015.10.29 17:11  
shtereff:

Can you share set file please? 

have anyone got the setting s for both buy and sell, please update.
To add comments, please log in or register