How to update the external input entries with a new values ? please :)

 

Hello,

I didn't find any information about that. I did try to change it with getpointer() , but it is not possible with simple variable as the mql4 book explained.

So if anybody could help me about how to update the input field with my new value.

from ->>  external int  value=2:


in my program I will get a new value=15

If I open the input window from my own indicator I will always see value=2

never 15

I did try to use ->>  ChartSetSymbolPeriod() to reloaded the indicator but I get always value=2


Help could be very usefull for me about that problem

Thanks a lot..

Laurent

 
These are static values that will display only the start value that you assign to them upon creating the variable, they can not be changed after creation.
 
Marco vd Heijden: These are static values that will display only the start value that you assign to them upon creating the variable, they can not be changed after creation.

Not entirely correct!

"extern" variables can be changed by the code during the execution. This will however not change the default value set in the properties dialog box, only its locally running value. They are initialised to default values when you access the properties window and change the values in the dialog box.

"input" variables, however cannot be changed by the code and any such attempt will be detected by the compiler and give an error.

 

boobyditbeber: I didn't find any information about that. I did try to change it with getpointer() , but it is not possible with simple variable as the mql4 book explained

So if anybody could help me about how to update the input field with my new value.

from ->>  external int  value=2:

in my program I will get a new value=15

If I open the input window from my own indicator I will always see value=2

never 15

I did try to use ->>  ChartSetSymbolPeriod() to reloaded the indicator but I get always value=2

Help could be very usefull for me about that problem

Check your code to see if you are not inadvertently assigning a new value to that "extern" variable, thus overriding the original initialised value.
 
Fernando Carreiro:

Not entirely correct!

"extern" variables can be changed by the code during the execution. This will however not change the default value set in the properties dialog box, only its locally running value. They are initialised to default values when you access the properties window and change the values in the dialog box.

"input" variables, however cannot be changed by the code and any such attempt will be detected by the compiler and give an error.

Ok so show me a piece of code that changes the extern variable value in the input parameters.

 
Marco vd Heijden: Ok so show me a piece of code that changes the extern input variable value in the input parameters.

As I stated! It does not change the Input parameters in the dialog box, only the locally running value during the code execution.

Forum on trading, automated trading systems and testing trading strategies

How to update the external input entries with a new values ? please :)

Fernando Carreiro, 2018.09.30 08:52

Not entirely correct!

"extern" variables can be changed by the code during the execution. This will however not change the default value set in the properties dialog box, only its locally running value. They are initialised to default values when you access the properties window and change the values in the dialog box.

"input" variables, however cannot be changed by the code and any such attempt will be detected by the compiler and give an error.

extern int myVariable = 2;

void OnTick()
{
        myVariable += 1;
        Comment( "myVariable: ", myVariable );
}
 
Please don't twist the OP's questions in order to meet your criteria or answer, the question was clear he wants to change 
boobyditbeber:

Hello,

 how to update the input field with my new value.

 
Marco vd Heijden: Please don't twist the OP's questions in order to meet your criteria or answer, the question was clear he wants to change 

I did not! The OP is complaining that he sets the dialog box value to 2, but when he runs the program he gets 15 (see below).

He believes the solution is to alter the dialog box externally via some function in order to fix what he believes to be the problem.

However, he does not realise that maybe he is changing the value of the variable within the code inadvertently and thus causing the problem. That is what I am talking about!

Forum on trading, automated trading systems and testing trading strategies

How to update the external input entries with a new values ? please :)

boobyditbeber, 2018.09.29 20:51

Hello,

I didn't find any information about that. I did try to change it with getpointer() , but it is not possible with simple variable as the mql4 book explained.

So if anybody could help me about how to update the input field with my new value.

from ->>  external int  value=2:

in my program I will get a new value=15

If I open the input window from my own indicator I will always see value=2

never 15

I did try to use ->>  ChartSetSymbolPeriod() to reloaded the indicator but I get always value=2

Help could be very usefull for me about that problem

Thanks a lot..

Laurent

 

It doesn't change anything about the answer does it.

It can't be done.

Of course it can be done if we drill into the operating system and create an overlay that displays the correct value.

Or find the spot in memory where the 2 is located and change it into a 15 EXTERNally but that's just not practical.

 
Marco vd Heijden: It doesn't change anything about the answer does it. It can't be done.
OK! What ever! Be yourself as always!
 
boobyditbeber:

It is not clear what you are asking.

Do you mean that you are modifying the input parameter value in the code?

If you are the value will not be updated in the parameters unless you add or remove an input.

When you open the input window click on Reset to update the default settings