Indicator · Pine Script v6 · Own pane

Volume MAs Oscillator

by vedkanani123· code credited to LyroRS

A separate-pane oscillator derived from a selectable volume-adjusted moving average, with adaptive bands set by a band length, a smoothing value and separate positive and negative multipliers.

View on GitHub

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

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

19.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("Volume MAs Oscillator | Lyro RS")

import LyroRS/LMAs/1 as DynamicMAs

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

// Groups
ma_g = "𝗠𝗢𝗩𝗜𝗡𝗚 𝗔𝗩𝗘𝗥𝗔𝗚𝗘"
bands_g = "𝗕𝗔𝗡𝗗"
display_g = '𝗗𝗜𝗦𝗣𝗟𝗔𝗬'


// Inputs

// -- Moving Average
source = input.source(close, "Source", group= ma_g, tooltip= "Select where the data originates (open, high, low, close, etc..).")
ma_type = input.string("EMA", "Select Moving Average", options=["SMA", "EMA", "WMA", "VWMA", "DEMA", "TEMA", "RMA", "HMA", "LSMA", "SMMA", "ALMA", "ZLSMA", "FRAMA", "KAMA", "JMA", "T3"], group=ma_g, tooltip="Choose a moving average type to apply to the price multiplied by volume. VWMA already incorporates volume directly.")
ma_length = input.int(30, "Moving Average Length", group= ma_g, tooltip= "Defines the length or period of the selected moving average.")

// -- Bands
band_length = input.int(27, "Band Length", group=bands_g, tooltip="Number of bars used to calculate standard deviation.")
band_smoothing = input.float(0.8, "Band Smoothing", group=bands_g, minval=0, tooltip="Smooths the band edges to reduce noise.")
pbm = input.float(1.8, "Positive Band Multiplier", group=bands_g, minval=0, tooltip="Multiplier for the upper band distance.")
nbm = input.float(-0.85, "Negative Band Multiplier", group=bands_g, maxval=0, tooltip="Multiplier for the lower band distance.")


// Color Inputs
signal_type = input.string("Trend", "Select Signal Type", options=["Trend", "Reversion", "Valuation"], group=display_g, tooltip="Select which way to use the indicator.")
ColMode = input.string("Mystic", "Custom Color Palette", inline="drop", options=["Classic", "Mystic", "Accented", 'Royal'], display=display.none, group= display_g, tooltip="Select a predefined color scheme for the indicator display. (Major Themes color mode automatically switches colors based on the major asset you picked for valuation analysis.)")


cpyn           = input.bool  (true,             "Use Custom Palette", group= display_g, display=display.none, tooltip="Enables custom color selection for signals.")
cp_UpC        = input.color (#00ff00,         "Custom Up", inline = "Custom Palette", group= display_g, display=display.none, tooltip="")
cp_DnC        = input.color (#ff0000,         "Custom Down", inline = "Custom Palette", group= display_g, display=display.none, tooltip="User specifed bullish and bearish colors.")
d_obos_sigs           = input.bool  (true,             "Display Oversold/Overbought Signs", group= display_g, display=display.none, tooltip="Enables triangle signs to be displayed.")
d_signs           = input.bool  (true,             "Display Signs", group= display_g, display=display.none, tooltip="Enables signs for Trend mode.")
d_bgcol           = input.bool  (true,             "Display Background Color", group= display_g, display=display.none, tooltip="Enables background color for Reversion & Valuation mode.")



// Colors
color UpC = na
color DnC = na


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


// -- Custom Colors
if cpyn
    UpC := cp_UpC
    DnC := cp_DnC


// Coloring Function for Valuation
coloring(src) =>
    color.from_gradient(src, ta.lowest(src, band_length), ta.highest(src, band_length), UpC, DnC)


// Moving Average Switch
float ma = na
switch ma_type
    "SMA"   => ma := DynamicMAs.SMA(source * volume, ma_length) / DynamicMAs.SMA(volume, ma_length)
    "EMA"   => ma := DynamicMAs.EMA(source * volume, ma_length) / DynamicMAs.EMA(volume, ma_length)
    "WMA"   => ma := DynamicMAs.WMA(source * volume, ma_length) / DynamicMAs.WMA(volume, ma_length)
    "VWMA"  => ma := DynamicMAs.VWMA(source, volume, ma_length) // Already Volume Based MA
    "DEMA"  => ma := DynamicMAs.DEMA(source * volume, ma_length) / DynamicMAs.DEMA(volume, ma_length)
    "TEMA"  => ma := DynamicMAs.TEMA(source * volume, ma_length) / DynamicMAs.TEMA(volume, ma_length)
    "RMA"   => ma := DynamicMAs.RMA(source * volume, ma_length) / DynamicMAs.RMA(volume, ma_length)
    "HMA"   => ma := DynamicMAs.HMA(source * volume, ma_length) / DynamicMAs.HMA(volume, ma_length)
    "LSMA"  => ma := DynamicMAs.LSMA(source * volume, ma_length, 0) / DynamicMAs.LSMA(volume, ma_length, 0)
    "SMMA"  => ma := DynamicMAs.SMMA(source * volume, ma_length) / DynamicMAs.SMMA(volume, ma_length)
    "ALMA"  => ma := DynamicMAs.ALMA(source * volume, ma_length, 0, 20) / DynamicMAs.ALMA(volume, ma_length, 0, 20)
    "ZLSMA" => ma := DynamicMAs.ZLSMA(source * volume, ma_length) / DynamicMAs.ZLSMA(volume, ma_length)
    "FRAMA" => ma := DynamicMAs.FRAMA(source * volume, ma_length) / DynamicMAs.FRAMA(volume, ma_length)
    "KAMA"  => ma := DynamicMAs.KAMA(source * volume, ma_length) / DynamicMAs.KAMA(volume, ma_length)
    "JMA"   => ma := DynamicMAs.JMA(source * volume, ma_length, 0) / DynamicMAs.JMA(volume, ma_length, 0)
    "T3"    => ma := DynamicMAs.T3(source * volume, ma_length, 0.5) / DynamicMAs.T3(volume, ma_length, 0.5)





price_diff = ((source - ma) / ma) * 100 // Percentage Difference between Source and the Moving Average of the source




// Calculations for the Bands
std          = ta.stdev(price_diff, band_length)
upperBandRaw = std * pbm 
lowerBandRaw = std * nbm

var float upperBand = na
var float lowerBand = na
// Smooth
upperBand := upperBandRaw * band_smoothing + nz(upperBand[1]) * (1 - band_smoothing)
lowerBand := lowerBandRaw * band_smoothing + nz(lowerBand[1]) * (1 - band_smoothing)


// Plot Color
var color pc = na
var color uB_color = na
var color lB_color = na
var int signal = 0

if signal_type == "Trend"
    uB_color := UpC
    lB_color := DnC
    if price_diff > upperBand
        pc := UpC
        signal := 1

    if price_diff < lowerBand
        pc := DnC
        signal := -1



if signal_type == "Reversion"
    uB_color := DnC
    lB_color := UpC

    if price_diff > upperBand
        pc := DnC
        signal := -1

    else if price_diff < lowerBand
        pc := UpC
        signal := 1

    else 
        pc := color.gray
        signal := 0



if signal_type == "Valuation"
    uB_color := UpC
    lB_color := DnC

    pc := coloring(price_diff)




// Plot
plot(price_diff, color= pc, linewidth = 2, title= "Volume MAs Oscillator")
plot(upperBand, color= color.new(uB_color, 50), title= "Upper Band")
plot(lowerBand, color= color.new(lB_color, 50), title= "Lower Band")

plot(0, color= color.new(pc, 60), linewidth = 2, display= display.pane, title= "Mid Line")
plot(0, color= color.new(pc, 75), linewidth = 5, display= display.pane, title= "Mid Line Glow 1")
plot(0, color= color.new(pc, 85), linewidth = 10, display= display.pane, title= "Mid Line Glow 2")

plotchar(upperBand + 0.5, char='▼', color= ta.crossunder(price_diff, 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(price_diff, lowerBand) ? UpC : na, location=location.absolute, title= "Oversold Signal", display= d_obos_sigs ?  display.pane : display.none, size= size.tiny)



reversion_enable = signal_type == "Reversion"
valuation_enable = signal_type == "Valuation"

bgcolor(d_bgcol and ((valuation_enable and price_diff > upperBand) or (reversion_enable and ta.crossunder(price_diff, upperBand))) ? color.new(DnC, 85) : na, title= "BG Color OB")
bgcolor(d_bgcol and ((valuation_enable and price_diff > upperBand) or (reversion_enable and ta.crossunder(price_diff, upperBand))) ? color.new(DnC, 85) : na, title= "BG Color OB Overlay", force_overlay = true)

bgcolor(d_bgcol and ((valuation_enable and price_diff < lowerBand) or (reversion_enable and ta.crossover(price_diff, lowerBand))) ? color.new(UpC, 85) : na, title= "BG Color OS")
bgcolor(d_bgcol and ((valuation_enable and price_diff < lowerBand) or (reversion_enable and ta.crossover(price_diff, lowerBand))) ? color.new(UpC, 85) : na, title= "BG Color OS Overlay", force_overlay = true)



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)


plotcandle(open, high, low, close, color= pc, wickcolor = pc, bordercolor = pc, force_overlay = true, display= display.pane, title= "Plot Candle")
barcolor(pc, title= "Barcolor")

Overview

A signal type setting picks the reading. Optional oversold and overbought signs, trend change signs and a background color mark states. The default average is an EMA of length 30, and palettes are adjustable.

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, Volume

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
Select Moving AveragestringEMAma_type
Moving Average Lengthint30ma_length
Band Lengthint27band_length
Band Smoothingfloat0.8band_smoothing
Positive Band Multiplierfloat1.8pbm
Negative Band Multiplierfloat-0.85nbm
Select Signal TypestringTrendsignal_type
Custom Color PalettestringMysticColMode
Use Custom Palettebooltruecpyn
Custom Upcolor#00ff00cp_UpC
Custom Downcolor#ff0000cp_DnC
Show all 15 settings
SettingTypeDefaultVariable
Display Oversold/Overbought Signsbooltrued_obos_sigs
Display Signsbooltrued_signs
Display Background Colorbooltrued_bgcol
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

Money Flow Index

by everget
948 stars

Calculates the standard Money Flow Index (MFI) oscillator alongside an exponential moving average signal line in a separate pane. The script visually highlights trend conditions through dynamic ribbon filling, optional difference histogram bars, and overbought

Indicator v4 Oscillators & momentumVolume
Updated 11 days ago · GPL-3.0 GitHub repository of Money Flow Index

Commitment Gauge

by harryguiacorn
219 stars

This indicator measures directional momentum by evaluating candlestick body proportions and volume over a user-defined lookback window. It computes the ratio of candle body to total range, weights the cumulative value by volume and absolute body size, and dete

Indicator v4 VolumeCandlestick patterns
Updated 1 year ago · None stated GitHub repository of Commitment Gauge

Aggregate Signal

by capissimo
114 stars

This indicator builds an aggregate oscillator in a separate pane. It scales open, high, low, close, and volume into a 0 to 1 range, then averages scaled readings from MACD, a MACD histogram, RSI, stochastic, CCI, momentum, OBV, a directional index, volume-weig

Indicator v4 Oscillators & momentumVolume Repaints
Updated 1 year ago · None stated GitHub repository of Aggregate Signal

This indicator calculates the Bill Williams Market Facilitation Index as the high-low range divided by volume, or zero when volume is zero. It compares the index and volume with the previous bar and assigns one of four zones: green for both rising, fade for bo

Indicator v6 VolumeOscillators & momentum
Updated 4 weeks ago · Apache-2.0 GitHub repository of Bill Williams Market Facilitation Index

PPO ATR Bands

by cryptorife
75 stars

PPO ATR Bands plots a percentage price oscillator in a separate pane. It compares a Hull average of typical price with a volume-weighted exponential average of Parabolic SAR, then scales three true-range bands around the slow average into matching oscillator l

Indicator v4 Oscillators & momentumMoving averages
Updated 3 years ago · GPL-3.0 GitHub repository of PPO ATR Bands

Chaikin Oscillator

by be-thomas
65 stars

Calculates the Chaikin Oscillator by taking the difference between a fast exponential moving average and a slow exponential moving average of the Accumulation/Distribution line. It plots the resulting line in a separate pane alongside a dashed zero reference l

Indicator v4 Oscillators & momentumVolume
Updated 5 days ago · GPL-3.0 GitHub repository of Chaikin Oscillator

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