Smoothed RSX Indicator For ThinkOrSwim

cando13579

Active member
VIP
Smoothed RSX Indicator
Advanced Momentum Oscillator with Adaptive Smoothing

Platform: Thinkorswim (ThinkScript)
Panel: Lower Study


Overview
The Smoothed RSX Indicator is an advanced momentum oscillator designed to measure trend strength, momentum direction, and exhaustion with significantly reduced noise compared to standard RSI-based tools.

It combines:
  • RSX (Relative Strength eXtended) – a refined RSI variant with superior smoothness and responsiveness
  • Adaptive Correlation-Based Smoothing – a dynamic filter that adjusts smoothing strength based on volatility and directional stability
The result is a clean, stable oscillator that reacts quickly to real momentum shifts while filtering out market noise.


Key Objectives
  • Reduce false momentum signals common in standard RSI
  • Improve trend clarity without lag-heavy moving averages
  • Provide visual confirmation of momentum acceleration and deceleration
  • Support scalping, intraday, and swing trading
mHRGZMN.png


Indicator Components
1. Price Source Selection

The indicator allows full control over the input price used in calculations:

Available Price Types:
  • Close
  • Open
  • High
  • Low
  • HL2 (High + Low) / 2
  • HLC3 (High + Low + Close) / 3
  • OHLC4 (Open + High + Low + Close) / 4
This flexibility allows traders to adapt the indicator to:
  • Volatility-focused strategies (HL2 / HLC3)
  • Mean-based calculations (OHLC4)
  • Traditional momentum setups (Close)

2. RSX Calculation (Core Momentum Engine)
The RSX logic improves on traditional RSI by using:
  • Recursive exponential smoothing
  • Dual-stage filtering of momentum and absolute momentum
  • Normalization to a bounded 0–100 scale
Key Characteristics:
  • Faster response than RSI
  • Less whipsaw in consolidation
  • Stable behavior across timeframes
Mathematical Highlights:
  • Momentum and absolute momentum are smoothed independently
  • A weighted blend of first- and second-stage filters improves responsiveness
  • Final RSX value is normalized and clamped between 0 and 100

3. Adaptive Smoothing Engine
The Smoothed RSX applies a correlation-based adaptive moving average to the raw RSX output.

How It Works:
  • Measures volatility (standard deviation) of RSX
  • Compares it to directional variance
  • Dynamically adjusts smoothing strength:
    • More smoothing during noisy conditions
    • Less smoothing during strong directional moves
This avoids the common trade-off between:

Responsiveness vs Smoothness

Visual Design & Color Logic
Plots

LineDescription
RSXLineRaw RSX (dashed, thinner)
SmoothedRSXLineAdaptive smoothed RSX (solid, thicker)
Dynamic Color Coding
Colors are driven by slope direction of the Smoothed RSX:
  • Upward Momentum
    • RSX: Lime
    • Smoothed RSX: Cyan
  • Downward Momentum
    • RSX: Pink
    • Smoothed RSX: Orange
  • Neutral / Flat
    • Dark Gray
This provides instant visual confirmation of momentum direction without relying on crossovers alone.


Reference Levels
LevelPurpose
80Overbought threshold
20Oversold threshold
50Momentum equilibrium
All levels are plotted with dashed gray lines to maintain clarity without visual clutter.


How to Trade the Smoothed RSX
1. Trend Confirmation

  • Smoothed RSX above 50 and rising → bullish momentum
  • Smoothed RSX below 50 and falling → bearish momentum
2. Momentum Shifts
  • Color change + slope reversal = early momentum transition
  • Often precedes price breakouts or breakdowns
3. Overbought / Oversold Context
  • Sustained strength above 80 = strong trend (not immediate reversal)
  • Sharp rejection from 80 or 20 = exhaustion signal
4. Divergence Detection
  • Price makes higher highs while RSX fails → bearish divergence
  • Price makes lower lows while RSX rises → bullish divergence
Smoothed RSX makes divergences cleaner and more reliable than standard RSI.


Code:
# Smoothed_RSX
# Description: RSX with additional smoothing

declare lower;

input inpRsiPeriod = 14;        # RSX period
input inpPriceType = {default CLOSE, OPEN, HIGH, LOW, HL2, HLC3, OHLC4};

def price;
if inpPriceType == inpPriceType.OPEN {
    price = open;
} else if inpPriceType == inpPriceType.HIGH {
    price = high;
} else if inpPriceType == inpPriceType.LOW {
    price = low;
} else if inpPriceType == inpPriceType.CLOSE {
    price = close;
} else if inpPriceType == inpPriceType.HL2 {
    price = (high + low) / 2;
} else if inpPriceType == inpPriceType.HLC3 {
    price = (high + low + close) / 3;
} else {
    price = (open + high + low + close) / 4;
}

# RSX Calculation
script RSX {
    input p = close;
    input period = 14;
 
    def Kg = 3.0 / (2.0 + period);
    def Hg = 1.0 - Kg;
 
    def mom = p - p[1];
    def moa = AbsValue(mom);
 
    # First stage
    def f1;
    if IsNaN(p[1]) {
        f1 = 0;
    } else {
        f1 = Kg * mom + Hg * (if IsNaN(f1[1]) then 0 else f1[1]);
    }
 
    def f2;
    if IsNaN(f1) {
        f2 = 0;
    } else {
        f2 = Kg * f1 + Hg * (if IsNaN(f2[1]) then 0 else f2[1]);
    }
 
    def momOut = 1.5 * f1 - 0.5 * f2;
 
    # Absolute stage
    def a1;
    if IsNaN(p[1]) {
        a1 = 0;
    } else {
        a1 = Kg * moa + Hg * (if IsNaN(a1[1]) then 0 else a1[1]);
    }
 
    def a2;
    if IsNaN(a1) {
        a2 = 0;
    } else {
        a2 = Kg * a1 + Hg * (if IsNaN(a2[1]) then 0 else a2[1]);
    }
 
    def moaOut = 1.5 * a1 - 0.5 * a2;
 
    def rsiValue;
    if moaOut == 0 {
        rsiValue = 50;
    } else {
        rsiValue = (momOut / moaOut + 1) * 50;
    }
 
    def rsx;
    if period > BarNumber() {
        rsx = Double.NaN;
    } else {
        rsx = Min(Max(rsiValue, 0), 100);
    }
 
    plot result = rsx;
}

# Moving Average calculation
script SmoothingMA {
    input avg = close;
    input price = close;
    input period = 14;
 
    def priceVal = price;
    def avgVal = avg;
 
    # correlation calculation
    def deviation = StDev(priceVal, period);
    def v1 = Power(deviation, 2);
 
    def v2;
    if !IsNaN(avgVal[1]) and !IsNaN(avgVal) {
        v2 = Power(avgVal[1] - avgVal, 2);
    } else {
        v2 = 0;
    }
 
    def c;
    if v2 < v1 or v2 == 0 {
        c = 0;
    } else {
        c = 1 - v1 / v2;
    }
 
    def corrVal;
    if IsNaN(avgVal[1]) {
        corrVal = avgVal;
    } else {
        corrVal = avgVal[1] + c * (avgVal - avgVal[1]);
    }
 
    plot result = corrVal;
}

# Calculate RSX
def rsxValue = RSX(price, inpRsiPeriod);

# Calculate Smoothed RSX
def smoothedRSX = SmoothingMA(rsxValue, rsxValue, inpRsiPeriod);

# Color coding based on direction change
def rsxColor;
if smoothedRSX > smoothedRSX[1] {
    rsxColor = 1;
} else if smoothedRSX < smoothedRSX[1] {
    rsxColor = 2;
} else {
    rsxColor = rsxColor[1];
}

# Plot the indicator
plot RSXLine = rsxValue;
plot SmoothedRSXLine = smoothedRSX;

# color schemes
RSXLine.SetPaintingStrategy(PaintingStrategy.LINE);
RSXLine.AssignValueColor(if rsxColor == 1 then Color.LIME
                          else if rsxColor == 2 then Color.PINK
                          else Color.DARK_GRAY);
RSXLine.SetLineWeight(1);
RSXLine.SetStyle(Curve.SHORT_DASH);  # Make RSX dashed

SmoothedRSXLine.SetPaintingStrategy(PaintingStrategy.LINE);
SmoothedRSXLine.AssignValueColor(if rsxColor == 1 then Color.CYAN
                                   else if rsxColor == 2 then Color.ORANGE
                                   else Color.DARK_GRAY);
SmoothedRSXLine.SetLineWeight(2);   # Keep smoothed RSX thicker

# Add horizontal lines
plot Overbought = 80;
plot Oversold = 20;
plot MidLine = 50;

Overbought.SetDefaultColor(Color.GRAY);
Overbought.SetStyle(Curve.SHORT_DASH);
Oversold.SetDefaultColor(Color.GRAY);
Oversold.SetStyle(Curve.SHORT_DASH);
MidLine.SetDefaultColor(Color.GRAY);
MidLine.SetStyle(Curve.SHORT_DASH);

Strengths
Reduced noise without heavy lag
Adaptive to changing market conditions
Clear visual momentum cues
Works across all timeframes
Excellent for trend continuation setups


Limitations
Not a standalone entry system
Performs best when combined with:

  • Market structure
  • VWAP
  • Volume or volatility tools

Best Use Cases
  • Trend continuation confirmation
  • Pullback entries
  • Momentum exhaustion analysis
  • Divergence-based trade planning
  • Scalping with reduced oscillator noise

Conclusion
The Smoothed RSX Indicator is a professional-grade momentum tool designed for traders who want clarity without lag. By combining RSX’s advanced momentum logic with adaptive smoothing, it delivers actionable, visually intuitive signals that outperform traditional RSI-based oscillators in real trading conditions.
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
795 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top