Variables and Constants
-
Constants show up in the EA's input screen but can't be changed. On the other hand Variables that can be changed don't show up in the EA's input screen. What am I missing here??? Below a simple bot.

-


-
Ok so what was simple in the past like going from A to B we now need to go over the whole Alphabet. But thanks I am going to work with that. At least you explained it as simples as possible. I did tell you I love you didn't I

-
thanks
... and actually using Constants as inputs is the best way
.... because one constant (or variable if you fill it with constant as example above) you can use it in many blocks ... but when you use check box you get a lot of input parameters (one for each check block) and in tester optimization you get a lot of combinations which can cost you time 
-
It's a long story...
In the beginning Variables were just regular global variables and Constants were "extern" global variables. Then I started thinking "Hey, what if I remove the Constants and put a checkbox to turn any Variable into "extern" parameter?". And obviously I did that. But immediately I found a small problem...
In MQL5 you can define "extern" variable and then modify it in the code. But in MQL5. Try this MQL5 code:
input int inp = 0; void OnInit() { inp = 1; }It can't be compiled, it says "'inp' - constant cannot be modified"
If I use "extern" instead of "input", then there is no compile error, but also the variable is no longer an input parameters, it's like the keyword "extern" does nothing for MQL5.
Only in MQL4 and only if you use the keyword "extern" you can have input parameter that can then be modified into the code. But this behavior is for legacy reasons.So, having input parameters that can be also modified in the code was (and still is) forbidden in MQL5 and even in MQL4 (when you use "input"). That's why after I added those checkboxes for the Variables I almost immediately regretted.
What is the situation today? In the output code of the web version of fxDreema, both Constants and Variables are not global variables. They are members of two separate classes. This means that they all can be modified. But there are some problems again. I found that for people with many many Variables, the code is compiled very slowly. I guess that having classes with too many members is not good idea. So I'm now thinking to make Constants and Variables global variables again.
There are some technical difficulties as you can see and this determines my decisions
