Experts: Trailing

 

Trailing:

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

Author: adam malik kasang

 
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
 

hello,

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

 

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);
 

Can you share set file please? 

 
shtereff:

Can you share set file please? 

have anyone got the setting s for both buy and sell, please update.
Reason: