Download MetaTrader 5

Double variables defined with a string name?

To add comments, please log in or register
Ernest Klokow
1111
Ernest Klokow  

I want to create a string name e.g.

string name = A+B 

and then define a double variable with that string name e.g.

double name = x+y

Is that at all possible?

SYED NAUFAL GADDAFI
1399
SYED NAUFAL GADDAFI  
it will say already declared...
Alain Verleyen
Moderator
32810
Alain Verleyen  
ernest02:

I want to create a string name e.g.

and then define a double variable with that string name e.g.

Is that at all possible?

No it's not possible with mql4.
Carl Schreiber
7226
Carl Schreiber  
ernest02:

I want to create a string name e.g.

and then define a double variable with that string name e.g.

Is that at all possible?


A work around:

1) Define a struct with value(s) and variable name(s).

2) Define an array of these structs.

3) If you need a specific var.-name search in the array for the name and get its value(s)

Gooly

SYED NAUFAL GADDAFI
1399
SYED NAUFAL GADDAFI  

@ OP

I was thinking. Why making yourself hard when you can use other var names? Code smart not code hard.



Ernest Klokow
1111
Ernest Klokow  

Thanks for the help and advice guys - especially that of Gooly.

Ernest

Carl Schreiber
7226
Carl Schreiber  
ernest02:

Thanks for the help and advice guys - especially that of Gooly.

Ernest


You are welcome - good luck and lots of pips ;)

Gooly

To add comments, please log in or register