back test questions

 

hi guys i  want test a EA at end of a day

i write it 

like this 

//+------------------------------------------------------------------+
   void OnTick(void)
     {
      int ticket;
    
      if(TimeToStr(Time[0], TIME_MINUTES)=="23:00")

{
do somthing ....

}
}


but return me always 0  why

but if i remove  if (Time.....

work

anyone can help me ? thankz

 
faustf:

      if(TimeToStr(Time[0], TIME_MINUTES)=="23:00")

but return me always 0  why

  1. If you printed out your TimeToStr you would know why.

  2. Perhaps you should read the manual. If you had you would know what TimeToStr returns and would know why.
       How To Ask Questions The Smart Way. 2004
          How To Interpret Answers.
             RTFM and STFW: How To Tell You've Seriously Screwed Up.

  3. TimeToStr is deprecated. Start using TimeToString.

  4. Your code fails if there is no tick during that minute. There can be minutes between ticks during the Asian session.
              "Free-of-Holes" Charts - MQL4 Articles 20 June 2006
              No candle if open = close ? - MQL4 programming forum 2010.06.06

  5. No need for strings.
    #define HR2300 82800 // (23*3600)
    if(time() >= HR2300) …
              Find bar of the same time one day ago - MQL4 programming forum 2017.10.06
Reason: