Problem with iLowest, variable depending on currency pair

 

Dear all,

I'm having some issues using iLowest on timeframes higher than the current chart timeframe. On one currency pair (EURJPY) it allows me to use the function for the current timeframe, but only higher timeframes from H4 upwards. On the other hand, using the AUDJPY pair, it allows me to use the function on all TFs *except* H4. Here's the code I'm using to debug:

Print("Lowest="+iLowest(NULL,PERIOD_H4,MODE_LOW,20,1));

This gives a value of "-1" when it's not working, and values between 1 and 20 when it is working. Has anybody got a solution for this problem?


Many thanks,

Chris

 
What do you get when you check GetLastError() ?
 
christheguru:

Dear all,

I'm having some issues using iLowest on timeframes higher than the current chart timeframe. On one currency pair (EURJPY) it allows me to use the function for the current timeframe, but only higher timeframes from H4 upwards. On the other hand, using the AUDJPY pair, it allows me to use the function on all TFs *except* H4. Here's the code I'm using to debug:

Print("Lowest="+iLowest(NULL,PERIOD_H4,MODE_LOW,20,1));

This gives a value of "-1" when it's not working, and values between 1 and 20 when it is working. Has anybody got a solution for this problem?


I tried deleting the history for the chart I was using, but on a higher timeframe, and ran the code below as a script

int start(){
   
   Comment( iLowest(NULL,PERIOD_H4,MODE_LOW,20,1) );
   
   return(0);
}

It reloaded the history and gave a >0 answer.

 
RaptorUK:
What do you get when you check GetLastError() ?


Hello RaptorUK and dabbler, and thank you for your questions. They were really valuable and together prompted me to work out the solution - I was missing data from the TFs of interest during the period I was testing on! Seems pretty obvious now... thanks again, that was bugging me for quite a while...

Chris

 

Error 4066 can be useful in such circumstances,

ERR_HISTORY_WILL_UPDATED4066Requested history data in updating state.