Download MetaTrader 5

Code to assign a new value to an external variable without opening the properties window

To add comments, please log in or register
Sneck55
113
Sneck55  

I have defined an external variable as follows:

extern bool Level = false;

During program execution I need to change "Level" from false to true so I open the properties window and change it. No problem.

Then I go away and leave the program running and whilst I am away certain things happen which make "Level=true" incorrect. "Level" must be changed back to it's original "Level=false" setting, except I am not there to open the properties window and change it. How can I change "Level" back to "false" automatically in the code please?

SYED NAUFAL GADDAFI
1399
SYED NAUFAL GADDAFI  
Make a prompt and ask whether need to change to false or not.
whroeder1
15736
whroeder1  
Sneck55: except I am not there to open the properties window and change it.
The EA must return from start and be waiting for a new tick, then you can open properties.
Sneck55
113
Sneck55  
WHRoeder:
Sneck55: except I am not there to open the properties window and change it.
The EA must return from start and be waiting for a new tick, then you can open properties.


deysmacro:
Make a prompt and ask whether need to change to false or not.

ok how do I make a prompt please?
Sneck55
113
Sneck55  
WHRoeder:
Sneck55: except I am not there to open the properties window and change it.
The EA must return from start and be waiting for a new tick, then you can open properties.
how do I open properties in the code please?
Sneck55
113
Sneck55  
I have searched for both properties and prompt on MQL4 reference but neither is included.
Ian Venner
2584
Ian Venner  
Sneck55:

How can I change "Level" back to "false" automatically in the code please?

 

if( //condition when to change Level to false )
{Level=false;
}

This change wont be reflected in the properties tab. The next time you open it, it will still say true, even though the actual value of the var is changed back to false in the code. I dont think there is a way to make that change be reflected in the properties tab except when you do it manually.

That has always been a minor annoyance of mql4. I think if you want inputs that can be modified by both the user and the code while staying updated to their current status, you should create a clickable button or something of that nature.

SYED NAUFAL GADDAFI
1399
SYED NAUFAL GADDAFI  
 I think if you want inputs that can be modified by both the user and the code while staying updated to their current status, 
you should create a clickable button or something of that nature.
Best solution. Nuff said.
Sneck55
113
Sneck55  
Thank you for your help!
To add comments, please log in or register