Incorrect Multiple Timeframe information

[Deleted]  

I think there is a bug with getting information from multiple timeframes.

For example, if I decide to print this out of the init() function of an indicator that is attached to a 1Hour chart:


Print( "marketinfo: " + TimeHour(MarketInfo(Symbol(), MODE_TIME ) ));
Print( "m1: " + TimeHour(iTime(Symbol(), PERIOD_M1, 0)) );
Print( "m5: " +TimeHour(iTime(Symbol(), PERIOD_M5, 0)) );
Print( "m15: " +TimeHour(iTime(Symbol(), PERIOD_M15, 0)) );
Print( "m30: " +TimeHour(iTime(Symbol(), PERIOD_M30, 0)) );
Print( "h1: " +TimeHour(iTime(Symbol(), PERIOD_H1, 0)) );


All the answers should be the same. Yet they output is this:


2009.09.09 18:00:18 Test NZDJPY,H1: h1: 18

2009.09.09 18:00:18 Test NZDJPY,H1: m30: 15
2009.09.09 18:00:18 Test NZDJPY,H1: m15: 15
2009.09.09 18:00:18 Test NZDJPY,H1: m5: 15
2009.09.09 18:00:18 Test NZDJPY,H1: m1: 0

2009.09.09 18:00:18 Test NZDJPY,H1: marketinfo: 18


However, after I delete the indicator, and re-add it, the output correctly shows:


2009.09.09 18:01:37 Test NZDJPY,H1: h1: 18
2009.09.09 18:01:37 Test NZDJPY,H1: m30: 18
2009.09.09 18:01:37 Test NZDJPY,H1: m15: 18
2009.09.09 18:01:37 Test NZDJPY,H1: m5: 18
2009.09.09 18:01:37 Test NZDJPY,H1: m1: 18
2009.09.09 18:01:37 Test NZDJPY,H1: marketinfo: 18


This consistently shows wrong results on all pairs.

Therefore if I try to get the High/Low of a certain candle from a different timeframe, I will get the wrong value.

It seems the only way to gaurantee accurate results is to actually have the charts open for every timeframe, so its always downloading the new accurate data for each timeframe.


Anyone have a viable solution to this?

Ray
2646
Ray  

You have to actually have the history data, yes.

It usually takes care of itself after a while, but...

Recently I saw that ArrayCopyRates() may be useful in forcing history updates.