it's not. Varname1 is a variable name not an integer. And
StringConcatenate("Varname",DoubleToStr(z,0)
is a string containing the letters "V", "a", "r", "n", "a", "m", "e", "1".
Read the book about arrays
int Varname[10]; Varname[1] = 5; Varname[2] = 10; for(z=1; z<5;z++){ var = pips2dbl * Varname[z];
Lot's of thanks!!!!
Sorry, but how can I change that, if Varname[1] etc. must be extern values??
sunshineh:
Sorry, but how can I change that, if Varname[1] etc. must be extern values??
Sorry, but how can I change that, if Varname[1] etc. must be extern values??
You could do this . . .
extern int variable1 = 1; extern int variable2 = 2; extern int variable3 = 3; extern int variable4 = 4; . . . . Varname[1] = variable1; Varname[2] = variable2; Varname[3] = variable3; Varname[4] = variable4;
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,
I have declared a lot of variables like
int Varname1 = 5;
int Varname2 = 10;
int Varname3 = ...
Now I tried to convert my code with a for-loop automatically.
I tried this, but it doesn't work:
If I write only :
the compiler is complaining, that it must be an integer an is only a string. But how can I do that the compiler realizes that f.g. Varname1 IS AN integer?!