Is it possible to create a Variable frome EA inside?

 

Hello...

i would like to know if it is possible to create a Variable from inside the EA...for Example


input string Nr1_Name="Hello";

input int PeriodChoosen=12;

// above all clear


// below is the question..is there a way to do this??

int MA_Period_"Nr1_Name"=PeriodChoosen;


(the Variable shall have the Name MA_Period_Hello in this Case...)

 
Tim Rittel:

Hello...

i would like to know if it is possible to create a Variable from inside the EA...for Example


input string Nr1_Name="Hello";

input int PeriodChoosen=12;

// above all clear


// below is the question..is there a way to do this??

int MA_Period_"Nr1_Name"=PeriodChoosen;


(the Variable shall have the Name MA_Period_Hello in this Case...)

Variables are only for the benefit of humans writing source code. If you find yourself wanting to dynamically create custom variables then that should be a giant clue that you need to use a collection; something like a list or dictionary. 

 
nicholi shen:

Variables are only for the benefit of humans writing source code. If you find yourself wanting to dynamically create custom variables then that should be a giant clue that you need to use a collection; something like a list or dictionary. 

thank you Nicholi....

Reason: