Indicator · Pine Script v6 · Own pane

Momentum Cascade

by vedkanani123· code credited to LyroRS

A separate-pane momentum indicator by Lyro RS that computes rate of change over an adjustable length and passes it through three EMA stages, described as instant, reactive and committed.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code111
Settings8inputs
LicenceNone statedfile: MPL-2.0
Last update2 months ago23 Aug 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

111 lines of Pine Script v6 from indicator/olg_7_6_26/ALL_2/codex/indicator/Momentum Cascade | Lyro RS_17.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

Momentum Cascade | Lyro RS_17.txt
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © LyroRS

//@version=6
indicator("Momentum Cascade | Lyro RS", overlay=false)

import LyroRS/LMAs/1 as DynamicMAs

// ╔══════════════════════════════════════════════════╗
// ║                INPUT GROUPS                      ║
// ╚══════════════════════════════════════════════════╝
settings_g = '𝗦𝗘𝗧𝗧𝗜𝗡𝗚𝗦'
features_g = '𝗙𝗘𝗔𝗧𝗨𝗥𝗘𝗦'
color_g    = '𝗖𝗢𝗟𝗢𝗥'

// ╔══════════════════════════════════════════════════╗
// ║               CORE SETTINGS                      ║
// ╚══════════════════════════════════════════════════╝
length = input.int(14, "𝗠𝗼𝗺𝗲𝗻𝘁𝘂𝗺 𝗟𝗲𝗻𝗴𝘁𝗵", minval=2, group=settings_g, tooltip="Rate-of-change length feeding the cascade.")
stage  = input.int(14, "𝗦𝘁𝗮𝗴𝗲 𝗦𝗺𝗼𝗼𝘁𝗵𝗶𝗻𝗴", minval=2, group=settings_g, tooltip="EMA length of each cascade stage. The same momentum is passed through three stages — instant, reactive, and committed. A trend requires all three to agree.")

// ╔══════════════════════════════════════════════════╗
// ║                 FEATURES                         ║
// ╚══════════════════════════════════════════════════╝
showSignals = input.bool(true, "𝗦𝗵𝗼𝘄 𝗦𝗶𝗴𝗻𝗮𝗹𝘀", group=features_g)
candleColor = input.bool(true, "𝗖𝗮𝗻𝗱𝗹𝗲 𝗖𝗼𝗹𝗼𝗿𝗶𝗻𝗴", group=features_g)

// ╔══════════════════════════════════════════════════╗
// ║                   COLOR                          ║
// ╚══════════════════════════════════════════════════╝
ColMode = input.string("Mystic", "Custom Color Palette", inline="drop", options=["Classic", "Mystic", "Accented", "Royal"], display=display.none, group=color_g)
cpyn   = input.bool(true, "Use Custom Palette", group=color_g, display=display.none)
cp_UpC = input.color(#00ff00, "Custom Up", inline="Custom Palette", group=color_g, display=display.none)
cp_DnC = input.color(#ff0000, "Custom Down", inline="Custom Palette", group=color_g, display=display.none)

color UpC = na
color DnC = na

switch ColMode
    "Classic" =>
        UpC := #00E676
        DnC := #880E4F
    "Mystic" =>
        UpC := #30FDCF
        DnC := #E117B7
    "Accented" =>
        UpC := #9618F7
        DnC := #FF0078
    "Royal" =>
        UpC := #FFC107
        DnC := #673AB7

if cpyn
    UpC := cp_UpC
    DnC := cp_DnC

// ╔══════════════════════════════════════════════════╗
// ║               CASCADE ENGINE                     ║
// ╚══════════════════════════════════════════════════╝
// One momentum, three reaction speeds. Stage 1 is the raw impulse,
// stage 2 is its first smoothing, stage 3 the second. Early in a
// move only stage 1 has turned; a real trend is when the turn has
// cascaded all the way down to stage 3.
m1 = ta.roc(close, length)
m2 = DynamicMAs.EMA(m1, stage)
m3 = DynamicMAs.EMA(m2, stage)

score = (m1 > 0 ? 1 : -1) + (m2 > 0 ? 1 : -1) + (m3 > 0 ? 1 : -1)

// ╔══════════════════════════════════════════════════╗
// ║                 TREND ENGINE                     ║
// ╚══════════════════════════════════════════════════╝
var int trend = 0
if score == 3
    trend := 1
else if score == -3
    trend := -1

flipUp   = trend == 1  and trend[1] != 1
flipDown = trend == -1 and trend[1] != -1

// ╔══════════════════════════════════════════════════╗
// ║                   VISUALS                        ║
// ╚══════════════════════════════════════════════════╝
trendCol = trend == 1 ? UpC : trend == -1 ? DnC : color.gray

strength = math.abs(score) / 3.0
gradCol  = color.from_gradient(strength, 0, 1, color.new(trendCol, 65), trendCol)

// Cascade stages — thin instant, mid reactive, committed with glow
plot(m1, "Stage 1 [Instant]", color=color.new(trendCol, 70), linewidth=1)
plot(m2, "Stage 2 [Reactive]", color=color.new(trendCol, 45), linewidth=1)
plot(m3, "Stage 3 [Glow]", color=color.new(trendCol, 78), linewidth=8, editable=false)
pMain = plot(m3, "Stage 3 [Committed]", color=gradCol, linewidth=2)
pZero = plot(0, "Zero Anchor", color=na, editable=false)
// fill(pMain, pZero, color=color.new(trendCol, 88 - math.round(15 * strength)), title="Cascade Fill")
fill(pMain, pZero, 0, m3, color.new(chart.bg_color, 45), color.new(trendCol, 35), editable=false)

hline(0, "Zero Line", color=color.gray, linestyle=hline.style_dotted)

plotshape(showSignals and flipUp, "Buy Signal", style=shape.labelup, location=location.belowbar, color=UpC, text="𝓛𝓸𝓷𝓰", textcolor=#000000, size=size.small, force_overlay=true, display=display.pane)
plotshape(showSignals and flipDown, "Sell Signal", style=shape.labeldown, location=location.abovebar, color=DnC, text="𝓢𝓱𝓸𝓻𝓽", textcolor=#000000, size=size.small, force_overlay=true, display=display.pane)

plotcandle(open, high, low, close, "Candle Plot", candleColor ? gradCol : na, candleColor ? gradCol : na, true, bordercolor=candleColor ? gradCol : na, display=display.pane, force_overlay=true)

// ╔══════════════════════════════════════════════════╗
// ║                    ALERTS                        ║
// ╚══════════════════════════════════════════════════╝
alertcondition(flipUp, "Bullish Trend Flip", "Cascade | Lyro RS: Bullish cascade complete on {{ticker}} ({{interval}})")
alertcondition(flipDown, "Bearish Trend Flip", "Cascade | Lyro RS: Bearish cascade complete on {{ticker}} ({{interval}})")
alertcondition(flipUp or flipDown, "Any Trend Flip", "Cascade | Lyro RS: Trend flip on {{ticker}} ({{interval}})")

Overview

A trend is flagged only when all three stages agree. It can show signals and colour candles on the main chart, with several colour palettes or a custom up and down colour. It imports a moving-average library for smoothing. The two settings are momentum length and stage smoothing.

Details

Published by

vedkanani123 on GitHub

Code credit

LyroRS, as written in the script's header

Type

Indicator, Pine Script v6

Draws

Separate pane below the chart

Category

Oscillators & momentum, Trend

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
𝗠𝗼𝗺𝗲𝗻𝘁𝘂𝗺 𝗟𝗲𝗻𝗴𝘁𝗵int14length
𝗦𝘁𝗮𝗴𝗲 𝗦𝗺𝗼𝗼𝘁𝗵𝗶𝗻𝗴int14stage
𝗦𝗵𝗼𝘄 𝗦𝗶𝗴𝗻𝗮𝗹𝘀booltrueshowSignals
𝗖𝗮𝗻𝗱𝗹𝗲 𝗖𝗼𝗹𝗼𝗿𝗶𝗻𝗴booltruecandleColor
Custom Color PalettestringMysticColMode
Use Custom Palettebooltruecpyn
Custom Upcolor#00ff00cp_UpC
Custom Downcolor#ff0000cp_DnC
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

Schaff Trend Cycle

by everget
948 stars

This indicator plots the Schaff Trend Cycle in a separate pane. It subtracts a slow exponential moving average from a fast one, applies a stochastic cycle twice, and smooths each result to form a 0–100 oscillator. Line color follows the slope, or the upper and

Indicator v4 Oscillators & momentumTrend
Updated 11 days ago · GPL-3.0 GitHub repository of Schaff Trend Cycle

Beep Boop

by magic8bot
409 stars

This indicator calculates a modified MACD oscillator and signal line alongside a trend EMA filter, plotting the output as a stylized column histogram in a separate pane. Instead of plotting true MACD distance, it quantifies positive and negative histogram mome

Indicator v4 Oscillators & momentumTrend
Updated 3 years ago · MIT GitHub repository of Beep Boop

[RS]Standardized Trend Map

by ricardosantos79
261 stars

Standardized Trend Map calculates series momentum relative to active price range across 40 distinct lookback periods ranging from 2 to 80 bars on an exponential moving average source. Each standardized calculation rounds to an integer values of -1, 0, or 1 to

Indicator v4 TrendOscillators & momentum
Updated 4 years ago · None stated GitHub repository of [RS]Standardized Trend Map

ADX Histogram

by harryguiacorn
219 stars

This indicator calculates and displays the Average Directional Index (ADX) as a column histogram in a separate pane. It evaluates market trend strength by calculating directional movement metrics based on specified smoothing and DI length inputs. When the ADX

Indicator v5 TrendOscillators & momentum
Updated 1 year ago · None stated GitHub repository of ADX Histogram
218 stars

Multi-Timeframe Analysis Suite calculates trend direction and momentum conditions across five user-selected timeframes using moving averages, RSI, and Stochastic oscillators. It evaluates moving average slope and oscillator levels to compute trend alignment, m

Indicator v6 Screeners & dashboardsTrend
Updated 3 months ago · None stated GitHub repository of Multi-Timeframe Analysis Suite

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers