Download MetaTrader 5
To add comments, please log in or register
Interested in the Market activity? Come and track!
Richard Read
310
Richard Read 2015.07.11 12:35 

Hi!

 

I have a script with a set of inputs, and the #property show_inputs;

 

Now each time I run the script, I can set the inputs as I like, however the next time I run the script the inputs are set back to default.

 

Is there any way to tell the script to "remember" the last input settings and use these for the next run?

 

Thanks!

 

Richard 

honest_knave
969
honest_knave 2015.07.11 12:38  
The only way is to compile the script with those input settings as the default options.
Richard Read
310
Richard Read 2015.07.11 12:49  
Pity! ;/ Ok thanks for the feedback!
JD4
1101
JD4 2015.07.12 18:01  
knave, one thing I was thinking on this idea, but IDK if it is possible.  Would it be possible to put code in the script to both save the settings to an external file, and if the script is run, to check to see if that file exists, and to load the settings if it does?
honest_knave
969
honest_knave 2015.07.12 19:17  
JD4:
knave, one thing I was thinking on this idea, but IDK if it is possible.  Would it be possible to put code in the script to both save the settings to an external file, and if the script is run, to check to see if that file exists, and to load the settings if it does?

Yep, could work. Didn't think of that. Good call.

 

Personally, I'd just code the defaults how I want them. If necessary, have multiple instances of the script with different defaults and hotkeys.

Or have a dropdown list in the inputs which preselects the necessary options. 

JD4
1101
JD4 2015.07.12 19:33  
honest_knave:

Yep, could work. Didn't think of that. Good call.

 

Personally, I'd just code the defaults how I want them. If necessary, have multiple instances of the script with different defaults and hotkeys.

Or have a dropdown list in the inputs which preselects the necessary options. 

That is true as well.  But I think that this could be used if they feel the need to tweak a little for long term, instead of having to go back and recode the script itself.  Could leave the rest of the code alone, and just tweak on the settings, and have them saved automatically.  Your way if you knew the settings you wanted ahead of time.
whroeder1
13644
whroeder1 2015.07.13 01:06  
Please do not feed the troll. When you respond, you give the troll power. When you ignore the troll, he starves for attention and eventually dies.
Richard Read
310
Richard Read 2015.07.13 02:49  

Thanks for the feedback all!

 

I worked around this issue by having another script "Configure Settings" to set Global Variables of the settings the user chooses. I needed to be flexible with the option because the user I give the script to can't necessarily go into the mql4 and change the code. JD$'s solution is also a good idea - will give it a try when I can!

 

Thanks

 

Richard 

JD4
1101
JD4 2015.07.13 05:33  
WHRoeder:
Please do not feed the troll. When you respond, you give the troll power. When you ignore the troll, he starves for attention and eventually dies.

Since I have a strong feeling you are talking about me, allow me to respond in kind.


It has been repeatedly mentioned (by me and others) about how your responses to many people on this site are not as smooth as they could be.  Multiple times suggestions were made to help you help decrease those misunderstandings that have apparently happened because you seem unable to comprehend sometimes that people are not necessarily at the same programming skill level as you, and possibly do not use English as much, and might not understand your explanation fully.  Despite those efforts, you seem to have not been able to grasp the concept.  So, as soon as you get that concept locked down perfectly (and show you have by your posts), then you can feel free to try to correct others in this way.  Until then, remember an important saying, those that live in glass houses shouldn't throw stones.  And before you get an attitude about me correcting you on this, I try to be polite in my posts.  I occasionally am not in response to what I see others doing.  But I have not once told you you were telling someone a program tip wrong.  My issue is with the wording on a doc page.

/
To add comments, please log in or register