Multiple timeframes and backtesting. Workaround

 

I have an EA  for Period 5 min but in the code I also use daily data like the daily 8 and 21 SMA.  I want to backtest my EA but since  MT4 cannot backtest multitimeframe  I need a workaround for this:

I have this daily SMA filter:

iMA(Symbol(),PERIOD_D1,8,0,MODE_SMA,PRICE_CLOSE,0)  <  iMA(Symbol(),PERIOD_D1,21,0,MODE_SMA,PRICE_CLOSE,0)

I need to rewrite so the daily 8 and 21 SMA is  calculated from the 5 min chart. I've tried to put in 2304 and 6048 instead of but it dosen't seem to work:

iMA(Symbol(),0,2304,0,MODE_SMA,PRICE_CLOSE,0)  <  iMA(Symbol(),0,6048,0,MODE_SMA,PRICE_CLOSE,0

 

I also use this formula and need to rewrite so it works with 5 min backtest:

iHigh(Symbol(),PERIOD_D1,0)-iLow(Symbol(),PERIOD_D1,0)

 

Same with this,  find daily ATR:

iATR(Symbol(),PERIOD_D1,10,0)

I would really appreciate if somebody can help or give me som hints.

 
kenned45900:

I have an EA  for Period 5 min but in the code I also use daily data like the daily 8 and 21 SMA.  I want to backtest my EA but since  MT4 cannot backtest multitimeframe  I need a workaround for this:


Yes it can.
 
RaptorUK:
Yes it can.


hmm interesting. I'm new to programming but I just started using Molanis and on their website they write: 

"Multi timeframe EAs CANNOT be backtested in MT4. It is not possible. This ea will work fine but backtesting results are misleading. MT4 can backtest one timeframe at a time. The only way to backtest multi timeframe EAs is using MetaTrader 5"  http://www.molanis.com/products/molanis-strategy-builder/expert-advisors-for-mt4

Why would they write this if its wrong?

I guess you know what youre talking about, but what is the trick to make it work? Do I need 99% modeling quality?  I use 90

 
kenned45900:

hmm interesting. I'm new to programming but I just started using Molanis and on their website they write: 

"Multi timeframe EAs CANNOT be backtested in MT4. It is not possible. This ea will work fine but backtesting results are misleading. MT4 can backtest one timeframe at a time. The only way to backtest multi timeframe EAs is using MetaTrader 5"  http://www.molanis.com/products/molanis-strategy-builder/expert-advisors-for-mt4

1.  Why would they write this if its wrong?

I guess you know what youre talking about, but what is the trick to make it work? Do I need 99% modeling quality?  I use 90

1.  you will have to ask them:  first read this:  Testing Features and Limits in MetaTrader 4

You only get 99% modelling quality using tick data and a 3rd party paid for application,  and then 99 is just the number written to a file,  it doesn't mean anything.

 

Perhaps they are talking about this:

 

"Zero bar of another timeframe for the same symbol under test is modeled approximately

Open = correct Open, Close = correct Close, Low = min (Open,Close), High = max (Open,Close), Volume = final Volume (false)"

 

it may be a problem if you use Indicators that re-paint . . .  which you seem to be doing in your post above.

 
RaptorUK:

1.  you will have to ask them:  first read this:  Testing Features and Limits in MetaTrader 4

You only get 99% modelling quality using tick data and a 3rd party paid for application,  and then 99 is just the number written to a file,  it doesn't mean anything.


Thank you very much. I've done som simple testing now and it works.
 
RaptorUK: 1.  you will have to ask them:  first read this:  Testing Features and Limits in MetaTrader 4
It also states "Zero bar of another timeframe for the same symbol under test is modeled approximately" which is no longer true.
 
Comments that do not relate to this topic, have been moved to "MTF Stochastic Indicator and Strategy Tester".
 

Hello coders,

I have somehow the same issue with a little difference so I decided to comment here:

I wonder if I could use multi-time frame data for the same Symbol when I'm backtesting my EA. Not just generated OHLC, but its fully tick data!

I've purchased tick data(99%) but I don't know how can I test my EA on 2 different time frames at the same time since I'm Newbie...
For example I want to open order whenever 4H and 1H candles both hit their Moving Averages.


Any advice is appreciated,

Hossein

Reason: