setOnApply() preMain Functions
This function adds a button "Apply" to the "Edit Chart" dialog for a specific study. In this case the recalculation of the study with the new parameters will be executed only by clicking on this button.
Can only be called from within the preMain() function or global context.
Typically used in conjunction with Function Parameter Object.
Syntax
setOnApply()
Parameters
Parameter: | Description: | Default: |
Function takes no parameters |
Notes
Only available in versions 12.1 or later.
Code Examples
var bInit = false; var xSeriesMA = null; var fpArray = new Array(); function preMain() { setPriceStudy(true); setStudyTitle("Moving Average"); setOnApply(); var x = 0; fpArray[x] = new FunctionParameter("Length", FunctionParameter.NUMBER); with (fpArray[x++]) { setLowerLimit(1); setDefault(20); } } function main(Length) { if (bInit == false) { setColorPriceBars(true); xSeriesMA = getSeries(sma(Length)); bInit = true; } return xSeriesMA; }
See Also