Hi
I have an Array which contains names of variables. Is there a way to use the Array entries to assign a value instead of having to do...
There is, to my knowledge, no eval() functionality in MQL4/MQL5.
For your specific task, perhaps a hash would work for you.

There is, to my knowledge, no eval() functionality in MQL4/MQL5.
For your specific task, perhaps a hash would work for you.
Hi Anthony,
Thank you for sharing your idea. Apologies,I really should have mentioned that I'm using MQL4 - Your suggestion looks to be MQL5 maybe.
Hi Anthony,
Thank you for sharing your idea. Apologies,I really should have mentioned that I'm using MQL4 - Your suggestion looks to be MQL5 maybe.
It should work in either platform, however, using mutable strings to specify state is a dangerous practice. I can't help but to think there is likely a better, simpler, and safer way to accomplish what you are ultimately trying to achieve.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
I have an Array which contains names of variables. Is there a way to use the Array entries to assign a value instead of having to do...
if (Per_Array[i,0]) = "Ind0_DonchianPeriodsEntry"
Ind0_DonchianPeriodsEntry=GVResult
else
if (Per_Array[i,0]) = "Ind0_DonchianPeriodsExit"
Ind0_DonchianPeriodsExit=GVResult
else
etc
Any help would be appreciated