VilkaChuvashova ( Vilka Chuvashova ) - help to reconfigure the advisor. - page 7

 
up
 

It would be nice to add a new condition to the code: "pending order"

which allows to regulate pullback, i.e. at buy/sell signal we put the postponer, but with n-number of pips back.

Well, if you could attach this device, you'd have a great time...

https://www.mql5.com/ru/code/8850

 
ForAll:

Chet, nothing has changed...

There is one Expert Advisor in which you can see how a Stop Loss is drawn behind the price level


To be honest, it is not a very nice implementation. As practice shows, besides moving the stop, you should also move the take order so that it closes exactly at the stop loss. But the catch is that eventually we lose the difference between the stop and the take, but there is a chance (and not a slim one) to pull the order down very far.

void TRALLING(int POINTS,int STEP)
{
   if (!Trail) return;
   double _STEP =NormalizeDouble(STEP*Point,Digits);
   double _POINTS =NormalizeDouble(POINTS*Point,Digits);  
   for (int i=OrdersTotal()-1; i>=0; i--)
   {
      if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
      {
         if (OrderSymbol() !=Symbol() || OrderMagicNumber() !=magic) continue;      
         if (OrderType()==OP_BUY) 
            {
              if (Bid-OrderOpenPrice() > _POINTS && OrderStopLoss() < Bid-_POINTS-_STEP)
                 if (!OrderModify(OrderTicket(),OrderOpenPrice(),Bid-_POINTS,OrderTakeProfit(),0,Yellow)) ShowERROR();
            }
         if (OrderType()==OP_SELL)   
            {
              if (OrderOpenPrice()-Ask > _POINTS && OrderStopLoss() > Ask+_POINTS+_STEP)
                 if (!OrderModify(OrderTicket(),OrderOpenPrice(),Ask+_POINTS,OrderTakeProfit(),0,Yellow)) ShowERROR();
            }      
      }
   }   
return;
}    

I have decided to add half of trailing points to profit, it means that the profit seems to run away from the price, but in this way there is a chance that the price will catch up with it and the order will close.

OrderTakeProfit()+_POINTS/2

 
alexhammer could you attach your own version of the profit/stop trawl to the EA?
 

Sancho77

Here you go, really a parabolic trawl, but I've been using it myself lately.

 
alexhammer:

Sancho77

Here you go, really a parabolic trawl, but I've been using it myself lately.

Thanks alexey!