Handle more than one symbol question

 

Hi, i wanna handle more than one symbol , 

so i tried these code  :

 

 string Forexsymbol[24] = {"EURUSD","USDJPY","GBPUSD","USDCHF","NZDCUSD","AUDUSD","EURJPY","EURGBP","EURCHF","EURAUD","EURCAD","EURNZD","GBPJPY","GBPCHF","GBPCAUD","GBPNZD","CHFJPY","CADJPY","CADCHF","AUDJPY","AUDCHF","AUDCAD","AUDNZD","NZDJPY"};  // Array with Symbols

 for(int i=0;i<25;i++)

     {

      anything = iMA(Forexsymbol[i],0,0,0,0,0,0,0,0); 

}

 

But everytime i debugg it says :  " Array out of range" , how to fix ?

 

Array of 24 elements has indices 0 - 23

Your loop goes from 0 to 24. 


This should work: 

string Forexsymbol[24] = {"EURUSD","USDJPY","GBPUSD","USDCHF","NZDCUSD","AUDUSD","EURJPY","EURGBP","EURCHF","EURAUD","EURCAD","EURNZD","GBPJPY","GBPCHF","GBPCAUD","GBPNZD","CHFJPY","CADJPY",
                            "CADCHF","AUDJPY","AUDCHF","AUDCAD","AUDNZD","NZDJPY"};  // Array with Symbols

for(int i=0;i<24;i++)
{

      anything = iMA(Forexsymbol[i],0,0,0,0,0,0,0,0); 

}
 
c0ntr0x: i wanna handle more than one symbol ,
No you don't. You won't be able to use any predefined Variables and a tick on the current chart does not mean there's been a tick on another. You'll have to deal with things like Time[x] != iTime(otherSymbol, x).
It's not necessary. Just write it to trade the current symbol and put it on multiple charts.