First , print out the length of the feed string on init .
//add this on init ArrayFree(currencyTickers); int str_len=StringLen(currencyTickersString); Print("Loaded Length = "+IntegerToString(str_len)); if(str_len>0) { //Separate symbols string sep=","; ushort sep_u=StringGetCharacter(sep,0); int splits=StringSplit(currencyTickersString,sep_u,currencyTickers); }
classyguy28:
Then in the OnInit function I convert those strings to arrays to make it easier to loop over them later on:
for(int i=0;i<66;i++){ currencyTickers[i] = StringSubstr(currencyTickersString,i*7,6); Print("-->Currency Pair: ", currencyTickers[i]); } for(int i=0;i<5;i++){ commodityTickers[i] = StringSubstr(commodityTickersString,i*7,6); Print("-->Commodity Pair: ", commodityTickers[i]); } for(int i=0;i<11;i++){ indexTickers[i] = StringSubstr(indexTickersString,i*7,6); Print("--> Indices Pair: ", indexTickers[i]); }
everything will work completely fine for several runs and then all of a sudden
- Simplify your code
StringSplit(currencyTickersString, ',', currencyTickers); StringSplit(commodityTickersString, ',', commodityTickers); StringSplit(indexTickersString, ',', indexTickers);
- Do you really expect an answer when your problem is obviously not in the code you posted.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi all,
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:
Then in the OnInit function I convert those strings to arrays to make it easier to loop over them later on:
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.