How to verify more than one currency pairs in one EA and in one chart?

 

Hi Experts,

 

 I have written an indicator/EA in which I use Symbol() to find the currency pair of the Chart that is using the EA.

 If I want to test my EA for (say) 10 currency pairs, then I have drag and drop the EA to 10 different currency charts. 

 Instead can i use the below code to verify 10 pairs in single chart of EURUSD?

 I tried this, but my EA is not working. Could anyone please help me on this?

Thanks in advance. 

 

void fn_Get_All_CcyPairs()
{   
    string v_Sym[];
 
    v_Sym[0] = "AUDUSD";  
    v_Sym[1] = "AUDCAD";
    v_Sym[2] = "AUDCHF";
    v_Sym[3] = "AUDJPY";
    v_Sym[4] = "AUDNZD";
    v_Sym[5] = "CADCHF";
    v_Sym[6] = "CADJPY";
    v_Sym[7] = "CHFJPY";
    v_Sym[8] = "EURAUD";
    v_Sym[9] = "EURCAD";
    v_Sym[10] = "EURCHF";
    v_Sym[11] = "EURGBP";
    v_Sym[12] = "EURJPY";
    v_Sym[13] = "EURNZD";
    v_Sym[14] = "EURUSD";
    v_Sym[15] = "GBPAUD";
    v_Sym[16] = "GBPCAD";
    v_Sym[17] = "GBPCHF";
    v_Sym[18] = "GBPJPY";
    v_Sym[19] = "GBPNZD";
    v_Sym[20] = "GBPUSD";
    v_Sym[21] = "NZDCAD";
    v_Sym[22] = "NZDJPY";
    v_Sym[23] = "NZDUSD";
    v_Sym[24] = "USDCAD";
    v_Sym[25] = "USDCHF";
    v_Sym[26] = "USDJPY";
    v_Sym[27] = "USDTRY";  
  
    int i = 0;
    string v_CcyPair;
    while ( i <= 27 )
     {
      v_CcyPair    = v_Sym[i]; 

      fn_Get_SetUps( v_CcyPair);    
    
      i = i + 1;
     }
 
}  

 

Thanks,
Prakash.R 

 
    • Do not trade multiple currencies, you can't use any predefined variables, can't use the tester, must poll (not OnTick,) and usually other problems.
    • Code it to trade the chart pair only. Look at the others if you must.
    • Then put it on other charts to trade the other pairs. Done.
  1. string v_Sym[];
     
        v_Sym[0] = "AUDUSD";  
        v_Sym[1] = "AUDCAD";
        v_Sym[2] = "AUDCHF";
    This won't work; the array has no size so you can't assign to it. Simplify
    string v_Sym[] = { "AUDUSD", "AUDCAD", "AUDCHF" ...};
 
Thanks a lot WHRoeder :)
 
If you want all symbols, see https://www.mql5.com/en/forum/156498
 
seems to me this may help as an example of multicurrency ea tested real-time https://www.mql5.com/en/code/7225. i advised this code when wrote a code for myself and it works fine although takes long to start when backtesting.
 
  1. Do not trade multiple currencies, you can't use any predefined variables, can't use the tester, must poll (not OnTick,) and usually other problems.
  2. Code it to trade the chart pair only. Look at the others if you must.
  3. Then put it on other charts to trade the other pairs. Done.
 
WHRoeder:
  1. Do not trade multiple currencies, you can't use any predefined variables, can't use the tester, must poll (not OnTick,) and usually other problems.
  2. Code it to trade the chart pair only. Look at the others if you must.
  3. Then put it on other charts to trade the other pairs. Done.

Hang on... number 1 is a bit disturbing. I don't care that I can't use the predefined variables because you can get the same information through functions. And I understand that I can act on only the incoming ticks from one pair. But that the Strategy Tester can't handle multiply currencies is annoying.

 

https://www.mql5.com/en/articles/1490

But this article says something a little different under the heading "Modelling Prices on Other Symbols":

Nevertheless, the tester in MetaTrader 4 allows receiving information about prices of other symbols, different from the tested one. But in this case the modelling is not carried, the data is extracted as it is. The zero bar is simplified to introducing on the beginning of the process the following: High[0]=Low[0]=Close[0]=Open[0], Volume[0]=1 which enables to know the price at the beginning of the bar, but no price at the end. To make sure, just test a simple Expert Advisor on EURUSD in the mode "Every tick".


So it does seem that you can receive information from other symbols, but that ticks are not modelled, and apparently you can't trade the other symbols.

 
If you read the first comment on 'Testing Features and Limits in MetaTrader 4 - MQL4 Articles you would see the bar zero statement "is no longer correct"