OnParamsChange
What is it?
The OnParamsChange
method is called automatically when the user changes any parameter of your indicator — for example, the period, color, MA type, etc.
It allows you to respond to these changes and adjust your indicator's behavior or visuals accordingly.
Syntax
When and Why to Use It
This method is called after the user updates the settings in the indicator panel.
Use it to:
Recalculate internal values
Adjust or re-create custom chart objects
Apply shifts, styling, or any other dynamic behavior
Update dependencies between parameters
Example Use Case
Let’s say your indicator displays a shifted line or a custom label. When the user updates the "Shift" parameter, you want the line or label to move accordingly — that logic would go inside OnParamsChange
.
Important Notes
It only runs when the user changes something manually in the settings window.
If you don’t need any custom logic after parameter changes — you can leave it empty.
In Simple Terms
Think of OnParamsChange
as the method that reacts to user edits in the settings panel.
It gives you a place to respond to those changes and adjust the indicator’s behavior.
Last updated