help me my EA does not work on 5-digit broker, can anyone help to check my EA

 
Files:
 

Are you getting an error message?

Is it trading? Just incorrectly?

Why do you say it is not working?

 
serpentsnoir:

Are you getting an error message?

Is it trading? Just incorrectly?

Why do you say it is not working?


I try to ran it on my strategy tester and there is no entry on the chart, i just start with a new broker FXpro, i check with the help desk they told me it might be due to the changes of 5 digit.

the previous broker platform works just well. maybe you would like to check on it? thanks for your concern : (

 
  1. bool UseTimeLimit=true;
    int start(){
    ...
       if (UseTimeLimit)
         {
          // trading from 7:00 to 13:00 GMT
          // trading from Start1 to Start2
          YesStop=true;
          if (Hour()>=StartHour && Hour()<=StopHour) YesStop=false;
          //      Comment ("Trading has been stopped as requested - wrong time of day");
          if (YesStop) return(0);
         }
        This line never reached
    

  2. extern double BreakOutLevel=45;       // Start trade after breakout is reached
       double LongTradeRate=Ask + BreakOutLevel*Point;
    
          switch(TrailingStopType)
            {
             case 1: pt=Point*StopLoss;
    
    No adjustment for 5 digit brokers, TP, SL, and slippage:
    //++++ These are adjusted for 5 digit brokers.
    double  pips2points,    // slippage  3 pips    3=points    30=points
            pips2dbl;       // Stoploss 15 pips    0.0015      0.00150
    int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
    int     init(){
        if (Digits == 5 || Digits == 3){    // Adjust for five (5) digit brokers.
                    pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
        } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
        // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
    
    Also on a ECN broker you must OrderSend with no TP/SL and then OrderModify.

  3.    lot=NormalizeDouble(MathFloor(AccountFreeMargin()*TradeSizePercent/10000)/10,1);
    
    This assumes lotStep is 0.1. Not valid on IBFX (0.01), not valid for 0.2
        double  minLot  = MarketInfo(Symbol(), MODE_MINLOT),
                LotStep = MarketInfo(Symbol(), MODE_LOTSTEP),
            size = MathFloor(size/LotStep)*LotStep;
            if (size < minLot){             return(0); }
    

  4.       if (Hour()>=StartHour && Hour()<=StopHour) YesStop=false;
          //      Comment ("Trading has been stopped as requested - wrong time of day");
    
    This assumes StartHour <= StopHour. Depending on TZ and what session you want, that might not work:
    extern double   TradeHr.UTC.Start           =  24.0;        //
    extern double   TradeHr.UTC.End             =  24.0;        //
    
            int         DOW = TimeDayOfWeek(now),   /* https://forum.mql4.com/33851
            // reports DayOfWeek() always returns 5 in the tester. No refresh?*/
                        DayMask = 1 << DOW;
            //                      #define DAYS_MAX    0x3F    // 1<<6-1=63. (S-F)
            //extern int      Days.Mask                   =  55;      // Not Wed
            if (Days.Mask & DayMask == 0){  EA.status="Day="+DOW;       return(0); }
            //extern double   TradeHr.UTC.Start           =   7.3;    // London-1
            //extern double   TradeHr.UTC.End             =  12.9;    // NY open
            int secStart    = 3600*TradeHr.UTC.Start,
                secEnd      = 3600*TradeHr.UTC.End,
                hrBeg       = (now-secStart+86400)%86400,
                hrEnd       = (now-secEnd  +86400)%86400;
            if (hrBeg > hrEnd){     EA.status="HR"+DoubleToStr(hrBeg/3600.-24,2);
                                                                        return(0); }
    

Reason: