I find a bug in mt5 multicurrency trading.

 

Now, let's assume that I want to test a new EA, and the currencies included in the test are audnzd, nzdcad, and audcad.

Please Note: NEW EA support multi-currency trading, you can set Onechart parameter of EA to "audnzd,nzdcad,audcad", then EA can trading three symbols at the same time while attaching on one currency chart.


If I attach the EA to audnzd and perform a test, and the test result is represented as result1.

Then, I attach the EA to nzdcad and perform another test, and the result is represented as result2.

Finally, I attach the EA to audcad and perform a test, and the result is represented as result3.

In
this scenario, there can be significant differences in the results of result1,
result2, and result3. Sometimes, the final balance of result1 can be greater
than 8 times the final balance of result2.

I can repeat this issue on other EA.
 

Discussion about market products is not allowed, use the Comments section of these EAs to find your answers or ask the authors/sellers for help and advice.

Other users may help you with general observations on your post though.

 
Eleni Anna Branou #:

Discussion about market products is not allowed, use the Comments section of these EAs to find your answers or ask the authors/sellers for help and advice.

Other users may help you with general observations on your post though.

It no matter with any EAs. What I want to clarify is MT5 has a bug if EA want to support multiple currency.

 
Yihang Zou #:

It no matter with any EAs. What I want to clarify is MT5 has a bug if EA want to support multiple currency.

There is not known MT5 bug on this matter.

Fix your EA code or report it to the author.

 
Yihang Zou #: It no matter with any EAs. What I want to clarify is MT5 has a bug if EA want to support multiple currency.

I've been using multi-currency EAs of my own design for a very long time and I don't have any problem testing them in MT5 Strategy Tester, be it in single currency mode or multi-currency mode.

 
Fernando Carreiro #:

I've been using multi-currency EAs of my own design for a very long time and I don't have any problem testing them in MT5 Strategy Tester, be it in single currency mode or multi-currency mode.

hi, buddy, do you find an odd event?

I forgot to mention, all symbols I tested is use customized symbols.

because i choose to use real tick data.

suppose certain EA support multi-currency, like audnzd, nzdcad, audcad.

I tested at least two EAs. since here I am not allowed to mention the EA's name.

now, I use EA1, EA2 to refer them.

I tested EA1 and set above three currency pairs in its parameter setting. and

then I attach EA1 on audnzd, finally, its final balance is 12500.

later i attach EA1 on nzdcad, and get 22324$.

next i attach EA1 on audcad, and get 50021$.

and I repeat above process on EA2 as well. then I found similar problem.

all three test result are different.

 

Please do not call me "buddy"! Unless you know the person well, calling a stranger "buddy" is considered rude.

I also test with real tick data. You don't need to create custom symbols for testing with real tick data, but that is besides the point.

Something is either wrong with the EAs being tested, or something is wrong with your setup or custom symbols.

 
Yihang Zou #:

hi, buddy, do you find an odd event?

I forgot to mention, all symbols I tested is use customized symbols.

because i choose to use real tick data.

suppose certain EA support multi-currency, like audnzd, nzdcad, audcad.

I tested at least two EAs. since here I am not allowed to mention the EA's name.

now, I use EA1, EA2 to refer them.

I tested EA1 and set above three currency pairs in its parameter setting. and

then I attach EA1 on audnzd, finally, its final balance is 12500.

later i attach EA1 on nzdcad, and get 22324$.

next i attach EA1 on audcad, and get 50021$.

and I repeat above process on EA2 as well. then I found similar problem.

all three test result are different.

So what ?

That means these EAs are not well coded for multi-currencies, simple as that.

 
Fernando Carreiro #:

Please do not call me "buddy"! Unless you know the person well, calling a stranger "buddy" is considered rude.

I also test with real tick data. You don't need to create custom symbols for testing with real tick data, but that is besides the point.

Something is either wrong with the EAs being tested, or something is wrong with your setup or custom symbols.

sorry about that. I am familiar with english.

https://www.mql5.com/en/blogs/post/746240

I read this article to import tick data and run EA on customized symbols.

you mentioned you don't need to create custom symbols, how?

because i want to test a EA with 15 years tick data. I can't get so long time period of tick data on standard symbols.

that's why I have to create a customized symbols.

 

and there is one thing your guys don't realize.

if an EA attach on a symbol's chart, then on its "OnTick" event handler, this function will only be called whenever there is a new quote information of attached symbol arrived.

if this EA work on multi-currency at same time, for example: audnzd, nzdcad, suppose this EA is attached on pair audnzd.

Then this OnTick of this EA will only be called when latest quote of audnzd arrived, but during the gap, if nzdcad is updated, then OnTick will not be called.

So maybe this is the root cause of testing result of backtest inconsistent.

Importing High Quality Tick Data to MetaTrader 5
Importing High Quality Tick Data to MetaTrader 5
  • 2021.11.28
  • www.mql5.com
In order to vet a potential trading strategy, it is imperative to ensure that the results obtained f r om optimizations and strategy tests are a true reflection of the performance of your EA
 
Yihang Zou #: and there is one thing your guys don't realize. if an EA attach on a symbol's chart, then on its "OnTick" event handler, this function will only be called whenever there is a new quote information of attached symbol arrived. if this EA work on multi-currency at same time, for example: audnzd, nzdcad, suppose this EA is attached on pair audnzd. Then this OnTick of this EA will only be called when latest quote of audnzd arrived, but during the gap, if nzdcad is updated, then OnTick will not be called. So maybe this is the root cause of testing result of backtest inconsistent.

Yes, we do realise that, and that is obvious. That is why you must know how to properly code a multi-symbol EA. You can't rely on OnTick alone.

For multi-symbol you must also use a combination of either OnTimer, or special slave indicators for calling custom chart events. That is well known and it is not a MT5 bug.

Your EAs are faulty if they only rely on OnTick. Fix the EAs to properly work with multi-symbol.

Forum on trading, automated trading systems and testing trading strategies

Never miss Ticks

Fernando Carreiro, 2023.01.10 13:54

Ok, then that is the problem!

If you only react on OnTick(), then you are reacting only to ticks from the current symbol. You will miss all tick events from the other symbols.

Also, if your event handler takes to long then you will also miss ticks from the current symbol too.

To resolve the issue you will need to make use of a combination of OnTick() and OnTimer() or use a slave indicator to send out a custom chart events to signal tick events on other symbols (see below).

And to access all the tick data without missing any, you will need to use CopyTicks() function.

Also read the following ...


Forum on trading, automated trading systems and testing trading strategies

Can a buffer update in the middle of two commands?

Fernando Carreiro, 2022.04.27 13:11

The OnTick() event handler gets called on every new tick for the current symbol only, but what will you do if there are no new ticks for the current symbol, but there have been ticks for other symbols you are trading with the EA?

By using the OnTimer() in combination with OnTick(), set at a regular interval, you still get to query the current state of other symbols, even if the current symbol is inactive. Consider it a "heartbeat" function or protocol.

By using EURUSD as your primary chart, you will have plenty of tick activity since its one of the most active symbols, but it also has lull periods compared to other symbols, or not trade at all compared to some other symbols. What if you are also trading BitCoin on your EA which trades during the weekend, but EURUSD does not?

By using the OnTimer() as well, your EA will continue to query all the other symbols and act accordingly even if the primary chart is on pause.

Articles

The Implementation of a Multi-currency Mode in MetaTrader 5

Konstantin Gruzdev, 2011.02.18 17:58

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.
 
Fernando Carreiro #:

Yes, we do realise that, and that is obvious. That is why you must know how to properly code a multi-symbol EA. You can't rely on OnTick alone.

For multi-symbol you must also use a combination of either OnTimer, or special slave indicators for calling custom chart events. That is well known and it is not a MT5 bug.

Your EAs are faulty if they only rely on OnTick. Fix the EAs to properly work with multi-symbol.

so do you mean properly code a multi-symbol EA, no matter you attach EA on any currency, the EA BACKTEST result should be same, right?

Reason: