Limit Order ATR Adjust not working?

[Deleted]  

After putting on an external variable to put more control on Limit Orders, the backtest showed No change in

performance. This was after changing the ATR Multiplier from 1 to 4. This should reduce the number of Orders

filled and also  change the performance and profits. Here is the code as is in the EA:

extern string  MU                  ="Average True Range Multipler-Limit Order adjust";
extern int     mul                  = 2;  //Average True Range Multipler-Limit Order adjust  

 

 atr=iATR(NULL,0,5,0);
   atrr=atr*mul;   

 

 

 if (OrderSend(Symbol(),OP_BUYLIMIT,Lot,NormalizeDouble(Ask - atrr * Point,Digits),slippage,SL,TP,"news",Magic,0,Green)!=-1) TimeBarB=TimeCurrent(); 

 

  1. For large amounts of code, attach it
  2.  if (OrderSend(...)!=-1)
    Why are you not printing out your errors? What are Function return values ? How do I use them ? - MQL4 forum
  3. Not adjusting for ECN brokers. Not adjusting for 4/5 digit brokers (TP, SL, AND slippage)
    //++++ These are adjusted for 5 digit brokers.
    int     pips2points;    // slippage  3 pips    3=points    30=points
    double  pips2dbl;       // Stoploss 15 pips    0.015      0.0150
    int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
    int     init(){                                             OptInitialization();
         if (Digits % 2 == 1){  // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262
                    pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
        } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
        // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
    //---- These are adjusted for 5 digit brokers.
        //{ On ECN brokers you must open first and THEN set stops
        //int ticket = OrderSend(..., 0,0,...)
        //if (ticket < 0)
        //   Alert("OrderSend failed: ", GetLastError());
        //else if (!OrderSelect(ticket, SELECT_BY_TICKET))
        //   Alert("OrderSelect failed: ", GetLastError());
        //else if (!OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0))
        //   Alert("OrderModify failed: ", GetLastError());
        //}
    

  4. NormalizeDouble(Ask - atrr * Point,Digits),
    Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 forum
  5. Learn to add print statements and find out what values you are using
    Ask - atrr * Point
    1.2345 - 0.0010 * 0.0001
    1.2345 - 0.0000001
    1.2345
    Ask - atrr * Point
    1.23456 - 0.00100 * 0.00001
    1.23456 - 0.00000001
    1.23456
[Deleted]  

WHRoeder: Just what I thought. NormalizeDouble not needed for OrderSend. Also yes, I need to start using print statements more.

Thanks. 



  1. For large amounts of code, attach it
  2. Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 forum
  3. Learn to add print statements and find out what values you are using
    Ask - atrr * Point
    1.2345 - 0.0010 * 0.0001
    1.2345 - 0.0000001
    1.2345
    Ask - atrr * Point
    1.23456 - 0.00100 * 0.00001
    1.23456 - 0.00000001
    1.23456