indicator.getSettings#
Optional function that declares user-configurable parameters for the indicator.
SYNTAX#
function getSettings(): SettingDefinition[]RETURNS#
Array of setting definitions. Each entry is one of NumberSetting, ColorSetting, BooleanSetting, or SelectSetting (see the types.* namespace).
REMARKS#
Called once when the indicator is first loaded and again whenever the script source changes. Schema-extraction failures are non-fatal — the host falls back to no settings.
EXAMPLE#
function getSettings() {
return [
{ key: 'lineColor', type: 'color', default: '#00ff88', label: 'Line Color' },
{ key: 'lineWidth', type: 'number', default: 2, min: 1, max: 6, step: 0.5, label: 'Line Width' },
{ key: 'lineStyle', type: 'select', default: 'solid', label: 'Line Style',
options: [{ value: 'solid', label: 'Solid' }, { value: 'dashed', label: 'Dashed' }, { value: 'dotted', label: 'Dotted' }] }
];
}
function onBar(i, ctx) {
var s = ctx.settings;
plot('close', candles[i].close, { color: s.lineColor, width: s.lineWidth, style: s.lineStyle });
}SEE ALSO#
types.NumberSetting, types.ColorSetting, types.BooleanSetting, types.SelectSetting