Backtesting a multi-currency EA

 

Hi Guys!

 

I just cannot find any good info regarding backtesting a multi currency EA. 

 

I keep getting errors saying: "loading of iSpy (GBPUSD),M15 failed"

 

It compiles just fine!

 

Is it impossible to backtest a multi-currency EA?? 

 

Here is some code:

 

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit() {

   // Create moving-average handle
   MA_Handle = iMA(_Symbol, PERIOD_CURRENT, 20, 0, MODE_EMA, PRICE_CLOSE);
   
   if(iCustom("GBPUSD", PERIOD_M15,"iSpy",ChartID(),0)==INVALID_HANDLE) 
      { Print("Error in setting of spy on GBPUSD"); return(true);}
   if(iCustom("EURUSD", PERIOD_M15,"iSpy",ChartID(),1)==INVALID_HANDLE) 
      { Print("Error in setting of spy on EURUSD"); return(true);}
   if(iCustom("USDJPY", PERIOD_M15,"iSpy",ChartID(),2)==INVALID_HANDLE) 
      { Print("Error in setting of spy on USDJPY"); return(true);}
      
   Print("Spys ok, waiting for events...");
   
   return(INIT_SUCCEEDED);
}

//+------------------------------------------------------------------+
//| The Standard event handler.                                      |
//| See MQL5 Reference for the details.                              |
//|                                                                  |
//| In this case it is used for decoding of spy messages, sent by    |
//| iSPY spy indicator                                               |
//+------------------------------------------------------------------+
void OnChartEvent(const int id, const long& lparam, const double& dparam, const string& sparam) {
   
   if (id >= CHARTEVENT_CUSTOM) {
      Print(TimeToString(TimeCurrent(),TIME_SECONDS)," -> id=", id-CHARTEVENT_CUSTOM,":  ",sparam," ",EnumToString((ENUM_TIMEFRAMES)lparam)," price=",dparam);
   }
}

 

Thanks in advance!
 
Brandsma:

Hi Guys!

 

I just cannot find any good info regarding backtesting a multi currency EA. 

 

I keep getting errors saying: "loading of iSpy (GBPUSD),M15 failed"

 

It compiles just fine!

 

Is it impossible to backtest a multi-currency EA?? 

 

Here is some code:

 

 

Thanks in advance!

There is no problem to backtest a multi currency EA with MT5.

Do you have the iSpy indicator in Indicators folder ?

 

Your code was designed for MetaTrader 4 platform, and MT4 doesn't support multi-currencies EA backtest in Strategy Tester.

The easy way is, open a DEMO account, and test your multi-currencies EA.

 

Hi angevoyageur ,

 

You are right. Stupid of me, but I was thinking it was a default Indicator.

 

Thanks for you're quick help! 

 
tradelife:

Your code was designed for MetaTrader 4 platform, and MT4 doesn't support multi-currencies EA backtest in Strategy Tester.

The easy way is, open a DEMO account, and test your multi-currencies EA.

No it is not for mql4, it works just fine on MQL5 :) 

 
angevoyageur:

There is no problem to backtest a multi currency EA with MT5.

Do you have the iSpy indicator in Indicators folder ?

By the way..

 

Do you recommend this approuch for creating a multi-currency EA?

 

My plan is to have a custom "onTick" function, that repeats itself for every symbol tick, pointing out to the trading function, passing the current symbol to it.

 

I know its not the 'nicest' approuch, as it isn't realy OOP.. But as a start.... 

 

Many thanks for you're advice :) 

Reason: