iBarShift is not working in backtest

 

Please find the below code and here's the problem:

datetime fromDT ="00:00",

           toDT ="07:00";

int      fromBar = iBarShift(NULL, 60, fromDT),

           toBar = iBarShift(NULL, 60,   toDT),

          length = fromBar - toBar + 1,

           HHbar = iHighest(NULL,60, MODE_HIGH, length, toBar),

           LLbar =  iLowest(NULL,60, MODE_LOW,  length, toBar);

double     HH    = iHigh(NULL,60, HHbar),

           LL    = iLow(NULL,60, LLbar); 

 the problem is in backtesting HH and LL are returning the open price of the current bar only.

 

Any help please?

 
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. datetime fromDT ="00:00"
    A string is not a datetime. StringToTime - Conversion Functions - MQL4 Reference
  3. "00:00" is not valid to StringToTime.



 

Maybe helps you.

 https://www.mql5.com/en/code/viewcode/14322/86819/time_trading.mq4

 
eevviill:

Maybe helps you.

 https://www.mql5.com/en/code/viewcode/14322/86819/time_trading.mq4

Your link is dead (error 404).
 
gooly:
Your link is dead (error 404).
https://www.mql5.com/en/code/viewcode/14244/82456/time_trading__7.mq4
Reason: