From 9d3612cd9a6652575170f9bf2ed9b702c4e28cf2 Mon Sep 17 00:00:00 2001 From: DiTus Date: Wed, 25 Feb 2026 23:29:24 +0100 Subject: [PATCH] Fix RSI bands visibility and line width 1. Added band creation: - Create horizontal price lines for RSI overbought/oversold bands - Use createPriceLine() on the RSI series after it's created - Create lines at indicator.params.overbought and indicator.params.oversold levels - Store band references to prevent creating duplicate lines 2. Fixed line width priority: - Changed from 'indicator.params._lineWidth || plot.width || lineWidth' - To 'plot.width || indicator.params._lineWidth || lineWidth' - This ensures RSI bands use fixed 1px width from plot.width metadata - User can still adjust line width for other indicators Result: RSI bands now visible as dashed lines at 70/30 levels --- .../static/js/ui/indicators-panel-new.js | 39 ++++++++++++++++++- 1 file changed, 37 insertions(+), 2 deletions(-) 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 0f3bbb5..8388400 100644 --- a/src/api/dashboard/static/js/ui/indicators-panel-new.js +++ b/src/api/dashboard/static/js/ui/indicators-panel-new.js @@ -697,7 +697,7 @@ function renderIndicatorOnPane(indicator, meta, instance, candles, paneIndex, li topFillColor2: '#00000000', bottomFillColor1: '#00000000', bottomColor: plot.bottomColor || '#00000000', - lineWidth: indicator.params._lineWidth || plot.width || lineWidth, + lineWidth: plot.width || indicator.params._lineWidth || lineWidth, lineStyle: plotLineStyle, title: plot.title || '', priceLineVisible: false, @@ -706,7 +706,7 @@ function renderIndicatorOnPane(indicator, meta, instance, candles, paneIndex, li } else { series = window.dashboard.chart.addSeries(LightweightCharts.LineSeries, { color: plotColor, - lineWidth: indicator.params._lineWidth || plot.width || lineWidth, + lineWidth: plot.width || indicator.params._lineWidth || lineWidth, lineStyle: plotLineStyle, title: plot.title || '', priceLineVisible: false, @@ -716,6 +716,41 @@ function renderIndicatorOnPane(indicator, meta, instance, candles, paneIndex, li series.setData(data); indicator.series.push(series); + + // Create horizontal band lines for RSI + if (meta.name === 'RSI' && indicator.series.length > 0) { + const mainSeries = indicator.series[0]; + const overbought = indicator.params.overbought || 70; + const oversold = indicator.params.oversold || 30; + + // Remove existing price lines first + while (indicator.bands && indicator.bands.length > 0) { + try { + indicator.bands.pop(); + } catch(e) {} + } + indicator.bands = indicator.bands || []; + + // Create overbought band line + indicator.bands.push(mainSeries.createPriceLine({ + price: overbought, + color: '#787B86', + lineWidth: 1, + lineStyle: LightweightCharts.LineStyle.Dashed, + axisLabelVisible: false, + title: '' + })); + + // Create oversold band line + indicator.bands.push(mainSeries.createPriceLine({ + price: oversold, + color: '#787B86', + lineWidth: 1, + lineStyle: LightweightCharts.LineStyle.Dashed, + axisLabelVisible: false, + title: '' + })); + } }); }