Indicator · Pine Script v6 · Own pane

Volatility Momentum Suite

by vedkanani123· code credited to LyroRS

A separate-pane momentum tool built on a smoothed rate of change with a signal line and standard deviation bands.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code355
Settings20inputs
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

355 lines of Pine Script v6 from indicator/olg_7_6_26/LyroRS/9.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

9.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("Volatility Momentum Suite | Lyro RS", overlay = false)


// Import
import LyroRS/LMAs/1 as DynamicMAs

// Group
lr_g = "𝗠𝗢𝗠𝗘𝗡𝗧𝗨𝗠"
sb_g = "𝗦𝗗 𝗕𝗔𝗡𝗗𝗦"
accel_g = "𝗔𝗖𝗖𝗘𝗟𝗘𝗥𝗔𝗧𝗜𝗢𝗡"
display_g = "𝗗𝗜𝗦𝗣𝗟𝗔𝗬"
table_g = "𝗧𝗔𝗕𝗟𝗘"


// Inputs

// -- LR
source = input.source(close, "Source", tooltip="Select the price source (e.g., close, open, high, low) used for calculations.", group=lr_g)
roc_length = input.int(30, title = 'RoC Length', minval = 1, group= lr_g)
matype = input.string("HMA", "Select MA Type", options=["SMA", "EMA", "WMA", "VWMA", "DEMA", "TEMA", "RMA", "HMA", "LSMA", "SMMA", "ALMA", "ZLSMA", "FRAMA", "KAMA", "JMA", "T3"], group= lr_g)
smoothinglen = input.int(10, title = 'Smoothing Length', minval = 1, group= lr_g, tooltip="Length for smoothing the RoC.")
signal_length = input.int(9, "Signal Length", minval=1, group=lr_g)


// -- SD BANDS
enable_mid_0 = true
stdev_length = input.int(150, "Standard Deviation Length", minval = 1, group= sb_g, tooltip="Length used for calculating the standard deviation.")
stdev_mult = input.float(1.5, "Standard Deviation Multiplier", minval = 0.1, group= sb_g, tooltip="The number of standard deviations used to define the upper and lower borders.", step= 0.5)


// -- Acceleration
accel_matype = input.string("EMA", "MA Type", options=["SMA", "EMA", "WMA", "VWMA", "DEMA", "TEMA", "RMA", "HMA", "LSMA", "SMMA", "ALMA", "ZLSMA", "FRAMA", "KAMA", "JMA", "T3"], tooltip="Moving average type for acceleration detection.", group= accel_g)
acceleration_length = input.int(8, "Acceleration Length", minval = 1, group= accel_g, tooltip="Length for momentum acceleration calculation.")
accel_smoothing = input.int(2, "Acceleration Smoothing Length", minval = 1, group= accel_g, tooltip="Smoothing length for the Acceleration smoothening.")


// -- Display
plot_type = input.string("Classic", "Display Variation", options= ["Classic", "Heikin Ashi"], group= display_g, tooltip="Choose between 'Classic' for standard view or 'Heikin Ashi' for Heikin Ashi candles.")
mode_type = input.string("Trend", "Select Mode", options= ["Trend", "HA Candles", "Extremes", "Histogram"], group= display_g, tooltip="Select a way you would like to use the indicator")


ColMode = input.string("Mystic", "Custom Color Palette", inline="drop", options=["Classic", "Mystic", "Accented", "Royal"], group=display_g,  tooltip="Choose a predefined color scheme for indicator visualization.")

cpyn = input.bool(true, "Use Custom Palette", tooltip="Enable manual selection of custom colors for trend signals.", group=display_g)
cp_UpC = input.color(#00ff00, "Custom Up", inline="Custom Palette", tooltip="Set a custom color for bullish signals.", group=display_g)
cp_DnC = input.color(#ff0000, "Custom Down", inline="Custom Palette", tooltip="Set a custom color for bearish signals.", group=display_g)


// -- Tables
fo = input.bool(false, 'Force Table Overlay', group =table_g, tooltip = 'Allows forcing the overlay of the table on the chart.')
enable_table = input.bool(true, '', group =table_g, inline= "T")
pos_table = input.string('Middle Right', 'Modes Table', options = ['Top Left', 'Middle Left', 'Bottom Left', 'Top Right', 'Middle Right', 'Bottom Right', 'Top Center', "Middle Center", 'Bottom Center'], group = table_g, inline= "T")
table_size_input = input.string("Normal", '', options= ["Huge", "Large", "Normal", "Small", "Tiny"], group= table_g, tooltip= "Settings for the modes table.", inline= "T")


// Colors & Tables
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



// -- Switching Table Size
var string table_size = na

switch table_size_input
    "Huge" =>
        table_size := size.huge
    "Large" =>
        table_size :=  size.large
    "Normal" =>
        table_size :=  size.normal
    "Small" =>
        table_size :=  size.small
    "Tiny" =>
        table_size :=  size.tiny


// -- Position Switching
pot(position) =>
    var pos = switch position
        'Top Left' => position.top_left
        'Middle Left' => position.middle_left
        'Bottom Left' => position.bottom_left
        'Top Right' => position.top_right
        'Middle Right' => position.middle_right
        'Bottom Right' => position.bottom_right
        'Top Center' => position.top_center
        "Middle Center" => position.middle_center
        'Bottom Center' => position.bottom_center
    pos



// LR
roc = ta.roc(source, roc_length)


// Moving Average Switch
float slr = na // Smoothened LR
switch matype
    "SMA" => slr := DynamicMAs.SMA(roc, roc_length)
    "EMA" => slr :=    DynamicMAs.EMA(roc, roc_length)
    "WMA" => slr :=    DynamicMAs.WMA(roc, roc_length)
    "VWMA" => slr :=   DynamicMAs.VWMA(roc, volume, roc_length)
    "DEMA" => slr :=   DynamicMAs.DEMA(roc, roc_length)
    "TEMA" => slr :=   DynamicMAs.TEMA(roc, roc_length)
    "RMA" => slr :=   DynamicMAs.RMA(roc, roc_length)
    "HMA" => slr :=    DynamicMAs.HMA(roc, roc_length)
    "LSMA" => slr :=   DynamicMAs.LSMA(roc, roc_length, 0)
    "SMMA" => slr :=   DynamicMAs.SMMA(roc, roc_length)
    "ALMA" => slr :=   DynamicMAs.ALMA(roc, roc_length, 0, 30)
    "ZLSMA" => slr :=  DynamicMAs.ZLSMA(roc, roc_length)
    "FRAMA" => slr :=  DynamicMAs.FRAMA(roc, roc_length)
    "KAMA" => slr :=   DynamicMAs.KAMA(roc, roc_length)
    "JMA" => slr :=   DynamicMAs.JMA(roc, roc_length, 0.5)
    "T3" => slr :=   DynamicMAs.T3(roc, roc_length, 0.5)

// HA
type HA
    float o = na
    float h = na
    float l = na
    float c = na

// -- Function to calculate Heikin Ashi values
ha(o, h, l, c) =>
    var HA x = HA.new()
    x.c := (o + h + l + c) / 4
    field_0 = x.o
    field_1 = x.o
    field_2 = x.c
    x.o := na(field_0[1]) ? (o + c) / 2 : (nz(field_1[1]) + nz(field_2[1])) / 2
    x.h := math.max(h, math.max(x.o, x.c))
    x.l := math.min(l, math.min(x.o, x.c))
    x

// -- HA Function Execution
ha = ha(
     na(slr[1]) ? slr : slr[1], 
     math.max(slr, slr[1]), 
     math.min(slr, slr[1]), 
     slr)

// -- HA & Classic Plot Color
dynamic_mid = DynamicMAs.SMA(slr, stdev_length)
cross = enable_mid_0 == true ? 0 : dynamic_mid
ha_pc = ha.c > ha.o ? UpC : DnC
cl_pc = slr > cross ? UpC : DnC


Stdev(float src, int period) =>
    actualPeriod = math.min(period, bar_index + 1) 
    mean         = DynamicMAs.SMA(src, actualPeriod)
    sumSquares   = 0.0
    count = 0
    for i = 0 to actualPeriod - 1
        if not na(src[i])
            sumSquares := sumSquares + math.pow(nz(src[i]) - mean, 2)
            count := count + 1
    if count > 0
        math.sqrt(sumSquares / count)
    else
        na

stdv_bands(float _src, int _length, float _mult) =>
    float basis = DynamicMAs.SMA(_src, _length)
    float dev   = _mult * Stdev(_src, _length)
    [basis, basis + dev, basis - dev]


// SD Bands
[_, u1, l1] = stdv_bands(slr, stdev_length, stdev_mult/2)
[_, u2, l2] = stdv_bands(slr, stdev_length, stdev_mult)


// Acceleration - Momentum Acceleration
mom_acceleration = ta.mom(slr, acceleration_length)

float accel_smooth = na
switch accel_matype
    "SMA" => accel_smooth := DynamicMAs.SMA(mom_acceleration, accel_smoothing)
    "EMA" => accel_smooth := DynamicMAs.EMA(mom_acceleration, accel_smoothing)
    "WMA" => accel_smooth := DynamicMAs.WMA(mom_acceleration, accel_smoothing)
    "VWMA" => accel_smooth := DynamicMAs.VWMA(mom_acceleration, volume, accel_smoothing)
    "DEMA" => accel_smooth := DynamicMAs.DEMA(mom_acceleration, accel_smoothing)
    "TEMA" => accel_smooth := DynamicMAs.TEMA(mom_acceleration, accel_smoothing)
    "RMA" => accel_smooth := DynamicMAs.RMA(mom_acceleration, accel_smoothing)
    "HMA" => accel_smooth := DynamicMAs.HMA(mom_acceleration, accel_smoothing)
    "LSMA" => accel_smooth := DynamicMAs.LSMA(mom_acceleration, accel_smoothing, 0)
    "SMMA" => accel_smooth := DynamicMAs.SMMA(mom_acceleration, accel_smoothing)
    "ALMA" => accel_smooth := DynamicMAs.ALMA(mom_acceleration, accel_smoothing, 0, 20)
    "ZLSMA" => accel_smooth := DynamicMAs.ZLSMA(mom_acceleration, accel_smoothing)
    "FRAMA" => accel_smooth := DynamicMAs.FRAMA(mom_acceleration, accel_smoothing)
    "KAMA" => accel_smooth := DynamicMAs.KAMA(mom_acceleration, accel_smoothing)
    "JMA" => accel_smooth := DynamicMAs.JMA(mom_acceleration, accel_smoothing, 0.5)
    "T3" => accel_smooth := DynamicMAs.T3(mom_acceleration, accel_smoothing, 0.5)


// Plot Colors for Different Modes
var color trend_pc = na
var color ha_candle_pc = na
var color extreme_pc = na

// Trend Mode - Above 0 green, below 0 red
trend_pc := slr > cross ? UpC : DnC

// HA Candles Mode - ha.c > ha.o green, opposite red
ha_candle_pc := ha.c > ha.o ? UpC : DnC

// Extremes Mode - Triangle signals with HA confirmation
var bool extreme_waiting_bull = false
var bool extreme_waiting_bear = false

field_7 = ha.c
field_8 = ha.o

// Check if we hit extreme and should wait for HA flip
if ha.c < l2 and ha.c > ha.o and not (field_7[1] > field_8[1])
    extreme_waiting_bull := true
    
if ha.c > u2 and ha.c < ha.o and not (field_7[1] < field_8[1])
    extreme_waiting_bear := true

// Execute signal on HA flip
bool extreme_bull_signal = extreme_waiting_bull and ha.c > ha.o and field_7[1] < field_8[1]
bool extreme_bear_signal = extreme_waiting_bear and ha.c < ha.o and field_7[1] > field_8[1]

if extreme_bull_signal
    extreme_waiting_bull := false
    
if extreme_bear_signal
    extreme_waiting_bear := false

extreme_pc := ha.c > u2 ? UpC : ha.c < l2 ? DnC : na


signal_line = DynamicMAs.EMA(slr, signal_length)
histogram = slr - signal_line

// Histogram color
hist_color = histogram >= 0 ? (histogram >= histogram[1] ? color.new(UpC, 25) : color.new(UpC, 40)) : (histogram <= histogram[1] ? color.new(DnC, 25) : color.new(DnC, 40))

// Plot histogram
plot(histogram, "Histogram", color=hist_color, style=plot.style_histogram, linewidth=2)

// Select active plot color based on mode
pc = mode_type == "Trend" ? trend_pc : mode_type == "HA Candles" ? ha_candle_pc : mode_type == "Extremes" ? extreme_pc : mode_type == "Histogram" ? histogram >= 0 ? (histogram >= histogram[1] ? color.new(UpC, 0) : color.new(UpC, 0)) : (histogram <= histogram[1] ? color.new(DnC, 0) : color.new(DnC, 0))  : na


plot(accel_smooth, "Acceleration", color= color.white, linewidth = 2, style= plot.style_circles)
plot(plot_type == "Classic" ? slr : na, "RoC", color= cl_pc, linewidth = 2)
plotcandle(ha.o, ha.h, ha.l, ha.c, color= na, wickcolor = na, bordercolor = ha_pc, force_overlay = false, display= plot_type == "Heikin Ashi" ? display.pane : display.none, title= "Heikin Ashi")
plotcandle(open, high, low, close, color= pc, wickcolor = pc, bordercolor = pc, force_overlay = true, display= display.pane, title= "Plot Candle")

// Stdev Plots
pu1 = plot      (u1,      "1 SD +",             color.new(DnC, 70),                                                             display =         display.all)
pl1 = plot      (l1,      "1 SD -",             color.new(UpC, 70),                                                             display =         display.all)
pu2 = plot      (u2,      "2 SD +",             color.new(DnC, 70),                                                             display = display.pane)
pl2 = plot      (l2,      "2 SD -",             color.new(UpC, 70),                                                             display = display.pane)
mid = plot(cross,   "Crossing Line",   color.gray,                                                                      display =         display.all)


// Fills
fill      (pu1, pu2, u2, u1,              color.new(DnC, 60), color.new(chart.bg_color, 75),                              display =       display.all)
fill      (pl1, pl2, l2, l1,              color.new(UpC, 60), color.new(chart.bg_color, 75),                              display =       display.all)


// -- Extra Signals
u = ha.c + (ha.c * 0.25)
l = ha.c - (ha.c * -0.25)

u3 = slr+ (slr * 0.25)
l3 = slr - (slr * -0.25)

plotshape(plot_type == "Heikin Ashi" ? (ha.c > u2 and ha.c < ha.o and not (field_7[1] < field_8[1]) ? u : na) : (slr < u2 and slr[1] > u2 ? u3 : na), "Triangles", shape.triangledown, location.absolute, color= DnC, size= size.tiny, display= display.pane)
plotshape(plot_type == "Heikin Ashi" ? (ha.c < l2 and ha.c > ha.o and not (field_7[1] > field_8[1]) ? l : na) : (slr > l2 and slr[1] < l2 ? l3 : na), "Triangles", shape.triangleup, location.absolute, color= UpC, size= size.tiny, display= display.pane)

// Signals

// -- Trend Mode
t_sig = slr > 0 ? 1 : -1

// -- HA Candles Mode
ha_sig = ha.c > ha.o ? 1 : -1

// -- Extremes Mode
e_sig = extreme_bull_signal ? 1 : extreme_bear_signal ? -1 : 0



// Tables
var table mode_stat_table = na


// -- Force Overlay Conditions
if fo
    mode_stat_table := table.new(pot(pos_table), 100, 100, frame_width = 1, frame_color = color.gray, force_overlay = true, border_color = color.gray, border_width = 1)
else
    mode_stat_table := table.new(pot(pos_table), 100, 100, frame_width = 1, frame_color = color.gray, force_overlay = false, border_color = color.gray, border_width = 1)



// -- Table Cells
if enable_table
    table.cell(mode_stat_table, 0, 0, 'MODULES:', text_color = color.white, bgcolor = #000000, text_size=table_size)
    table.cell(mode_stat_table, 0, 1, 'Trend', text_color = color.gray, bgcolor = #000000, text_size=table_size)
    table.cell(mode_stat_table, 0, 2, 'HA Candles', text_color = color.gray, bgcolor = #000000, text_size=table_size)
    table.cell(mode_stat_table, 0, 3, 'Extremes', text_color = color.gray, bgcolor = #000000, text_size=table_size)

    table.cell(mode_stat_table, 1, 0, 'STATE:', text_color = color.white, bgcolor = #000000, text_size=table_size)
    table.cell(mode_stat_table, 1, 1, t_sig == 1 ? "⬆️Above 0⬆️" : "⬇️Below 0⬇️", text_color =  t_sig == 1 ? UpC : DnC, bgcolor = #000000, text_size=table_size)
    table.cell(mode_stat_table, 1, 2, ha_sig == 1 ? "🟢Bullish HA🟢" : "🔴Bearish HA🔴", text_color = ha_sig == 1 ? UpC : DnC, bgcolor = #000000, text_size=table_size)
    table.cell(mode_stat_table, 1, 3, e_sig == 1 ? "💀Oversold💀" : e_sig == -1 ? "💥Overbought💥" : "⚖️Neutral⚖️", text_color = e_sig == 1 ? UpC : e_sig == -1 ? DnC : color.gray, bgcolor = #000000, text_size=table_size)


// Alerts

// -- Trend
alertcondition(t_sig == 1 and t_sig[1] == -1, "Trend - Above Zero", "Volatility Momentum Suite crossed above zero. {{exchange}}:{{ticker}}.")
alertcondition(t_sig == -1 and t_sig[1] == 1, "Trend - Below Zero", "Volatility Momentum Suite crossed below zero. {{exchange}}:{{ticker}}.")

// -- HA Candles
alertcondition(ha_sig == 1 and ha_sig[1] == -1, "HA Candles - Bullish", "Heikin Ashi turned bullish. {{exchange}}:{{ticker}}.")
alertcondition(ha_sig == -1 and ha_sig[1] == 1, "HA Candles - Bearish", "Heikin Ashi turned bearish. {{exchange}}:{{ticker}}.")

// -- Extremes
alertcondition(e_sig == 1, "Extremes - Oversold Signal", "Oversold extreme with bullish HA confirmation. {{exchange}}:{{ticker}}.")
alertcondition(e_sig == -1, "Extremes - Overbought Signal", "Overbought extreme with bearish HA confirmation. {{exchange}}:{{ticker}}.")

// -- Histogram
alertcondition(histogram > 0 and histogram[1] <= 0, "Histogram - Bullish Cross", "Histogram crossed above zero. {{exchange}}:{{ticker}}.")
alertcondition(histogram < 0 and histogram[1] >= 0, "Histogram - Bearish Cross", "Histogram crossed below zero. {{exchange}}:{{ticker}}.")

Overview

Volatility Momentum Suite also measures acceleration of that momentum with its own moving average and smoothing length. Display options include classic or Heikin Ashi variations and four modes: trend, candles, extremes and histogram. A modes table, sixteen selectable average types and color palettes are included.

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, Volatility & bands

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
Sourcesourceclosesource
RoC Lengthint30roc_length
Select MA TypestringHMAmatype
Smoothing Lengthint10smoothinglen
Signal Lengthint9signal_length
Standard Deviation Lengthint150stdev_length
Standard Deviation Multiplierfloat1.5stdev_mult
MA TypestringEMAaccel_matype
Acceleration Lengthint8acceleration_length
Acceleration Smoothing Lengthint2accel_smoothing
Display VariationstringClassicplot_type
Select ModestringTrendmode_type
Show all 20 settings
SettingTypeDefaultVariable
Custom Color PalettestringMysticColMode
Use Custom Palettebooltruecpyn
Custom Upcolor#00ff00cp_UpC
Custom Downcolor#ff0000cp_DnC
Force Table Overlayboolfalsefo
enable_tablebooltrueenable_table
Modes TablestringMiddle Rightpos_table
table_size_inputstringNormaltable_size_input
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

TTM Squeeze

by Alorse
330 stars

This indicator plots a TTM Squeeze momentum oscillator in a separate pane. It compares a Bollinger Band offset to a Keltner Channel offset and marks the zero line white when the difference is non-negative and black when the bands are inside the channel. A line

Indicator v5 Oscillators & momentumVolatility & bands
Updated 2 months ago · None stated GitHub repository of TTM Squeeze

Function - Logistic Equation

by ricardosantos79
261 stars

Calculates dynamic modeling values by applying a mathematical logistic differential equation to price change over a specified lookback length. It measures price momentum relative to the recent high-low price range. The script plots positive and negative logist

Indicator v5 Oscillators & momentumVolatility & bands
Updated 4 years ago · None stated GitHub repository of Function - Logistic Equation

MACD-V

by harryguiacorn
219 stars

MACD-V is a volatility-normalized momentum indicator based on research by Alex Spiroglou. It calculates the standard MACD histogram and normalizes it by dividing by the Average True Range (ATR). Plotted in a separate pane as a colored histogram, it includes us

Indicator v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of MACD-V
218 stars

This indicator detects a Bollinger Band squeeze when the bands sit inside Keltner Channels, marking low volatility. It plots red dots during a squeeze and green dots when the bands are outside, in a separate pane. An optional histogram shows momentum as the cl

Indicator v6 Volatility & bandsOscillators & momentum
Updated 3 months ago · None stated GitHub repository of Bollinger Band Squeeze Detector
147 stars

This indicator generates trade entry signals and target levels optimized for 1-hour timeframes, designed for external signal extraction. It calculates 7-period and 16-period EMAs alongside 10-period RSI and ATR filters. Long signals occur when the fast EMA cro

Indicator v5 TrendOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of Signal Strategy 100 Candles of 1H Timeframe

Bubbles Indicator

by capissimo
114 stars

The Bubbles Indicator measures volatility squeezes and expansion bursts using Bollinger Bands combined with a sinusoid oscillator and RSI divergence. It processes price data through scaled Bollinger Bands to highlight volatility changes while confirming trend

Indicator v4 Volatility & bandsOscillators & momentum Repaints
Updated 1 year ago · None stated GitHub repository of Bubbles Indicator

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