Using global variables as input parameters

 

I am trying to follow this article

https://www.mql5.com/en/articles/4917


He is setting the optimized parameters as global variables.

But how do I use them in my EA?

I can't set input parameters to global variables because they require a constant.

And if I cancel all the inputs and just make them regular variables, then I won't be able to use the bot in the strategy tester...

 

Not sure what is the problem. You can have any variable as parameter. Whether this variable is set by input variable, set within the EA source, or read from a file. It does not matter.

Also, you can check if the EA runs in optimization mode and if true read the parameters from the input instead of another source.

 
How do I check if EA runs in optimization mode?
 
Found it