iBarShift is not working in backtest

Back to topics list To post a new topic, please log in or register
avatar
1
ahmedbakry 2016.03.08 18:45
 

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?

 

avatar
13009
WHRoeder 2016.03.08 20:42 #
 
  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.




avatar
872
eevviill 2016.03.08 23:18 #
 

Maybe helps you.

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

avatar
2017
gooly 2016.03.09 09:53 #
 
eevviill:

Maybe helps you.

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

Your link is dead (error 404).
avatar
872
eevviill 2016.03.09 12:13 #
 
gooly:
Your link is dead (error 404).
https://www.mql5.com/en/code/viewcode/14244/82456/time_trading__7.mq4
Back to topics list  

To add comments, please log in or register