I have posted the same content elsewhere but some of the information here is rarely discussed (if ever) anywhere on the internet so I want to share it in this popular forum as well, since a large number of traders use multiple time frame trading technique.
===================================
I deal with many trades around the world due to my work, one type of strategy most often presented to me are strategies based on multiple time frame conditions. With that I also see a lot of MTF indicator being used by traders as a tool when they experiment their ideas.
I noticed that there are a lot of misunderstanding behind those indicators and how MT4 handles MTF issue, especially with regards back testing. Some people claim definitively that "MT4 can't back test MTF" or "MTF indicators can't be used in back testing" etc. Those statements are not exactly true.
I'm making an attempt trying to review this issue using MTF RSI as an example.
First of all, automating a system that has MTF elements are definitely doable, all logic can be coded inside the EA without using any indicators. Although indicators serves a nice visual tool for us to see and verify as trading progress. Most traders who use a MTF indicator do not know all the details of the indicator they are using. The reason those indicators can't be used in back testing is due to how it's written, not to say it's impossible to get around that problem.
When it comes to programming, there are many ways to program MTF indicators depending specific needs, not all versions are created equally. Let's assume we are trading 5M chart and display 30M RSI.
v1: Surprisingly a lot of MTF indicator is created using this template which is strange to me, indicator display straight lines for the past, going forward every bar takes the intermediate 30M RSI level at the opening of every 5M bar, current bar value does not update after bar open. As a result, you do not get straight lines for every 30M unless you refresh the indicator. For example, the final value of the bar open at 5:55 will read the 30M RSI at the time of 5:55. Won't display correctly in back testing since it uses ArrayCopySeries() function. No repaint.
v2: It may appear to be very similar to v1, however the difference is that during the progress of each 5M chart, current bar value will be constantly updated based on most current 30M chart reading until 5M bar is closed. For example, the final value of the bar open at 5:55 will read the 30M RSI at the time of 6:00. In other words, this bar will display same as closing value of 30M RSI bar opens at 5:30. You do not get straight lines for every 30M unless you refresh the indicator. Won't display correctly in back testing since it uses ArrayCopySeries() function. No repaint.
v3: The difference between this version and previous 2 versions is quite obvious, it always display straight lines for every 5M bar during every 30 minutes and constantly updating the latest bars based on the current 30M reading. For example, if current time is 5:41, bar opened at 5:30, 5:35, 5:40 all display current 30M bar reading, and these values will be fixed at 6:00 and it'll be the same as closing value of 30M RSI bar opens at 5:30. Won't display correctly in back testing since it uses ArrayCopySeries() function. Also a repaint indicator due to force the latest bars to display same value as current.
===================================
I deal with many trades around the world due to my work, one type of strategy most often presented to me are strategies based on multiple time frame conditions. With that I also see a lot of MTF indicator being used by traders as a tool when they experiment their ideas.
I noticed that there are a lot of misunderstanding behind those indicators and how MT4 handles MTF issue, especially with regards back testing. Some people claim definitively that "MT4 can't back test MTF" or "MTF indicators can't be used in back testing" etc. Those statements are not exactly true.
I'm making an attempt trying to review this issue using MTF RSI as an example.
First of all, automating a system that has MTF elements are definitely doable, all logic can be coded inside the EA without using any indicators. Although indicators serves a nice visual tool for us to see and verify as trading progress. Most traders who use a MTF indicator do not know all the details of the indicator they are using. The reason those indicators can't be used in back testing is due to how it's written, not to say it's impossible to get around that problem.
When it comes to programming, there are many ways to program MTF indicators depending specific needs, not all versions are created equally. Let's assume we are trading 5M chart and display 30M RSI.
v1: Surprisingly a lot of MTF indicator is created using this template which is strange to me, indicator display straight lines for the past, going forward every bar takes the intermediate 30M RSI level at the opening of every 5M bar, current bar value does not update after bar open. As a result, you do not get straight lines for every 30M unless you refresh the indicator. For example, the final value of the bar open at 5:55 will read the 30M RSI at the time of 5:55. Won't display correctly in back testing since it uses ArrayCopySeries() function. No repaint.
PHP Code
int start() {
//----
datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();
if(counted_bars>0) counted_bars++;
limit=Bars-counted_bars;
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
for(i=0,y=0;i<limit;i++) {//this make it not updating current value
if (Time[i]<TimeArray[y]) y++;
ExtMapBuffer1[i]=iRSI(NULL,TimeFrame,RSIperiod,applied_price,y) ;
}
//----
return(0);
}
PHP Code
int start() {
//----
datetime TimeArray[];
int i,limit,y=0,counted_bars=IndicatorCounted();
if(counted_bars>0) counted_bars++;
limit=Bars-counted_bars;
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
for(i=0,y=0;i<=limit;i++) {//this make it keep updating current value
if (Time[i]<TimeArray[y]) y++;
ExtMapBuffer1[i]=iRSI(NULL,TimeFrame,RSIperiod,applied_price,y) ;
}
//----
return(0);
}
PHP Code
int start() {
//----
datetime TimeArray[];
int i,y=0,counted_bars=IndicatorCounted();
ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),TimeFrame);
for(i=0,y=0;i<=Bars;i++) {
if (Time[i]<TimeArray[y]) y++;
if (counted_bars>0 && y>0) break;//this forces to repaint only current high TF value
ExtMapBuffer1[i]=iRSI(NULL,TimeFrame,RSIperiod,applied_price,y) ;
}
//----
return(0);
}
Wise-EA MT4 Programming