log discrepancy

 

Hi guys , i exhausted all my debugging skills to try to wrap my mind around this issue but i could not solve it, i found discrepancy in the log so i cant really trust it, for example if im looping from 200 to 1 , the log only show wen counter is 100 and goes on to 1 why is that is there something i can do to solve this issue? my second problem is in function IsThisCandleFresh im setting the loop to go from index to 1 by decrementing but the debugging statements show the counter i actually increase rather than decrease i have no statments to alter the value of i the only one is i--(i used i in multiple instances but in another scopes of the program),thank you for your time 

bool IsThisCandleFresh(int timeframe,int index, double &sizes[],int &size_index_arr[])
  {
   int anomly_index=FindTheAnamoly(sizes,size_index_arr);
   double y1=RectCordnition("y1",timeframe,index,anomly_index);
   if(CandleClr(timeframe,index)=="green")
     {
      Print("line-259 cheacking green candle>",index);
      Print("line-260 loop should go from ", index," to ",1);
      for(int i=index; i>=1; i--)
        {
         Print("line-263 reality is loop@ ", i," going to ",1);
         Print("line-264 cheacking candle>",i," if it broke ",y1);
         if(iHigh(Symbol(),timeframe,index)<y1 || iLow(Symbol(),timeframe,index)<y1)//if y1 is broken
           {
            Print("line-267 yes",i,"broke ",y1);
            return false;
           }
        }
      Print("line-271 no candle did break ",y1," it is fresh"," camdle ",index," is a fresh zone");
      return true;
     }
   if(CandleClr(timeframe,index)=="red")
     {
      Print("line-276 cheacking red candle>",index);
      Print("line-277 loop should go from ", index," to ",1);
      for(int i=index; i>=1; i--)
        {
              Print("line-280 loop should go from ", index," to ",1);
         Print("line-281 reality is loop@ ", i," going to ",1);
         Print("line-282 cheacking candle>",i,"if it broke ",y1);
         if(iHigh(Symbol(),timeframe,index)>y1 || iLow(Symbol(),timeframe,index)>y1)
           {
            Print("line-284 yes",i,"broke ",y1);
            return false;
           }
        }
      Print("line-288 no candle did break ",y1," it is fresh"," camdle ",index," is a fresh zone");
      return true;
     }

   return false;
  }
void MainFunction(double candle_mult,double atr_mult,int atr_timeframe,int timeframe)
  {
   for(int i=1; i<200; i++)
     {
      Print("i>",i);
      int size_index_arr [10];
      int size_index=0;
      double sizes[10];
      if(IsThisBigCandle(i,candle_mult,timeframe,atr_mult,atr_timeframe))
        {
         for(int x=i; x<i+10; x++)//loop throught x candle before the big candle
           {
            double perc_candle_size;
            if(RetrvingCandleSize("prev_candle_size",x,timeframe)>0)
              {
               perc_candle_size=RetrvingCandleSize("cur_candle_size",x,timeframe)/
                                RetrvingCandleSize("prev_candle_size",x,timeframe)*100;
              }
            else
              {
               perc_candle_size=RetrvingCandleSize("cur_candle_size",x,timeframe)/
                                0.000001*100;
              }
            sizes[size_index]=perc_candle_size;//put sizes into array
            size_index_arr[size_index]=x+1;//put each size candle index into candle index array
            size_index++;
            Print("passing index of",i);
            if(IsThisCandleFresh(timeframe,i,sizes,size_index_arr)==true)
              {
               creat_arrow(StringConcatenate("s",i),iTime(Symbol(),60,i)
                           ,iHigh(Symbol(),60,i)+0.001);
               creat_txt(StringConcatenate("txt",x+1),Time[x+1],High[x+1]+0.001,
                         DoubleToStr(perc_candle_size,1),45);
               FindTheAnamoly(sizes,size_index_arr);
               //RectCordnition("creat_it",timeframe,i
               //             ,FindTheAnamoly(sizes,size_index_arr));
              }
           }
         for(int i=0; i<ArraySize(sizes); i++)
           {
            Print("size_index--<",size_index_arr[i]);
            Print("size-->",sizes[i]);
           }
        }
     }

  }

as you see in log print statement line 288 how it skipped the for loop 

      for(int i=index; i>=1; i--)

this does not make any sense 
 

 

0       00:58:22.382    2020.11.20 13:00:00  s_z_mod EURUSD,H1: line-281 reality is loop@ 4 going to 1
0       00:58:22.382    2020.11.20 13:00:00  s_z_mod EURUSD,H1: line-282 cheacking candle>4if it broke 1.19201
0       00:58:22.382    2020.11.20 13:00:00  s_z_mod EURUSD,H1: line-280 loop should go from 172 to 1
0       00:58:22.382    2020.11.20 13:00:00  s_z_mod EURUSD,H1: line-281 reality is loop@ 3 going to 1
0       00:58:22.382    2020.11.20 13:00:00  s_z_mod EURUSD,H1: line-282 cheacking candle>3if it broke 1.19201
0       00:58:22.382    2020.11.20 13:00:00  s_z_mod EURUSD,H1: line-280 loop should go from 172 to 1
0       00:58:22.382    2020.11.20 13:00:00  s_z_mod EURUSD,H1: line-281 reality is loop@ 2 going to 1
0       00:58:22.382    2020.11.20 13:00:00  s_z_mod EURUSD,H1: line-282 cheacking candle>2if it broke 1.19201
0       00:58:22.382    2020.11.20 13:00:00  s_z_mod EURUSD,H1: line-280 loop should go from 172 to 1
0       00:58:22.382    2020.11.20 13:00:00  s_z_mod EURUSD,H1: line-281 reality is loop@ 1 going to 1
0       00:58:22.382    2020.11.20 13:00:00  s_z_mod EURUSD,H1: line-282 cheacking candle>1if it broke 1.19201
0       00:58:22.382    2020.11.20 13:00:00  s_z_mod EURUSD,H1: line-288 no candle did break 1.19201 it is fresh camdle 172 is a fresh zone
0       00:58:22.382    2020.11.20 13:00:00  s_z_mod EURUSD,H1: anomly candle index of 171
0       00:58:22.382    2020.11.20 13:00:00  s_z_mod EURUSD,H1: passing index of172
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
  • www.mql5.com
//| Expert initialization function                                   | //| Expert deinitialization function                                 | //| Expert tick function                                             | //| test1                                                            |...
Files:
s_z_mod.mq4  15 kb
 
mo798ua:

Hi guys , i exhausted all my debugging skills to try to wrap my mind around this issue but i could not solve it, i found discrepancy in the log so i cant really trust it, for example if im looping from 200 to 1 , the log only show wen counter is 100 and goes on to 1 why is that is there something i can do to solve this issue? my second problem is in function IsThisCandleFresh im setting the loop to go from index to 1 by decrementing but the debugging statements show the counter i actually increase rather than decrease i have no statments to alter the value of i the only one is i--(i used i in multiple instances but in another scopes of the program),thank you for your time 

as you see in log print statement line 288 how it skipped the for loop 

this does not make any sense 
 

 

In your MainFuction, there is not 2 loops imbriqued with "int i" as counter ?