Multi-Currency EA for MT5

 
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 
 
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:

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


great thanks