From 0b6d5a04ee908f7aeb85e705be57b3c1f4bb9411 Mon Sep 17 00:00:00 2001 From: DiTus Date: Wed, 25 Feb 2026 23:07:18 +0100 Subject: [PATCH] Restore missing addIndicator function that was accidentally deleted The addIndicator function definition was missing from the file, causing window.addIndicator to reference itself in a circular reference. Added back the full function definition and removed the problematic circular reference assignment. --- .../static/js/ui/indicators-panel-new.js | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/api/dashboard/static/js/ui/indicators-panel-new.js b/src/api/dashboard/static/js/ui/indicators-panel-new.js index d083b21..06d00ac 100644 --- a/src/api/dashboard/static/js/ui/indicators-panel-new.js +++ b/src/api/dashboard/static/js/ui/indicators-panel-new.js @@ -579,6 +579,40 @@ window.applyPresetFromWindow = function(presetId) { applyPreset(indicator.id, presetId); }; +function addIndicator(type) { + const IndicatorClass = IR?.[type]; + if (!IndicatorClass) return; + + const id = `${type}_${nextInstanceId++}`; + const instance = new IndicatorClass({ type, params: {}, name: '' }); + const metadata = instance.getMetadata(); + + const params = { + _lineType: 'solid', + _lineWidth: 2 + }; + metadata.plots.forEach((plot, idx) => { + params[`_color_${idx}`] = plot.color || getDefaultColor(activeIndicators.length + idx); + }); + metadata.inputs.forEach(input => { + params[input.name] = input.default; + }); + + activeIndicators.push({ + id, + type, + name: metadata.name, + params, + plots: metadata.plots, + series: [], + visible: true + }); + + configuringId = id; + renderIndicatorPanel(); + drawIndicatorsOnChart(); +}; + function saveUserPresets() { localStorage.setItem('indicator_presets', JSON.stringify(userPresets)); } @@ -751,7 +785,6 @@ window.applyIndicatorConfig = function() { }; // Assign functions to window for backward compatibility -window.addIndicator = window.addIndicator || addIndicator; window.removeIndicator = function() { if (!configuringId) return; removeIndicatorById(configuringId);