How do custom indicators recall input values from last time?

 

If anybody could drop a function or method, it would be great help to me, thanks in advance.

 
Tobias Johannes Zimmer:If anybody could drop a function or method, it would be great help to me, thanks in advance.

Please explain in great detail. You cannot possibly expect us to understand your query with so little information.

 
Tobias Johannes Zimmer:

If anybody could drop a function or method, it would be great help to me, thanks in advance.

Just loop until you get a value that is not equal to whatever value you used in initializing the buffer.

 
Fernando Carreiro #:

Please explain in great detail. You cannot possibly expect us to understand your query with so little information.

Thanks for stopping by. Okay... I expected it to be pretty obvious that when you put a standard indicator to the chart, they always load the inputs that you entered the last time.

In contrary when I make a custom indicator, it is loading the inputs that I compiled it with (or the ones from the input section). Anyways I have to enter the same values again and again.
My question is how can I use the technique the standard indicators use.

It is the same with every CodeBase indicator I can think of. Is an example even required?
 
Thank-god Avwerosuoghene Odukudu #:
Just loop until you get a value that is not equal to whatever value you used in initializing the buffer.

Hello, thanks for chiming in. I have no idea what to loop here, or when. I am guessing that OnInit() starts only after you give the inputs to the program. But then the loading of the compiled inputs is already done, because otherwhise how can the Metatrader show them to you in the input dialog?

So there must be a method to load the inputs from last time and display them in the input window when putting the indicator on the chart.

 
Tobias Johannes Zimmer #:

Thanks for stopping by. Okay... I expected it to be pretty obvious that when you put a standard indicator to the chart, they always load the inputs that you entered the last time.

In contrary when I make a custom indicator, it is loading the inputs that I compiled it with (or the ones from the input section). Anyways I have to enter the same values again and again.
My question is how can I use the technique the standard indicators use.

It is the same with every CodeBase indicator I can think of. Is an example required?

Obviously internal indicators are managed by the terminal and it "remembers" your last input settings by storing those values in the "terminal.ini" file.

Custom indicators however, are handled differently and their default values in their code are used instead and not stored in the "terminal.ini" file

 
Tobias Johannes Zimmer #: Hello, thanks for chiming in. I have no idea what to loop here, or when. I am guessing that OnInit() starts only after you give the inputs to the program. But then the loading of the compiled inputs is already done, because otherwhise how can the Metatrader show them to you in the input dialog? So there must be a method to load the inputs from last time and display them in the input window when putting the indicator on the chart.

The users response to your query is irrelevant in this case. Since your query was not originally clear, the user answer was based on what they "guessed" at what you might of being asking.

That is why, you should always ask questions with plenty of detail, so that you don't get irrelevant answers.

 
Fernando Carreiro #:

Obviously internal indicators are managed by the terminal and it "remembers" your last input settings by storing those values in the "terminal.ini" file.

Custom indicators however, are handled differently and their default values in their code is used and not stored in the "terminal.ini" file

Okay thanks. I get this a similar behavior like the CAppDialog method InitFileLoad(), that Dmitry Gizlik uses in his helper in manual trading?


Edit:

Fernando Carreiro 2022.04.17 19:33   DE

The users response to your query is irrelevant in this case. Since your query was not originally clear, the user answer was based on what they "guessed" at what you might of being asking.

That is why, you should always ask questions with plenty of detail, so that you don't get irrelevant answers.

Me: I appreciate you explaining this. I was not aware that there was much room for misunderstanding.
 
Tobias Johannes Zimmer #: Okay thanks. I get this a similar behavior like the CAppDialog method InitFileLoad(), that Dmitry Gizlik uses in his helper in manual trading?

The behavious is the same for any custom code, be it an Indicator, Script, EA or Service. They all take the default values from the inputs, unless they were coded to retrieve the inputs from another source.

For example, in many of my EAs, I store values in Global Terminal Variables, and use those instead if they exist, and only use the user inputs if those Global Terminal Variables don't exist yet.

 
Fernando Carreiro #:

The behavious is the same for any custom code, be it an Indicator, Script, EA or Service. They all take the default values from the inputs, unless they were coded to retrieve the inputs from another source.

For example, in many of my EAs, I store values in Global Terminal Variables, and use those instead if they exist, and only use the user inputs if those Global Terminal Variables don't exist yet.

Okay,  this is great advice. I haven't worked with global terminal variables yet, seems it is about time now.

Reason: