I have set some parameters in my code, where they can be altered at the edit studies option once the formula has been loaded onto a chart. Unfortunately i can't save these settings, ie, if i was to reload the formula/chart, the settings go back to the default in the formula and the option to save default in edit studies is greyed out, so i can't save the new settings as the default. Is there anywhere/anything i can put in the code to fix this?
Announcement
Collapse
No announcement yet.
Saving Edit Studies Parameters
Collapse
X
-
yes, there is a way to address this, but it's kinda complicated.
First, you have to create global variables for each of your premain() inputs. Then, within your code, you'll have to use these global variables instead of the normal premain() parameters
Second, you have to create a file to store these defaults. This file has to be identified by the system/code ID and possibly the symbol/interval so that it can be reloaded only for this same symbol/interval on other chart (if needed). Naming the file and choosing when to reload the data is something you'll have to address.
Typically, I create this file on the INIT of an efs. The INIT of an efs is typically called once - at the very beginning (or any time you go into edit studies to change a parameter).
Third, you then have to check to see if a stored file exists and reload the data/variables from the file. This would be done in the INIT portion of the code (before you try to re-save the file with the new settings. When you are loading the data, use the "eval()" function to process the settings.
What this does is create a way to handle custom settings for the premain parameters for individual symbols/intervals. It's not perfect because if you want to RESET these custom settings, you have to delete the associated file and reload the code.
It's far too difficult for me to dig up code and post it here, but I've done it before and it can be done.Brad Matheny
eSignal Solution Provider since 2000
Comment
Comment