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

To add comments, please log in or register
boobyditbeber
40
boobyditbeber  

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

Marco vd Heijden
Moderator
8178
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.
Fernando Carreiro
4420
Fernando Carreiro  
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.

Fernando Carreiro
4420
Fernando Carreiro  

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.
Marco vd Heijden
Moderator
8178
Marco vd Heijden  
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.

Fernando Carreiro
4420
Fernando Carreiro  
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 );
}
Marco vd Heijden
Moderator
8178
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 
boobyditbeber:

Hello,

 how to update the input field with my new value.

Fernando Carreiro
4420
Fernando Carreiro  
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

Marco vd Heijden
Moderator
8178
Marco vd Heijden  

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.

Fernando Carreiro
4420
Fernando Carreiro  
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!
Keith Watford
Moderator
14020
Keith Watford  
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

12
To add comments, please log in or register