Multi Timeframe Indicators - page 476

 
nicobo78:
I need mtf japanese candlestick indicator Any help please!

This link might help you : Candlestick chart - Wikipedia, the free encyclopedia

Also, you might try this indicator : custom candles any time frame.mq4

 

Trying to make a simple moving average strategy tester with H1 ticks but using H4 MA with the help of movingaverage_mtf code supplied in these forums.But getting weird H4 moving average values.can anybody help.I doubt it is copying H4 bar time correctly when i use the function :

ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),420);

Is it possible to use multiframe indicators in strategy tester ?

 
rickyponting:
Trying to make a simple moving average strategy tester with H1 ticks but using H4 MA with the help of movingaverage_mtf code supplied in these forums.But getting weird H4 moving average values.can anybody help.I doubt it is copying H4 bar time correctly when i use the function :

ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),420);

Is it possible to use multiframe indicators in strategy tester ?

If you did not write it wrong, the last parameter in this line :

ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),420);

Should be 240 not 420

 
rickyponting:
Trying to make a simple moving average strategy tester with H1 ticks but using H4 MA with the help of movingaverage_mtf code supplied in these forums.But getting weird H4 moving average values.can anybody help.I doubt it is copying H4 bar time correctly when i use the function :

ArrayCopySeries(TimeArray,MODE_TIME,Symbol(),420);

Is it possible to use multiframe indicators in strategy tester ?

PS: yes, it is possible to use multi time frame indicators in strategy tester, but make sure you do not use current (opened) bar of another time frame or else you are going to get fake positive results (metatrader strategy tester will "know the future" in that case)

 

sorry..I m using 240 in the code...but still no result. Can any kind soul paste some reference code where multi frame SMA is being used in strategy tester.

 
rickyponting:
sorry..I m using 240 in the code...but still no result. Can any kind soul paste some reference code where multi frame SMA is being used in strategy tester.

Here is a simple EA that uses multi time frame sma and can be used in strategy tester too (use SmaTimeFrame parameter to choose the target time frame for sma) :

extern int SmaPeriod = 14;

extern int SmaPrice = PRICE_CLOSE;

extern int SmaTimeFrame = 0;

int init() { return(0); }

int deinit() { return(0); }

int start()

{

int smaShift = iBarShift(NULL,SmaTimeFrame,Time[0]);

double smaValue = iMA(NULL,SmaTimeFrame,SmaPeriod,0,MODE_SMA,SmaPrice,smaShift);

Comment(DoubleToStr(smaValue,Digits));

return(0);

}
 

based on ur code i have tried below code to pass on the different time frame MA values in a array...but MA values ares not getting passed into the array..showing all zero..pls help.

extern int SmaPeriod = 14;

extern int SmaPrice = PRICE_CLOSE;

extern int SmaTimeFrame = 1440;

int init() { return(0); }

int deinit() { return(0); }

int start()

{

int counted_bars, limit,i;

int BarShift[];

double ExtMA[],smaValue;

counted_bars=IndicatorCounted();

limit=Bars-counted_bars;

for(i=0;i<limit;i++)

{

BarShift= iBarShift(NULL,SmaTimeFrame,Time);

ExtMA = iMA(NULL,SmaTimeFrame,SmaPeriod,0,MODE_SMA,SmaPrice,BarShift);

}

return(0)

 
rickyponting:
based on ur code i have tried below code to pass on the different time frame MA values in a array...but MA values ares not getting passed into the array..showing all zero..pls help.

extern int SmaPeriod = 14;

extern int SmaPrice = PRICE_CLOSE;

extern int SmaTimeFrame = 1440;

int init() { return(0); }

int deinit() { return(0); }

int start()

{

int counted_bars, limit,i;

int BarShift[];

double ExtMA[],smaValue;

counted_bars=IndicatorCounted();

limit=Bars-counted_bars;

for(i=0;i<limit;i++)

{

BarShift= iBarShift(NULL,SmaTimeFrame,Time);

ExtMA = iMA(NULL,SmaTimeFrame,SmaPeriod,0,MODE_SMA,SmaPrice,BarShift);

}

return(0)

I will answer with a question : what is the size of your arrays?

You never initialized the arrays so you have zero sized arrays. Make sure your arrays are made correct size. Also, IndicatorCounted() does not work in EAs. You have to get that value some other way (one way would be to check the value of Bars built in variable and compare it to some stored value in your EA)

 

Can this be made MTF??

Files:
 

1. can i declare any big arbitray size array ? like array[2000]..I was under the impression once i declare array it will dynamically allocate memory.2.saw in couple of places that easiest solution is to use iBars..can i use it without materially affecting the results ?

Reason: