[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 873
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
When trying to write
extern string array[25];
The compiler gives out
'array' - external arrays are not allowed
you need to do without extern.
But then he won't be an outsider...
will be
but is there any way to refer to a variable whose name is contained in a string variable?
Dear gurus, please advise how to find a solution to this simple problem:
The input to the script is 25 external string variables named XXXXXX_counter, where the counter is a natural number 1,2,3... 25
the script body should process these variables in a loop for ( i=1 ; i<=25 ; i++ ){...}
I can't figure out how to refer to the corresponding variable in the loop body, getting its name using the i counter
an array would be nice, but external arrays are not allowed....
the problem ultimately boils down to referring to a variable whose name is contained in a string variable.
Respectfully, Gravitus
You could do something like this
for (i=0; i<=3; i++)
{
switch(i)
{
case 1 :
XXXXX_1=i;
case 2 :
XXXXX_2=i;
{ case 3 :
XXXXX_3=i;
break;
default: break;
}
}
Instead of IndicatorCounted() write what you need.
The task is to perform calculations at the arrival of a new candle
The check of Bars- IndicatorCounted() (amount of calculated bars) only changes in the indicator, the main calculation is performed.
the task is to calculate when a new candle arrives
Andrei01, reag - thank you.
Just thought there were some magic quotes, but okay, switch is fine :)
Dear gurus, please advise how to find a solution to this simple problem:
The input to the script is 25 external string variables named XXXXXX_counter, where the counter is a natural number 1,2,3... 25
the script body should process these variables in a loop for ( i=1 ; i<=25 ; i++ ){...}
I can't figure out how to refer to the corresponding variable in the loop body, getting its name using the i counter
an array would be nice, but external arrays are not allowed....
the problem ultimately boils down to referring to a variable whose name is contained in a string variable.
Respectfully, Gravitus
for (i=0; i<=3; i++)
{
switch(i)
{
case 1 :
ixxxxx=DoubleToStr(i,0);
XXXXX="XXXXX_"+ixxxx;
XXXXX_1=GlobalVariableGet(XXXXX);
}