Does MT4 receive all the data for all the time frames by default?

 
Hi,

I am writting a multi timeframe indicator and it supposes to be put on 15M and need to access data from 15M to 4H using Timeseries Access functions such as iHigh(), etc. According to the MT4 reference, those functions return 0 if local history is empty (not loaded). Now my question is, if MT4 is running and a chart is fixed on one timeframe, will the data for the other timeframes be updated in history? Do I need to manually switch between timeframes to get those history buffers updated?

Thanks,
aha
 
Well, now that you have had time to try it, what is your conclusion?
 
I haven't tried it yet.

From what I saw in history center, the data is not updated for the tf that isn't open. But this machenism should haven't been implemented otherwise multi timeframe indicator/expert will be pretty difficult to implement.

Does Slawa get an answer for this?
 
"I haven't tried it yet."


Well, duh.

Why not write a very simple test case and try it out?

Allright, out of curiosity, I will... Your job is to carry it on out for whatever timeframes interest you.

It's a script


int start()
{

	bool failed1;
	bool failed5;
	bool failed15;
	// ... add timeframes here

	datetime barTime;

	for( int i =0; i < 250000; i++){

		if( failed1 == false){
			barTime = iTime(Symbol(), 1, i);
			if(barTime == 0) {
				Print("1 minute failed at "+i+" bars at "+TimeToStr(iTime(Symbol(), 1, i-1)));
				failed1 = true;
			}
		}
		if( failed5 == false){
			barTime = iTime(Symbol(), 5, i);
			if(barTime == 0) {
				Print("5 minute failed at "+i+" bars at "+TimeToStr(iTime(Symbol(), 5, i-1)));
				failed5 = true;
			}
		}
		if( failed15 == false){
			barTime = iTime(Symbol(), 15, i);
			if(barTime == 0) {
				Print("15 minute failed at "+i+" bars at "+TimeToStr(iTime(Symbol(), 15, i-1)));
				failed15 = true;
			}
		}

                                // ... add timeframe tests here
	}






   return(0);
  }


Output

2007.11.25 15:26:00	Test CADJPY,M15: 1 minute failed at 37177 bars at 2007.10.18 01:51
2007.11.25 15:26:00	Test CADJPY,M15: 5 minute failed at 23319 bars at 2007.08.01 01:55
2007.11.25 15:26:00	Test CADJPY,M15: 15 minute failed at 11119 bars at 2007.06.12 06:15



Now, the chances I have ever looked at CADJPY on those timeframes is pretty remote, so what
can you infer from that?




 
Hey Phy,

Thank you for quickly written up the script for this question. It's not the situation I wanted to test but, I get your point.

Thanks again.
aha

"I haven't tried it yet."


Well, duh.

Why not write a very simple test case and try it out?

Allright, out of curiosity, I will... Your job is to carry it on out for whatever timeframes interest you.

It's a script


int start()
{

	bool failed1;
	bool failed5;
	bool failed15;
	// ... add timeframes here

	datetime barTime;

	for( int i =0; i < 250000; i++){

		if( failed1 == false){
			barTime = iTime(Symbol(), 1, i);
			if(barTime == 0) {
				Print("1 minute failed at "+i+" bars at "+TimeToStr(iTime(Symbol(), 1, i-1)));
				failed1 = true;
			}
		}
		if( failed5 == false){
			barTime = iTime(Symbol(), 5, i);
			if(barTime == 0) {
				Print("5 minute failed at "+i+" bars at "+TimeToStr(iTime(Symbol(), 5, i-1)));
				failed5 = true;
			}
		}
		if( failed15 == false){
			barTime = iTime(Symbol(), 15, i);
			if(barTime == 0) {
				Print("15 minute failed at "+i+" bars at "+TimeToStr(iTime(Symbol(), 15, i-1)));
				failed15 = true;
			}
		}

                                // ... add timeframe tests here
	}






   return(0);
  }


Output

2007.11.25 15:26:00	Test CADJPY,M15: 1 minute failed at 37177 bars at 2007.10.18 01:51
2007.11.25 15:26:00	Test CADJPY,M15: 5 minute failed at 23319 bars at 2007.08.01 01:55
2007.11.25 15:26:00	Test CADJPY,M15: 15 minute failed at 11119 bars at 2007.06.12 06:15



Now, the chances I have ever looked at CADJPY on those timeframes is pretty remote, so what
can you infer from that?