OPEN-SOURCE SCRIPT
Cập nhật

Double Relative Strength Index - DRSI

1 181
🎯 Overview
This is the Double Relative Strength Index (DRSI) indicator for TradingView - an advanced momentum oscillator that applies a unique mathematical transformation to traditional RSI, creating amplified signals with reduced lag while maintaining trend awareness ⚡

🧩 Core Components

⚙️ Indicator Settings

🎛️ Input Parameters
A. 🎨 Color Settings:

6 different color themes: 🎨 Classic, ✨ Neon, 🚀 Modern, 💪 Robust, 🌈 Accented, ⚫⚪ Monochrome

Each theme provides distinct bullish/bearish color pairs

B. 📊 DRSI Configuration:

📏 Length: Default 14 periods

📈 Source: Default close price (customizable)

📈 Long Threshold: Default 57 (asymmetric upper level)

📉 Short Threshold: Default 56 (asymmetric lower level)

🧮 Technical Calculations
A. 📈 Double RSI Formula:

DRSI = 2 × RSI - RSI(RSI)

First: Standard RSI calculation

Second: RSI applied to first RSI values

Mathematical transformation amplifies momentum changes

B. 🔄 State Tracking System:

State persists until opposite threshold is crossed

Reduces whipsaws through state memory

C. 🔔 Signal Detection:

🟢 isBull_D_RSI: (bullish condition)

🔴 isBear_D_RSI: (bearish condition)

🟢 Bull_D_RSI: Crossover signal (DRSI crosses above Long Threshold)

🔴 Bear_D_RSI: Crossunder signal (DRSI crosses below Short Threshold)

👁️ Visual Elements
A. 📉 Main Plots:

📊 DRSI Line: Thick line (width 2) colored conditionally based on position relative to thresholds

🎯 Long Threshold Line: Upper boundary with thematic bullish color

🎯 Short Threshold Line: Lower boundary with thematic bearish color

B. 🎨 Fill Areas:

🟢 Overbought Zone: Filled between DRSI and Long Threshold

🔴 Oversold Zone: Filled between DRSI and Short Threshold

🌈 Dynamic Middle Fill: Adaptive area that shifts based on market state

C. 📊 Enhanced Visualization:

🎨 Colored Candles: Price bars colored based on DRSI signal state

🔺 Signal Markers: Triangle indicators above/below bars for entry signals

📝 Current Value Label: Real-time DRSI value displayed on last bar

D. 📋 Table Display:

Shows "⬆️ Bullish", "⬇️ Bearish", or "🔀 Reversion" with appropriate coloring

🔔 Alert System
🟢 LONG Alert: Triggers when DRSI crosses above Long Threshold

🔴 SHORT Alert: Triggers when DRSI crosses below Short Threshold

Includes ticker symbol in alert message

🏁 Trading Logic
🎯 Primary Signals:
🟢 Bullish Setup:

📈 DRSI crosses above Long Threshold (57)

📊 Bullish state persists while DRSI > Short Threshold

🎨 Visual: Theme bull colors, bullish fills, up triangles

🔴 Bearish Setup:

📉 DRSI crosses below Short Threshold (56)

📊 Bearish state persists while DRSI < Long Threshold

🎨 Visual: Theme bear colors, bearish fills, down triangles

✨ Key Features:
⚡ Amplified Momentum: Double calculation provides faster response than standard RSI

🛡️ State Persistence: Reduces whipsaws by maintaining signal until opposite threshold crossed

🎯 Asymmetric Thresholds: 57/56 levels account for market bias vs traditional 70/30

👁️ Multi-Layer Visualization: Candles, fills, markers, and table provide comprehensive view

🛠️ Customizability: Six color themes adapt to different preferences and trading styles

💻 Code Structure
The script is well-organized with clear sections:

⚙️ Input settings

🧮 DRSI calculations

🔄 State tracking logic

🎨 Color definitions

📊 Multi-layer plotting

📋 Table display

🔔 Alert conditions

🎯 Best Use Cases
📈 Momentum Trading: Detects accelerating/decelerating momentum with reduced lag

🔄 Swing Trading: Asymmetric thresholds work well for swing entry/exit points

⚡ Responsive Signals: Faster than traditional RSI for timely entries

📊 Multi-Timeframe Analysis: Works across various timeframes for confirmation

✅ Signal Filtering: State persistence filters out noise and false breakouts

🏆 Unique Advantages
🎯 Mathematical Innovation: DRSI formula transforms traditional oscillator behavior

🛡️ Reduced Whipsaws: State tracking prevents premature signal reversals

👁️ Comprehensive Display: Four visual layers (candles, fills, markers, table) communicate clearly

⚡ Balanced Responsiveness: Faster than traditional RSI but more stable than raw momentum

💼 Professional Presentation: Clean, modern interface suitable for serious trading analysis
Phát hành các Ghi chú
Resolution of previous problem
Phát hành các Ghi chú
Resolution Previous Problem
Phát hành các Ghi chú
Color Mode – Added 'Heat' option ([#ff0000, #87cefb]).

Dynamic Fill Transparency – Calculates Momentum and Norm_Momentum to set a variable transparency (Fill_Transp) for the overbought/oversold fills, replacing the fixed 0/100 values.

Gradient Candle Colors – Computes a normalized and uses color.from_gradient() to color candles with a smooth transition between down and up colors.

Persistent Trend State – Introduces Trend_ (1 for bull, -1 for bear) that holds the trend direction, used in:

The third fill() (now based on Trend_ instead of a direct.

bgcolor() (now uses Trend_ instead of isBull_/isBear_).

The table and label (display and color based on Trend_).

Label Color – Simplified to use Trend_ colors without transparency.

Thông báo miễn trừ trách nhiệm

Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.