Download MetaTrader 5
To add comments, please log in or register
Do you have questions on how to turn your idea into reality? Ask them on the Forum!
c0ntr0x
81
c0ntr0x 2014.06.14 13:43 

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 ?

Drazen Penic
2406
Drazen Penic 2014.06.14 13:47  

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

}
whroeder1
13623
whroeder1 2014.06.14 15:06  
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.
/
To add comments, please log in or register