Hello, my EA can work well on multiple currencies so I would like to test it with the portfolio tester on more than one currency. Is there any recommendations or resources for designing a multi-currency EA for the portfolio tester in MT5? Is it necessary to modularize the EA code and test each pair simultaneously within the EA? Or is there some shortcut for expediting this? Is there any code or templates you could recommend for this? Thank you
- MetaTrader 5 for your employees
- Charts in MetaTrader 5 trading platform for Forex and stocks
- MetaTrader 5 Built-in Trading Strategy Tester
I guess you can wrap your current code to class. It's the fastest way that i can think :)
It's easy! Here is example how I do it. By using it, you can test USDCAD, GBPUSD, USDCHF or any other currency by selecting EURUSD and get the same results (or use them all in the same time).
int OnInit() { //Add all currencies you want to test MarketBookAdd("USDCHF"); MarketBookAdd("GBPUSD"); MarketBookAdd("USDCAD"); //Add timer in case if EURUSD (if you use it as base currency for testing) does not have any ticks. //I use 2 seconds and only when in real trading. It is not necessary for optimisation and testing if(!MQL5InfoInteger(MQL5_OPTIMIZATION) && !MQL5InfoInteger(MQL5_TESTING)) { EventSetTimer(2); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnTick() { Work(); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void OnTimer() { Work(); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ void Work() { //Do your strategy here. }
tsaktuo:
great thanks
It's easy! Here is example how I do it. By using it, you can test USDCAD, GBPUSD, USDCHF or any other currency by selecting EURUSD and get the same results (or use them all in the same time).

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register