Indicator · Pine Script v6 · Own pane

Volatility Momentum Score

by vedkanani123· code credited to LyroRS

A separate-pane oscillator that combines a Z-score of price with a Z-score of volatility into one score, then applies bands from a band length with separate positive and negative multipliers.

View on GitHub

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

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

20.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 Score | Lyro RS", overlay = false)

//─────────────────────────────────────────────────────────────────────────────────────────────────────────────
//─██████─────────████████──████████─████████████████───██████████████───────████████████████───██████████████─
//─██░░██─────────██░░░░██──██░░░░██─██░░░░░░░░░░░░██───██░░░░░░░░░░██───────██░░░░░░░░░░░░██───██░░░░░░░░░░██─
//─██░░██─────────████░░██──██░░████─██░░████████░░██───██░░██████░░██───────██░░████████░░██───██░░██████████─
//─██░░██───────────██░░░░██░░░░██───██░░██────██░░██───██░░██──██░░██───────██░░██────██░░██───██░░██─────────
//─██░░██───────────████░░░░░░████───██░░████████░░██───██░░██──██░░██───────██░░████████░░██───██░░██████████─
//─██░░██─────────────████░░████─────██░░░░░░░░░░░░██───██░░██──██░░██───────██░░░░░░░░░░░░██───██░░░░░░░░░░██─
//─██░░██───────────────██░░██───────██░░██████░░████───██░░██──██░░██───────██░░██████░░████───██████████░░██─
//─██░░██───────────────██░░██───────██░░██──██░░██─────██░░██──██░░██───────██░░██──██░░██─────────────██░░██─
//─██░░██████████───────██░░██───────██░░██──██░░██████─██░░██████░░██───────██░░██──██░░██████─██████████░░██─
//─██░░░░░░░░░░██───────██░░██───────██░░██──██░░░░░░██─██░░░░░░░░░░██───────██░░██──██░░░░░░██─██░░░░░░░░░░██─
//─██████████████───────██████───────██████──██████████─██████████████───────██████──██████████─██████████████─
//─────────────────────────────────────────────────────────────────────────────────────────────────────────────
//                                                 LyroRS v1.0


// Libraries
import LyroRS/LMAs/1 as DynamicMAs   // Import custom library for dynamic moving averages


// Groups for input organization
vms_g = "𝗩𝗢𝗟𝗔𝗧𝗜𝗟𝗜𝗧𝗬 𝗠𝗢𝗠𝗘𝗡𝗧𝗨𝗠 𝗦𝗖𝗢𝗥𝗘"
sdb_g = "𝗦𝗗 𝗕𝗔𝗡𝗗𝗦"
display_g = '𝗗𝗜𝗦𝗣𝗟𝗔𝗬'


// Inputs

// -- Volatility Momentum Score
len1  = input.int(35, "Price Z Length", group=vms_g, tooltip="Sets the lookback length used for calculating the Price Z score.")
len2  = input.int(35, "Volatility Z Length", group=vms_g, tooltip="Sets the lookback length used for calculating the Volatility Z score.")

// -- SD Bands
len3  = input.int(100, "Band Length", group=sdb_g, tooltip="Defines the number of bars used to calculate the standard deviation bands.")
pmult = input.float(1.5, "+ Band Multiplier", group=sdb_g, minval=0.001, tooltip="Adjusts the positive (upper) band distance from the mean; higher values place the band further away.")
nmult = input.float(-0.4, "- Band Multiplier", group=sdb_g, maxval=-0.001, tooltip="Adjusts the negative (lower) band distance from the mean; smaller values place the band further away.")

// -- Color Inputs
signal_type = input.string("Trend", "Select Signal Type", options=["Trend", "Reversion"], group=display_g, tooltip="Select which way to use the indicator.")
d_signs           = input.bool  (true,             "Display Signs", group= display_g, display=display.none, tooltip="Enables signs for Trend mode.")
d_bgcol           = input.bool  (true,             "", group= display_g, display=display.none, tooltip="Enables background color for Reversion & Valuation mode.", inline= "bgcol")
d_obos_sigs           = input.bool  (true,             "Display Oversold/Overbought Signs", group= display_g, display=display.none, tooltip="Enables triangle signs to be displayed.")
bgTransp = input.int(70, "Background Transparency", group=display_g, tooltip="Adjusts how transparent the background color appears on the chart, where 0 is fully visible and 100 is fully transparent.", inline= "bgcol")


ColMode = input.string("Mystic", "Custom Color Palette", inline="drop", options=["Classic", "Mystic", "Accented", "Royal"], display=display.none, 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, display=display.none)
cp_UpC = input.color(#00ff00, "Custom Up", inline="Custom Palette", tooltip="Set a custom color for bullish signals.", group=display_g, display=display.none)
cp_DnC = input.color(#ff0000, "Custom Down", inline="Custom Palette", tooltip="Set a custom color for bearish signals.", group=display_g, display=display.none)


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


// Function: calculate z-score of a series
zscore(src, len) =>
    x = src
    h = DynamicMAs.EMA(src, len)   // mean via EMA
    o = ta.stdev(src, len)         // standard deviation
    (x - h) / o                    // z-score


// Calculate z-scores for price and volatility
price_z      = zscore(close, len1)
volatility_z = zscore(ta.stdev(close, len2), len2)

// Average of price & volatility z-scores
avg  = math.avg(price_z, volatility_z)

// Standard deviation bands
std          = ta.stdev(avg, len3)
std2         = ta.stdev(avg, len3)
upperBand = std * pmult 
lowerBand = std2 * nmult

// Persistent color variables
color pc  = na   // background color
var color pc2 = na   // plot color
var color pc3 = na // Candle Color
var int signal = 0

color.new(DnC, bgTransp)
// BG Color logic
if avg > upperBand
    pc := color.new(DnC, bgTransp)

else if avg < lowerBand
    pc := color.new(UpC, bgTransp)


// Line Color logic: based on band position
if avg > upperBand
    pc2 := UpC
else if avg < lowerBand
    pc2 := DnC


// Candle Color logic: cross above/below bands
if ta.crossover(avg, upperBand)
    pc3 := UpC
    signal := 1

else if ta.crossunder(avg, lowerBand)
    pc3 := DnC
    signal := -1



// Plots
pa = plot(avg, color=pc2, title="Average Zscore")

pup = plot(upperBand, color=UpC)
plb = plot(lowerBand, color=DnC)
plotcandle(open, high, low, close, "Candle Color", pc3, pc3, true, bordercolor = pc3, display = display.pane, force_overlay = true)

bgcolor(force_overlay=true, color=signal_type == "Reversion" ? pc : na, editable = false)


fill(pa, pup, avg, upperBand, signal == 1 ? color.new(UpC, 30) : na, color.new(chart.bg_color, 50), display= display.all)
fill(pa, plb, avg, lowerBand, signal == -1 ? color.new(DnC, 30) : na, color.new(chart.bg_color, 50), display= display.all)


// Labels
plotshape(ta.crossover(signal, 0), title="Buy Signal", location=location.belowbar,
           style=shape.labelup, text="𝓛𝓸𝓷𝓰", textcolor=#000000, size=size.small,
           color=UpC, force_overlay=true, display= signal_type == "Trend" and d_signs == true ? display.pane : display.none)

plotshape(ta.crossunder(signal, 0), title="Sell Signal", location=location.abovebar,
           style=shape.labeldown, text="𝓢𝓱𝓸𝓻𝓽", textcolor=#000000, size=size.small,
           color=DnC, force_overlay=true, display= signal_type == "Trend" and d_signs == true ? display.pane : display.none) 




plotchar(upperBand + 0.5, char='▼', color= ta.crossunder(avg, upperBand) ? DnC : na, location=location.absolute, title= "Overbought Signal", display= d_obos_sigs ?  display.pane : display.none, size= size.tiny)
plotchar(lowerBand - 0.5, char='▲', color= ta.crossover(avg, lowerBand) ? UpC : na, location=location.absolute, title= "Oversold Signal", display= d_obos_sigs ?  display.pane : display.none, size= size.tiny)

Overview

A signal type setting chooses how it is read, and optional signs mark oversold and overbought zones and trend changes. A background tint can be shown with adjustable transparency, and palettes are selectable.

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, Mean reversion

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
Price Z Lengthint35len1
Volatility Z Lengthint35len2
Band Lengthint100len3
+ Band Multiplierfloat1.5pmult
- Band Multiplierfloat-0.4nmult
Select Signal TypestringTrendsignal_type
Display Signsbooltrued_signs
d_bgcolbooltrued_bgcol
Display Oversold/Overbought Signsbooltrued_obos_sigs
Background Transparencyint70bgTransp
Custom Color PalettestringMysticColMode
Use Custom Palettebooltruecpyn
Show all 14 settings
SettingTypeDefaultVariable
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

261 stars

This indicator calculates standardized z-scores of price data across four different lookback periods (6, 14, 26, and 100). Standardizing data subtracts the moving average from the price and divides by the standard deviation. It applies a Double Exponential Mov

Indicator v5 Mean reversionVolatility & bands

Squeeze Cross

by JohnsonHsiao
1 stars

This indicator calculates a normalized volatility oscillator plotted in a separate pane. It measures the distance between the closing price and a simple moving average, standardized by a scaled standard deviation band. The script plots the resulting ratio alon

Indicator v5 Volatility & bandsOscillators & momentum
Updated 3 years ago · None stated GitHub repository of Squeeze Cross

Trend-Filtered Reversal

by caizongxun
1 stars

A separate-pane indicator for counter-trend reversal setups that are filtered by a baseline EMA trend. A bearish setup needs price at a wide upper Bollinger Band, high volume or an overbought RSI, and a rejection wick; the bullish setup mirrors this. In a stro

Indicator v5 Mean reversionVolatility & bands
Updated 8 months ago · MIT GitHub repository of Trend-Filtered Reversal

This indicator plots trade entry and exit signals on the price chart by combining Bollinger Bands with optional filter conditions. It calculates standard Bollinger Bands along with RSI, Aroon, and moving average filters. Reversal signals trigger when price bre

Indicator v4 Volatility & bandsOscillators & momentum
Updated 2 months ago · None stated GitHub repository of Bollinger Bands Winner IND [Alorse]
147 stars

This indicator combines Bollinger Bands, RSI, Stochastic RSI, and volume spike detection to identify mean-reversion conditions during range-bound market regimes. It calculates Bollinger Band width to identify low-volatility states and triggers buy or sell sign

Indicator v5 Oscillators & momentumVolatility & bands
Updated 6 weeks ago · MIT GitHub repository of BTC Dec 2025 — Range + Gamma Flush

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