I don't have the greatest grasp on memory allocation so I'm wondering if this issue has something to do with that. Here is the problem I'm having:
I start with 3 user input strings:
input string currencyTickersString = "AUDCAD,AUDCHF,AUDJPY,AUDNZD,AUDUSD,CADCHF,CADJPY,CHFJPY,EURAUD,EURCAD,EURCHF,EURCZK,EURDKK,EURGBP,EURHKD,EURHUF,EURJPY,EURMXN,EURNOK,EURNZD,EURPLN,EURRUB,EURSEK,EURSGD,EURTRY,EURUSD,EURZAR,GBPAUD,GBPCAD,GBPCHF,GBPCZK,GBPDKK,GBPHKD,GBPHUF,GBPJPY,GBPMXN,GBPNOK,GBPNZD,GBPPLN,GBPSEK,GBPSGD,GBPTRY,GBPUSD,GBPZAR,NOKSEK,NZDCAD,NZDCHF,NZDJPY,NZDSGD,NZDUSD,USDCAD,USDCHF,USDCNH,USDCZK,USDDKK,USDHKD,USDHUF,USDJPY,USDMXN,USDNOK,USDPLN,USDRUB,USDSEK,USDSGD,USDTRY,USDZAR";
input string commodityTickersString = "XAGUSD,XAUUSD,UKOUSD,USOUSD,XNGUSD";
input string indexTickersString = "100GBP,200AUD,225JPY,D30EUR,E35EUR,E50EUR,F40EUR,H33HKD,NASUSD,SPXUSD,U30USD";
Then in the OnInit function I convert those strings to arrays to make it easier to loop over them later on:
currencyTickers[i] = StringSubstr(currencyTickersString,i*7,6);
Print("-->Currency Pair: ", currencyTickers[i]);
commodityTickers[i] = StringSubstr(commodityTickersString,i*7,6);
Print("-->Commodity Pair: ", commodityTickers[i]);
indexTickers[i] = StringSubstr(indexTickersString,i*7,6);
Print("--> Indices Pair: ", indexTickers[i]);
For the two smaller arrays of commodityTickers and indexTickers everything always works fine and I have no issues, but for the larger array of currencyTickers everything will work completely fine for several runs and then all of a sudden the program will get run again and none of the info will be in the array and it's printing every item out as blank. I have another section in the code where I have a 300 item array that never has any issues and that is setup exactly the same way so I am totally at a loss for what is going on.
I have been stumbling over this for hours and cannot figure it out.
Any help would be greatly appreciated.
First , print out the length of the feed string on init .
//add this on init
Print("Loaded Length = "+IntegerToString(str_len));
everything will work completely fine for several runs and then all of a sudden
StringSplit(currencyTickersString, ',', currencyTickers);
StringSplit(commodityTickersString, ',', commodityTickers);
StringSplit(indexTickersString, ',', indexTickers);