Wrong values time when accessing different period chart.

 

My expert runs on the 15 min chart. However I want to check Stochastic values on the 5 minute chart

When I do this I get results from the wrong time.

eg At 3:15 on 22nd March I process the 3:00 candle on the 15min chart using iStochastic(NULL,PERIOD_M15,5,3,3,0,0,0,1)

The 5 minute value at that time using iStochastic(NULL,PERIOD_M5,5,3,3,0,0,0,1) should be for the 3:10 candle on the 22nd but is actually returning the 6:00 candle on the 18th.

It may be that was the last time I looked at that M5 chart, but I'm not sure.

Does anybody have an explanation and/or a solution to force the lastest candle data to be returned?


Thanks

Kymberley


Log:

2016.03.22 15:14:56.800    Strategy 2016 0317 EURUSD,M15: ----------------  Candle 2016.03.22 03:00:00 -----------------------------------------------

2016.03.22 15:14:56.800    Strategy 2016 0317 EURUSD,M15:    ADX SELL 1st candle Xover : Trend 24.28285618013169, Buyer 15.31515244208962, Seller 27.32854161607304
2016.03.22 15:14:56.800    Strategy 2016 0317 EURUSD,M15:    ADX trend : 1 rise, value 23.68459574378832,24.28285618013169 Score 2
2016.03.22 15:14:56.800    Strategy 2016 0317 EURUSD,M15:    STO SELL on relative Stochastic : main 44.44444444444061 < signal 66.6451335055887
2016.03.22 15:14:56.816    Strategy 2016 0317 EURUSD,M15:    STO SELL comfirmed on previous 5 min candle : main 40.42553191488788 < signal 56.78840002994489 @ 2016.03.18 06:00:00


Code :

           stom5=iStochastic(NULL,PERIOD_M5,5,3,3,0,0,0,1);         //stom

           stos5=iStochastic(NULL,PERIOD_M5,5,3,3,0,0,1,1);         //stos
           time5=iTime(NULL,PERIOD_M5,1);    //time
          
           // confirm on previous 5 min candle
          
           if (stom5<stos5)
           {
             writelog(false,StringConcatenate("   STO SELL comfirmed on previous 5 min candle : main ", stom5," < signal ",stos5," @ ",time5));
 

It looks like the M5 chart needed to update.

If it only checks the M5 chart periodicallly, use iTime(NULL,PERIOD_M5,0) every tick just to keep it updated or make sure that the M5 time  >= M15 time

 

When I opened the history file with F2, I noticed that the most recent date/time on the 5min data corresponded to the date/time returned above. It then seemed to automatically u[pdate itself to the current time.

Hence my problem seems to be more defined. How to I ensure the history files are kept up to date, automatically rather than relying onme to open the History option manually?

 
Kymberley:


Hence my problem seems to be more defined. How to I ensure the history files are kept up to date, automatically rather than relying onme to open the History option manually?



Already answered
 
GumRai:

It looks like the M5 chart needed to update.

If it only checks the M5 chart periodicallly, use iTime(NULL,PERIOD_M5,0) every tick just to keep it updated or make sure that the M5 time  >= M15 time

Thanjks, that seems to have done the trick.
Reason: