Download MetaTrader 5

Expert Advisor with multiple TimeFrame

To add comments, please log in or register
Forex Trader
114318
Forex Trader  
If expert is using 2 different timeframes (like in indicator calls):

Do I need 2 charts with those 2 different timeframes open? (So data gets pumped in history)
Or just the 1 chart is enough (smallest timeframe) and MT figures the bigger period from the smaller one?
Forex Trader
114318
Forex Trader  
In MetaEditor, check the books (MQL Navigator) for description of prices and indicators, for example iClose for prices or iMA for indicators, or search for 'timeframe'.

You can attach your expert advisor to one chart to be processed at that timeframe for your orders, but also easily pull in prices and indicators from timeframes for calculations in your expert advisor. As long as you have date for the timeframes you use, it should also work in backtesting.

A brilliant feature of MT4! We do cry for help and improvements here a lot, but nevertheless I am sure that most of us feel that MT4 is a great piece of software.
Forex Trader
114318
Forex Trader  
Thank you bubo, but not exactly what I am asking for.

Simple I think that a chart needs to be open for the data to be pumped in the history. I was just trying to get away from opening a lot of charts.
Forex Trader
114318
Forex Trader  
Shahin,

as far as I can tell from my tests, iClose(), iOpen() etc. with different time frames in the parameter list (e.g. iClose(NULL, PERIOD_H1, ....); actually requests these quotes from the server.


Markus
Forex Trader
114318
Forex Trader  

Shahin,

as far as I can tell from my tests, iClose(), iOpen() etc. with different time frames in the parameter list (e.g. iClose(NULL, PERIOD_H1, ....); actually requests these quotes from the server.


Markus

Even in test mode?
-Stan
Forex Trader
114318
Forex Trader  
Thank you Shimodax+sub.

Following is a quote from navigator:
" double iClose( string symbol, int timeframe, int shift)
Returns Close value for the bar of indicated symbol with timeframe and shift. If local history is empty (not loaded), function returns 0. "

It mentions local history not server.
Syavash Nikkhah
37
Syavash Nikkhah  
Forex Trader:
If expert is using 2 different timeframes (like in indicator calls):

Do I need 2 charts with those 2 different timeframes open? (So data gets pumped in history)
Or just the 1 chart is enough (smallest timeframe) and MT figures the bigger period from the smaller one?


Hello,

This is the question that I have too. I haven't found the answer. if you found the answer would you send to me as well .

Thanks in advance

Marco vd Heijden
Moderator
6137
Marco vd Heijden  
Syavash Nikkhah:


Hello,

This is the question that I have too. I haven't found the answer. if you found the answer would you send to me as well .

Thanks in advance

Please read: https://www.mql5.com/en/articles/75


The Algorithm of Ticks' Generation within the Strategy Tester of the MetaTrader 5 Terminal
The Algorithm of Ticks' Generation within the Strategy Tester of the MetaTrader 5 Terminal
  • 2010.06.02
  • MetaQuotes Software Corp.
  • www.mql5.com
MetaTrader 5 allows us to simulate automatic trading, within an embedded strategy tester, by using Expert Advisors and the MQL5 language. This type of simulation is called testing of Expert Advisors, and can be implemented using multithreaded optimization, as well as simultaneously on a number of instruments. In order to provide a thorough testing, a generation of ticks based on the available minute history, needs to be performed. This article provides a detailed description of the algorithm, by which the ticks are generated for the historical testing in the MetaTrader 5 client terminal.
To add comments, please log in or register