diff --git a/src/api/dashboard/static/js/indicators/rsi.js b/src/api/dashboard/static/js/indicators/rsi.js index d3690fb..6dab8c9 100644 --- a/src/api/dashboard/static/js/indicators/rsi.js +++ b/src/api/dashboard/static/js/indicators/rsi.js @@ -3,6 +3,8 @@ import { BaseIndicator } from './base.js'; export class RSIIndicator extends BaseIndicator { calculate(candles) { const period = this.params.period || 14; + const overbought = this.params.overbought || 70; + const oversold = this.params.oversold || 30; // 1. Calculate RSI using RMA (Wilder's Smoothing) let rsiValues = new Array(candles.length).fill(null); @@ -38,29 +40,31 @@ export class RSIIndicator extends BaseIndicator { return { paneBg: 80, // Background lightening trick rsi: rsi, - upperBand: 70, - lowerBand: 30 + overboughtBand: overbought, + oversoldBand: oversold }; }); } getMetadata() { - const plots = [ - // RSI Line - { id: 'rsi', color: '#7E57C2', title: '', width: 1, lastValueVisible: true }, - - // Bands - { id: 'upperBand', color: '#787B86', title: '', style: 'dashed', width: 1, lastValueVisible: false }, - { id: 'lowerBand', color: '#787B86', title: '', style: 'dashed', width: 1, lastValueVisible: false } - ]; - return { name: 'RSI', description: 'Relative Strength Index', inputs: [ - { name: 'period', label: 'RSI Length', type: 'number', default: 14, min: 1, max: 100 } + { name: 'period', label: 'RSI Length', type: 'number', default: 14, min: 1, max: 100 }, + { name: 'overbought', label: 'Overbought Level', type: 'number', default: 70, min: 50, max: 95 }, + { name: 'oversold', label: 'Oversold Level', type: 'number', default: 30, min: 5, max: 50 } + ], + plots: [ + // RSI Line - solid, 1px + { id: 'rsi', color: '#7E57C2', title: '', style: 'solid', width: 1, lastValueVisible: true }, + + // Overbought Band - dashed, 1px + { id: 'overboughtBand', color: '#787B86', title: '', style: 'dashed', width: 1, lastValueVisible: false }, + + // Oversold Band - dashed, 1px + { id: 'oversoldBand', color: '#787B86', title: '', style: 'dashed', width: 1, lastValueVisible: false } ], - plots: plots, displayMode: 'pane', paneMin: 0, paneMax: 100 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 81266c2..0f3bbb5 100644 --- a/src/api/dashboard/static/js/ui/indicators-panel-new.js +++ b/src/api/dashboard/static/js/ui/indicators-panel-new.js @@ -281,6 +281,7 @@ return ` `.trim() + ''; }).join('')} + ${indicator.type !== 'rsi' ? `