Download MetaTrader 5

Is NewTick event only generated corresponding to a single currency pair ??

To add comments, please log in or register
27cc09
15
27cc09  

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!

Alain Verleyen
Moderator
33811
Alain Verleyen  
27cc09:

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?

Only current chart symbol.

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?

You need to be creative. Several solutions. See below article for example.


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).

The Implementation of a Multi-currency Mode in MetaTrader 5
The Implementation of a Multi-currency Mode in MetaTrader 5
  • 2011.02.18
  • Konstantin Gruzdev
  • www.mql5.com
For a long time multi-currency analysis and multi-currency trading has been of interest to people. The opportunity to implement a full fledged multi-currency regime became possible only with the public release of MetaTrader 5 and the MQL5 programming language. In this article we propose a way to analyze and process all incoming ticks for several symbols. As an illustration, let's consider a multi-currency RSI indicator of the USDx dollar index.
27cc09
15
27cc09  
Alain Verleyen:
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!

whroeder1
16574
whroeder1  
27cc09:

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.

There is no iOpen function in ML5. Why did you post your MT4 question in the Root / MT5 EA section instead of the MQL4 section, (bottom of the Root page?)
  1. Of course you can. Unless the chart is that specific pair/TF, you must handle 4066/4073 errors.
  2. Symbol, comma, description. XAUUSD is the symbol for Gold.
Alain Verleyen
Moderator
33811
Alain Verleyen  
27cc09:

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?

It's updated as every pair, a new candle on first tick, so you could have to synchronize your symbols.


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.

27cc09
15
27cc09  
whroeder1:
  1. Of course you can, but you must handle 4066/4073 errors.
  2. 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!

nicholishen
1090
nicholishen  
27cc09:

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.

Alain Verleyen
Moderator
33811
Alain Verleyen  
27cc09:

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.


To add comments, please log in or register