Skip to main content

Oscillators & Momentum Indicators

RSI with chart signals, stochastic, MACD, Bollinger Band volatility and breakouts, relative volume (RVOL), and building custom oscillators.

From Thrive on YouTube

Watch the matching Thrive video

Watch the series
Trading Indicators, Honestly: What They Can and Cannot Do

Trading Indicators, Honestly: What They Can and Cannot Do

Part of Trading Journal and Performance Review. Education only. Not financial advice.

Enhanced RSI Indicator

The standard RSI is a single line oscillating between 0 and 100. An enhanced RSI adds moving average smoothing, dynamic overbought/oversold levels, and momentum classification. On volatile assets like SOL, the standard 70/30 levels trigger too frequently: adaptive levels based on recent RSI range produce higher-quality signals. This version also includes a momentum state label so you can see at a glance whether momentum is accelerating, decelerating, or neutral.

pine-Enhanced RSI with adaptive levels
1//@version=5
2indicator("Enhanced RSI", overlay=false)
3
4rsiLen = input.int(14, "RSI Length")
5smoothLen = input.int(5, "Signal Smoothing")
6adaptLen = input.int(100, "Adaptive Level Lookback")
7
8rsi = ta.rsi(close, rsiLen)
9rsiSignal = ta.ema(rsi, smoothLen)
10
11// Adaptive overbought/oversold based on recent RSI distribution
12rsiHigh = ta.percentile_linear_interpolation(rsi, adaptLen, 85)
13rsiLow = ta.percentile_linear_interpolation(rsi, adaptLen, 15)
14
15// Momentum state
16accel = rsi - rsiSignal
17state = accel > 2 ? "Accelerating" :
18 accel < -2 ? "Decelerating" : "Neutral"
19
20// Gradient color
21rsiColor = color.from_gradient(rsi, rsiLow, rsiHigh,
22 color.green, color.red)
23
24plot(rsi, "RSI", rsiColor, 2)
25plot(rsiSignal, "Signal", color.new(color.white, 50), 1)
26plot(rsiHigh, "Dynamic OB", color.new(color.red, 60), 1,
27 plot.style_line)
28plot(rsiLow, "Dynamic OS", color.new(color.green, 60), 1,
29 plot.style_line)
30hline(50, "Mid", color.new(color.gray, 80))
31
32bgcolor(rsi > rsiHigh ? color.new(color.red, 90) :
33 rsi < rsiLow ? color.new(color.green, 90) : na)

RSI Chart Signals: Plotting on Price

One limitation of oscillators is that they live in a separate pane. RSI chart signals solve this by translating oscillator readings into plotshape markers directly on the price chart. When RSI crosses above oversold, a buy marker appears below the candle. When RSI crosses below overbought, a sell marker appears above. This lets you see oscillator signals without ever looking away from the price chart: critical for fast-moving assets like ETH during high-volatility events.

pine-RSI signals plotted on price chart
1//@version=5
2indicator("RSI Chart Signals", overlay=true)
3
4rsiLen = input.int(14, "RSI Length")
5obLevel = input.int(70, "Overbought")
6osLevel = input.int(30, "Oversold")
7
8rsi = ta.rsi(close, rsiLen)
9
10// Signal conditions
11bullSignal = ta.crossover(rsi, osLevel)
12bearSignal = ta.crossunder(rsi, obLevel)
13strongBull = bullSignal and volume > ta.sma(volume, 20) * 1.5
14strongBear = bearSignal and volume > ta.sma(volume, 20) * 1.5
15
16plotshape(bullSignal and not strongBull, "Oversold Exit",
17 shape.triangleup, location.belowbar,
18 color.new(color.green, 30), size=size.tiny)
19plotshape(strongBull, "Strong Oversold Exit",
20 shape.triangleup, location.belowbar,
21 color.green, size=size.small, text="RSI")
22plotshape(bearSignal and not strongBear, "Overbought Exit",
23 shape.triangledown, location.abovebar,
24 color.new(color.red, 30), size=size.tiny)
25plotshape(strongBear, "Strong Overbought Exit",
26 shape.triangledown, location.abovebar,
27 color.red, size=size.small, text="RSI")
28
29// Background flash on extreme readings
30bgcolor(rsi > 80 ? color.new(color.red, 92) :
31 rsi < 20 ? color.new(color.green, 92) : na)

Volume confirmation

The "strong" variants of these signals require volume to be 1.5x the 20-period average. On BTC and ETH, high-volume RSI reversals from extreme levels are significantly more reliable than low-volume ones. Volume confirms that real capital is driving the reversal, not just a thin-book wick.

Stochastic Oscillator with Smoothing Options

The stochastic oscillator measures where the close sits within the recent high-low range. A reading of 80 means the close is near the top of the last N bars' range. Unlike RSI, the stochastic is bounded by recent price extremes, making it more responsive to range-bound conditions. This version supports multiple smoothing methods and includes cross detection between the %K and %D lines.

pine-Stochastic with smoothing options
1//@version=5
2indicator("Stochastic Pro", overlay=false)
3
4kLen = input.int(14, "%K Length")
5kSmooth = input.int(3, "%K Smoothing")
6dSmooth = input.int(3, "%D Smoothing")
7smooth = input.string("SMA", "Smoothing",
8 options=["SMA", "EMA"])
9
10rawK = ta.stoch(close, high, low, kLen)
11k = smooth == "EMA" ? ta.ema(rawK, kSmooth) : ta.sma(rawK, kSmooth)
12d = smooth == "EMA" ? ta.ema(k, dSmooth) : ta.sma(k, dSmooth)
13
14bullCross = ta.crossover(k, d) and k < 25
15bearCross = ta.crossunder(k, d) and k > 75
16
17kColor = color.from_gradient(k, 20, 80, color.green, color.red)
18plot(k, "%K", kColor, 2)
19plot(d, "%D", color.new(color.white, 40), 1, plot.style_line)
20h80 = hline(80, "OB", color.new(color.red, 60), hline.style_dashed)
21h20 = hline(20, "OS", color.new(color.green, 60), hline.style_dashed)
22fill(h80, h20, color.new(color.gray, 94))
23
24plotshape(bullCross, "Bull Cross", shape.circle,
25 location.bottom, color.green, size=size.tiny)
26plotshape(bearCross, "Bear Cross", shape.circle,
27 location.top, color.red, size=size.tiny)

MACD with Histogram Coloring and Signal Detection

The MACD (Moving Average Convergence Divergence) consists of the MACD line (fast EMA minus slow EMA), the signal line (EMA of the MACD line), and the histogram (difference between them). A professional MACD indicator uses four-color histogram coloring: rising positive (strong bull), falling positive (weakening bull), falling negative (strong bear), and rising negative (weakening bear). This four-state system gives you early warnings of momentum shifts on BTC and ETH before the crossover actually occurs.

pine-Four-color MACD with signal detection
1//@version=5
2indicator("MACD Pro", overlay=false)
3
4fastLen = input.int(12, "Fast Length")
5slowLen = input.int(26, "Slow Length")
6sigLen = input.int(9, "Signal Length")
7
8[macdLine, signalLine, hist] = ta.macd(close, fastLen, slowLen, sigLen)
9
10// Four-state histogram coloring
11histColor = hist >= 0 ?
12 (hist > hist[1] ? color.new(color.green, 0) :
13 color.new(color.green, 60)) :
14 (hist < hist[1] ? color.new(color.red, 0) :
15 color.new(color.red, 60))
16
17plot(hist, "Histogram", histColor, 2, plot.style_histogram)
18plot(macdLine, "MACD", color.new(#5ce1e6, 0), 2)
19plot(signalLine, "Signal", color.new(#ff4895, 0), 1)
20hline(0, "Zero", color.new(color.gray, 80))
21
22// Signal detection
23bullCross = ta.crossover(macdLine, signalLine)
24bearCross = ta.crossunder(macdLine, signalLine)
25zeroUp = ta.crossover(macdLine, 0)
26zeroDown = ta.crossunder(macdLine, 0)
27
28plotshape(bullCross, "Bull Cross", shape.triangleup,
29 location.bottom, color.green, size=size.tiny)
30plotshape(bearCross, "Bear Cross", shape.triangledown,
31 location.top, color.red, size=size.tiny)
32bgcolor(zeroUp ? color.new(color.green, 90) :
33 zeroDown ? color.new(color.red, 90) : na)
Rising positive histogram

Bullish momentum is accelerating: trend is strong. Best time for long entries.

Falling positive histogram

Histogram still above zero but shrinking: momentum is weakening. Consider tightening stops.

Falling negative histogram

Bearish momentum is accelerating: strongest selling phase. Avoid long entries.

Rising negative histogram

Histogram still below zero but bars getting smaller: selling pressure easing. Watch for reversal.

Zero-line cross up

MACD crosses above zero: fast EMA overtakes slow EMA. Medium-term trend shift confirmed bullish.

Zero-line cross down

MACD crosses below zero: trend confirmed bearish. Strongest macro sell signal from MACD.

Bollinger Band Volatility and Breakout Detection

Bollinger Bands measure volatility using standard deviations around a moving average. Beyond the standard band overlay, two derived metrics are especially powerful: Bandwidth (the width of the bands as a percentage of the middle band) and %B (where price sits within the bands, 0 = lower band, 1 = upper band). Bandwidth squeezes on BTC often precede explosive moves, when bandwidth hits its lowest level in 120 bars, a major breakout is imminent.

pine-Bollinger Band volatility suite
1//@version=5
2indicator("BB Volatility", overlay=false)
3
4length = input.int(20, "BB Length")
5mult = input.float(2.0, "Std Dev", step=0.1)
6sqLen = input.int(120, "Squeeze Lookback")
7
8[mid, upper, lower] = ta.bb(close, length, mult)
9
10bandwidth = (upper - lower) / mid * 100
11pctB = (close - lower) / (upper - lower) * 100
12
13// Squeeze detection
14bwLow = ta.lowest(bandwidth, sqLen)
15isSqueeze = bandwidth <= bwLow * 1.05
16
17// Breakout detection
18breakUp = ta.crossover(close, upper)
19breakDown = ta.crossunder(close, lower)
20
21bwColor = isSqueeze ? color.new(color.yellow, 0) :
22 color.new(color.gray, 30)
23plot(bandwidth, "Bandwidth", bwColor, 2)
24plot(bwLow, "Squeeze Level", color.new(color.yellow, 60), 1,
25 plot.style_line)
26
27bgcolor(isSqueeze ? color.new(color.yellow, 92) : na)
28bgcolor(breakUp ? color.new(color.green, 88) :
29 breakDown ? color.new(color.red, 88) : na)

Relative Volume (RVOL) Indicator

Relative volume compares the current bar's volume to its historical average. An RVOL of 2.0 means volume is twice the normal level. This is one of the most underutilized indicators in crypto: price moves on high RVOL are significantly more likely to follow through than moves on low RVOL. On SOL and ETH, breakouts with RVOL above 2.0 have a substantially higher success rate than those below 1.0.

pine-Relative volume with threshold alerts
1//@version=5
2indicator("Relative Volume", overlay=false)
3
4avgLen = input.int(20, "Average Length")
5highThresh = input.float(2.0, "High RVOL Threshold")
6
7avgVol = ta.sma(volume, avgLen)
8rvol = volume / avgVol
9
10rvolColor = rvol >= highThresh ? color.new(color.yellow, 0) :
11 rvol >= 1.0 ? color.new(color.green, 20) :
12 color.new(color.red, 40)
13
14plot(rvol, "RVOL", rvolColor, 2, plot.style_histogram)
15hline(highThresh, "High", color.new(color.yellow, 60),
16 hline.style_dashed)
17hline(1.0, "Average", color.new(color.gray, 60))
18
19alertcondition(rvol >= highThresh and close > open,
20 "High RVOL Bullish", "RVOL spike on bullish bar")

Multi-Oscillator Momentum Dashboard

Individual oscillators can give conflicting signals. A multi-oscillator dashboard scores momentum across RSI, Stochastic, MACD, and RVOL, producing a single composite score from -4 (maximum bearish) to +4 (maximum bullish). This forces you to wait for oscillator agreement before acting, dramatically reducing false signals on choppy BTC ranges.

pine-Multi-oscillator momentum scorer
1//@version=5
2indicator("Momentum Dashboard", overlay=false)
3
4rsi = ta.rsi(close, 14)
5[k, d] = ta.stoch(close, high, low, 14)
6[macdLine, sigLine, hist] = ta.macd(close, 12, 26, 9)
7rvol = volume / ta.sma(volume, 20)
8
9// Score each oscillator: +1 bullish, -1 bearish
10rsiScore = rsi > 55 ? 1 : rsi < 45 ? -1 : 0
11stochScore = k > 60 ? 1 : k < 40 ? -1 : 0
12macdScore = hist > 0 and hist > hist[1] ? 1 :
13 hist < 0 and hist < hist[1] ? -1 : 0
14volScore = rvol > 1.2 and close > open ? 1 :
15 rvol > 1.2 and close < open ? -1 : 0
16
17total = rsiScore + stochScore + macdScore + volScore
18
19// Gradient color for the score
20scoreColor = color.from_gradient(total, -4, 4, color.red, color.green)
21
22plot(total, "Score", scoreColor, 3, plot.style_histogram)
23hline(0, "Neutral", color.new(color.gray, 60))
24hline(3, "Strong Bull", color.new(color.green, 70), hline.style_dashed)
25hline(-3, "Strong Bear", color.new(color.red, 70), hline.style_dashed)
26
27bgcolor(total >= 3 ? color.new(color.green, 90) :
28 total <= -3 ? color.new(color.red, 90) : na)

Trading with oscillator confluence

A score of +3 or +4 means RSI, Stochastic, MACD, and volume all agree: momentum is strongly bullish. On ETH and BTC, entering longs when the score is +3 or higher and the higher-timeframe trend is up produces the highest-probability entries. Never trade against a score of -3 or lower.
Score +4All four oscillators bullish. Maximum conviction long. Occurs rarely: acts as a high-confidence signal.
Score +2 to +3Majority agreement bullish. Good for entries with trend confirmation from higher timeframes.
Score -1 to +1Mixed signals. No clear momentum bias. Stay flat or reduce position size until alignment improves.
Score -2 to -3Majority agreement bearish. Look for short entries or exit remaining longs.
Score -4All oscillators bearish. Maximum conviction short. Strong signal to avoid any long exposure.

Put this lesson to work

Free on Thrive, no account needed.