I have a few related questions:
1) I'm not sure if a tick contains the information for only one currency pair (i.e. the one in current chart) or all the pairs available from the dealers?
2) If the former is true, what if the EA is designed to process new ticks from multiple currency pairs and requires OnTick function to be called when a tick for any pair of interest arrives?
3) In the MT4 backtest centre, in the drop down list for "Symbol", some entries have the same pair, others have different ones. What does that mean?
What do you mean ? All entries are different, one for each symbol (selected in the Market Watch).
- 2011.02.18
- Konstantin Gruzdev
- www.mql5.com
Only current chart symbol.
You need to be creative. Several solutions. See below article for example.
What do you mean ? All entries are different, one for each symbol (selected in the Market Watch).
Hi Alain,
Regarding your answer to Q2, a further question is: when a new tick (say XAUUSD is the current chart symbol) arrives, if I call iOpen("GBPUSD"), I can have access to an array of prices for GBPUSD yes? or can I? If I can have access to GBPUSD, when does it get updated?
Regarding Q3, if you look at the attached figure, each entry in the drop down list contains two pairs, something like "XAUUSD, Gold" or "BCOUSD, Brent Crude Oil". I am not sure what this combination means.
Thanks a lot!
Regarding your answer to Q2, a further question is: when a new tick (say XAUUSD is the current chart symbol) arrives, if I call iOpen("GBPUSD"), I can have access to an array of prices for GBPUSD yes? or can I? If I can have access to GBPUSD, when does it get updated?
Regarding Q3, if you look at the attached figure, each entry in the drop down list contains two pairs, something like "XAUUSD, Gold" or "BCOUSD, Brent Crude Oil". I am not sure what this combination means.
- Of course you can. Unless the chart is that specific pair/TF,
you must handle
4066/4073 errors.Either at the start of OnTick: Download history in MQL4 EA - MQL4 and MetaTrader 4 - MQL4 programming forum
Or after the Copy functions What are Function return values ? How do I use them ? - MQL4 and MetaTrader 4 - MQL4 programming forum
Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles - Symbol, comma, description. XAUUSD is the symbol for Gold.
Hi Alain,
Regarding your answer to Q2, a further question is: when a new tick (say XAUUSD is the current chart symbol) arrives, if I call iOpen("GBPUSD"), I can have access to an array of prices for GBPUSD yes? or can I? If I can have access to GBPUSD, when does it get updated?
Regarding Q3, if you look at the attached figure, each entry in the drop down list contains two pairs, something like "XAUUSD, Gold" or "BCOUSD, Brent Crude Oil". I am not sure what this combination means.
Thanks a lot!
It's not 2 pairs, it's the "short" name and full name.
- Of course you can, but you must handle
4066/4073 errors.
- Symbol, comma, description. XAUUSD is the symbol for Gold.
Hi whroeder1,
Regarding your answer #1, if the EA only gets ticks for the current chart symbol, say XAUUSD (as said by Alain), does that mean calling iOpen("GBPUSD",shift=0) will only return the latest price (not necessarily up to date) available in the historical data centre if any?
If that is correct, can I do the following:
In a backtest-only scenario, assuming that historical data of both XAUUSD and GBPUSD are available for the backtest time span, the EA is tested on XAUUSD. When OnTick is called, if it is the first tick of a new bar, I can then check close price of the previous bar for GBPUSD by using iClose("GBPUSD")
Thank you!
Hi whroeder1,
Regarding your answer #1, if the EA only gets ticks for the current chart symbol, say XAUUSD (as said by Alain), does that mean calling iOpen("GBPUSD",shift=0) will only return the latest price (not necessarily up to date) available in the historical data centre if any?
If that is correct, can I do the following:
In a backtest-only scenario, assuming that historical data of both XAUUSD and GBPUSD are available for the backtest time span, the EA is tested on XAUUSD. When OnTick is called, if it is the first tick of a new bar, I can then check close price of the previous bar for GBPUSD by using iClose("GBPUSD")
Thank you!
You can't backtest multiple instruments at the same time from one EA in MT4 but you can in MT5. (don't expect meaningful results if you're testing an arb strat)
When I trade multiple pairs on MT4 I use OnTimer() with a ~10-100ms refresh. I also don't use the iTimeSeries functions, but rather the newer CopyRates() with rate structs as they (my understanding) update live rates info from the platform when called.
Hi whroeder1,
Regarding your answer #1, if the EA only gets ticks for the current chart symbol, say XAUUSD (as said by Alain), does that mean calling iOpen("GBPUSD",shift=0) will only return the latest price (not necessarily up to date) available in the historical data centre if any?
If that is correct, can I do the following:
In a backtest-only scenario, assuming that historical data of both XAUUSD and GBPUSD are available for the backtest time span, the EA is tested on XAUUSD. When OnTick is called, if it is the first tick of a new bar, I can then check close price of the previous bar for GBPUSD by using iClose("GBPUSD")
Thank you!
You can access all history data available for all symbols available. On the strategy tester you need to get needed data BEFORE running your tests.
However as said by @nicholishen you can trade only 1 symbol with MT4 Strategy tester.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have a few related questions:
1) I'm not sure if a tick contains the information for only one currency pair (i.e. the one in current chart) or all the pairs available from the dealers?
2) If the former is true, what if the EA is designed to process new ticks from multiple currency pairs and requires OnTick function to be called when a tick for any pair of interest arrives?
3) In the MT4 backtest centre, in the drop down list for "Symbol", some entries have the same pair, others have different ones. What does that mean?
Thank you in advance!