Indicator · Pine Script v6 · On the chart

Volume MAs Cloud Trend

by vedkanani123· code credited to LyroRS

An overlay indicator that draws a cloud around a selectable volume-based moving average, with positive and negative band multipliers setting the upper and lower edges.

View on GitHub

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

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

11.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 Cloud Trend | Lyro RS", "Volume MAs Cloud Trend | Lyro RS", true)



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
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("Cloud", "Select Signal Type", options=["Cloud", "Trail"], 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_signs           = input.bool  (true,             "Display Signs", group= display_g, display=display.none, tooltip="Enables signs for Trend 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


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



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

stdev= Stdev(source, ma_length)
pb = ma + (stdev *  pbm)
nb = ma + (stdev *  nbm)



var color pc = na
var sig = 0
if ta.crossover(close, pb)
    pc := UpC
    sig := 1


else if ta.crossunder(close, nb)
    pc := DnC
    sig := -1


// ══════════════════════════════════════════════════════════════════════════════
// TRAILING STOP LOSS LOGIC (NEW)
// ══════════════════════════════════════════════════════════════════════════════

var float trailStop = na
var int trailDirection = 0
atr = ta.atr(14)

// Trailing stop logic
if sig == 1 and sig[1] != 1 // New long signal
    trailStop := low - atr
    trailDirection := 1
else if sig == -1 and sig[1] != -1 // New short signal
    trailStop := high + atr
    trailDirection := -1
else if trailDirection == 1 // In long position
    newStop = low - atr
    trailStop := math.max(nz(trailStop), newStop)
else if trailDirection == -1 // In short position
    newStop = high + atr
    trailStop := math.min(nz(trailStop), newStop)



// -- Cloud Plot
ppb = plot(pb, color= color.new(UpC, 35), title= "Positive Band", display= signal_type == "Cloud" ?  display.pane + display.price_scale : display.none, force_overlay = true, linewidth= 2)
pnb = plot(nb, color= color.new(DnC, 50), title= "Negative Band", display= signal_type == "Cloud" ? display.pane + display.price_scale : display.none, force_overlay = true, linewidth= 2)
pma = plot(ma, color= pc, title= "MA", force_overlay = true, display= signal_type == "Cloud" ? display.all : display.none)
plot(ma, color = color.new(pc, 85), title= "MA Glow Effect", linewidth = 10, force_overlay = true, display= signal_type == "Cloud" ? display.pane : display.none)

fill(ppb, pma, pb, ma, color.new(pc, 55), color.new(chart.fg_color, 100), display= signal_type == "Cloud" ? display.all : display.none)
fill(pnb, pma, nb, ma, color.new(pc, 55), color.new(chart.fg_color, 100), display= signal_type == "Cloud" ? display.all : display.none)


// Trail
plot(trailStop, "Trail", color= pc, linewidth= 2, display= signal_type == "Trail" ? display.all : display.none)


// Long/Short Labels
plotshape(ta.crossover(sig, 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(sig, 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")



// Alerts
alertcondition(sig == 1 and sig[1] != 1, "Long", "Volume MAs Cloud trend is long{{exchange}}:{{ticker}}")
alertcondition(sig == 1 and sig[1] != 1, "Short", "Volume MAs Cloud trend is short{{exchange}}:{{ticker}}")

Overview

The signal type setting chooses how the trend is read, with the cloud as the default, and the cloud is colored by direction. Optional signs mark changes on the price chart. Inputs include the average type, its length and color palette choices.

Details

Published by

vedkanani123 on GitHub

Code credit

LyroRS, as written in the script's header

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Trend, Moving averages, 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
Positive Band Multiplierfloat1.8pbm
Negative Band Multiplierfloat-0.85nbm
Select Signal TypestringCloudsignal_type
Custom Color PalettestringMysticColMode
Use Custom Palettebooltruecpyn
Custom Upcolor#00ff00cp_UpC
Custom Downcolor#ff0000cp_DnC
Display Signsbooltrued_signs
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

Adaptive MA Slope

by capissimo
114 stars

This indicator calculates Kaufman's Adaptive Moving Average (KAMA) on a chosen price source and determines trend direction based on the slope across a configurable lookback window. Signals can be filtered by short-term volatility expansion using ATR comparison

Indicator v4 Moving averagesTrend
Updated 1 year ago · None stated GitHub repository of Adaptive MA Slope

Signal Strategy 15m

by tripolskypetr
72 stars

This indicator generates trend-following trade signals on the price chart by combining moving average crossovers with multi-factor filters. It triggers entry alerts when fast and slow EMAs cross in the direction of a baseline trend EMA, confirmed by non-extrem

Indicator v5 TrendMoving averages
Updated 4 days ago · MIT GitHub repository of Signal Strategy 15m
46 stars

This overlay indicator plots a SuperTrend using a 10-period ATR with a multiplier of 3, drawing up and down stop lines and a faint trend fill on the price chart. It compares a 9-period EMA with an 18-period EMA and a 12/26/9 MACD against its signal, and it req

Indicator v5 TrendOscillators & momentum
Updated 3 years ago · None stated GitHub repository of SuperTrend + MACD + EMA

Bte Acc

by f-cksociety
11 stars

Bte Acc is a chart indicator form of the PineCoders Backtesting and Trading Engine. It seeks an entry trigger from a main or alternate entry method, then checks trade direction, filters, date range, ATR readiness, and remaining capital before filling on the ne

Indicator v5 TrendOscillators & momentum Repaints
Updated 4 years ago · MPL-2.0 GitHub repository of Bte Acc
9 stars

This indicator plots a volume-weighted moving average as a central trend baseline and surrounds it with ATR-based volatility bands. It colors the trend and optional price bars according to whether price is on the bullish or bearish side of those bands. Users c

Indicator v6 TrendMoving averages
Updated 4 months ago · MIT GitHub repository of Volume Weighted Trend [QuantAlgo]
7 stars

ACCVOL 1j (SMA5 + SMA10) - AD/B is a price chart overlay indicator designed to identify volume accumulation and bullish swing trading setups. It evaluates current bar price gains, volume expansion, and volume relative to a moving average against historical pri

Indicator v6 VolumeMoving averages
Updated 3 months ago · None stated GitHub repository of ACCVOL 1j (SMA5 + SMA10) - AD/B

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