Change Input Parameters During Runtime

 

Hi all!

Is there any way to change the value of the input parameters from within the code of EA/indicator, so that when the EA/indicator is reloaded, the updated values are used?

 

I had similar requirement on a indicator once. I used global variables in the terminal. 

 

So when your Indicator\expert starts take the value of the input parm and assign it to the global variable. In your OnTick(Expert) or OnCalculate  (Indicator) get the value of the global variable before using the variable....while you code is running go inn the terminal Tools->Global Variables and change your variable

Basic check first need to be done if the global variable exist if not create etc.. this all in onInit.

I needed a Bollingar indicator who's deviation was dynamic...worked 100%.

Goodluck

 
Interesting solution, will try it. Thanks!
 

An EA will still running when its property Window is opened (by pressing f7) please read Will a static variable lose its value when EA restart from disconecting? and EA continues to run after the Autotrading button is pressed to disable it, however same thing does NOT happen in an indicator.

You could also use script that write to a file (or Global Variable as suggested by ToolMaker) and the EA reads from that file. It much more convenience that way.

 

Here'a an article which I only read the title but not the content which may gives some idea ;D

Change Expert Advisor Parameters From the User Panel "On the Fly" 

Reason: