Use of Many Timeframes

 

Hi,

I would like to know if it is possible to get the data (tick price, close, high, low, indicators, ...) of an higher timeframe and use them in an expert advisor attached to a chart of a smaller timeframe.

For example, I would like to know how is the candlestick on the higher timeframe chart and use it as an entry point for the smaller timeframe chart.

I hope there is a solution :-)

Cheers,

Daniel

 
dvarrin:
Hi,

I would like to know if it is possible to get the data (tick price, close, high, low, indicators, ...) of an higher timeframe and use them in an expert advisor attached to a chart of a smaller timeframe.

For example, I would like to know how is the candlestick on the higher timeframe chart and use it as an entry point for the smaller timeframe chart.

I hope there is a solution :-)

Cheers,

Daniel

Hi Daniel

If your coding using MT4, then you can specify timeframe for any indicator (its usually the second argument in any function call), same goes for obtaining OHLC data using the iOpen, iClose functions etc

If your trading manually, you might want to read the MTF multi timeframe indicator thread started by Kerris

regards

zu

 

Hi zu,

Thank you very much for your fast answer :-))

If we backtest an expert advisor and we are using the "Every Tick" model, does it mean that for the same bar, for example on the 15 min chart, we get some or all of its different states during 15 min?

In order to backtest my expert advisor, I would like to have livetrading-like behavior.

Cheers,

Daniel

 
dvarrin:
Hi zu,

Thank you very much for your fast answer :-))

If we backtest an expert advisor and we are using the "Every Tick" model, does it mean that for the same bar, for example on the 15 min chart, we get some or all of its different states during 15 min?

In order to backtest my expert advisor, I would like to have livetrading-like behavior.

Cheers,

Daniel

Hi Daniel

Thats a very good question, and to be honest Im not sure of the answer because I dont use the backtester, due to its unreliability. My understanding is that if your testing a strategy on the 15 min chart, if you had for example 1 minute data available, then this would be used to simulate the ticks. However, I think that the model that they use to simulate ticks is quite basic (I think they assume linear interpolation between open, high, low and close). If no 1 minute data's available then it'll use 5 minute bars, and if no 5 minute data, 15 minute bars etc.

One thing I have done, is written an EA to record ticks and indicator settings, then compared real time signals to those subsequently interpolated by the EA in backtesting. My conclusion was the backtester is a waste of disk space, but there are a few people here with far more experience of using it, who understand its limitations and claim that it can be useful.

At one time there was a group of people collecting tick data from a number of brokers, as I believe they claimed the backtester could use this. I think they had a few problems as the file sizes can get quite large, and they where having to combine data from different brokers, with different timezones, gaps in the data etc. I think the projects still ongoing, Im sure there where a few regulars who post here who where involved

If I can remember the details, I'll post them here

 

Hi,

Thank you very much for you precious informations! I understand better how Metatrader is processing during the backtesting of an EA. There was some document on how to get a got sample of data for backtesting in one of the pdf file explaining the Phoenix trading system.

I'll try to load the one minute's chart :-) For sure it must be quite big and I know that backtesting an EA is never a good proof that it will work, but if I can use this kind of ticks' backtesting, it can give already a good idea of the result when trading live later on and the process to fine tune the EA is faster if we can perform quick tests.

Thanks a lot to you again!

Cheers,

Daniel

 
dvarrin:
Hi,

I would like to know if it is possible to get the data (tick price, close, high, low, indicators, ...) of an higher timeframe and use them in an expert advisor attached to a chart of a smaller timeframe.

For example, I would like to know how is the candlestick on the higher timeframe chart and use it as an entry point for the smaller timeframe chart.

I hope there is a solution :-)

Cheers,

Daniel

Pretty sure this is how you do it:

Lets say you want to use RSI, so you call it in your code.

vla=iRSI(NULL,0,14,PRICE_CLOSE,0);

The zero after null signifies current chart time frame.

If you want to read 4 hour time frame change to:

vla=iRSI(NULL,PERIOD_H4,14,PRICE_CLOSE,0);

Then attach to a lesser time frame chart.

You can use any of these values:

Constant Value Description

PERIOD_M1 = 1 minute.

PERIOD_M5 = 5 minutes.

PERIOD_M15 = 15 minutes.

PERIOD_M30 = 30 minutes.

PERIOD_H1 = 1 hour.

PERIOD_H4 = 4 hour.

PERIOD_D1 = Daily.

PERIOD_W1 = Weekly.

PERIOD_MN1 = Monthly.

0 (zero) = Time frame used on the chart.

Hope this helps.

Reason: