Indicator · Pine Script v6 · On the chart

Volatility Adjusted Cloud

by vedkanani123· code credited to LyroRS

An overlay indicator that draws a cloud around a VIDYA, a volatility-adaptive moving average.

View on GitHub

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

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

6.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 Adjusted Cloud | Lyro RS", "VAD Cloud | Lyro RS", overlay = true)


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


// Library
import TradingView/ta/9 as ta
import LyroRS/LMAs/1 as DynamicMA


// Input Groups
indi_settings_g  = "𝗜𝗡𝗗𝗜𝗖𝗔𝗧𝗢𝗥 𝗦𝗘𝗧𝗧𝗜𝗡𝗚𝗦"
bb_g             = "𝗩𝗔 𝗖𝗟𝗢𝗨𝗗"
colors_g         = "𝗖𝗢𝗟𝗢𝗥𝗦"


// Inputs

// -- Indicator Settings
source        = input.source(close, "Source", tooltip="Select the price source (e.g., close, open, high, low) used for calculations.", group=indi_settings_g)
midline_only  = input.bool(false,   "Midline Only", tooltip="When enabled, hides the upper/lower bands and cloud fill — showing only the VIDYA midline.", group=indi_settings_g)


// -- VAD Cloud
len_V_bb     = input.int(25,    "VIDYA Length",       tooltip="The lookback period for the VIDYA calculation.", group=bb_g)
len_VHist_bb = input.int(35,    "SD History Length",  tooltip="The lookback period for the standard deviation history used in VIDYA smoothing constant.", group=bb_g)
vidya_multp  = input.float(1.5, "+ Multiplier",       tooltip="A multiplier applied to the VIDYA deviation to create the upper VAD Cloud band.", group=bb_g)
vidya_multn  = input.float(0.7, "- Multiplier",       tooltip="A multiplier applied to the VIDYA deviation to create the lower VAD Cloud band.", group=bb_g)
cloud_transp = input.int(80,    "Cloud Transparency", minval=0, maxval=100, tooltip="Transparency of the cloud fill between the upper and lower bands.", group=bb_g)


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


// Table


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


// VIDYA Function
vidya_calc(src, length, hist_length) =>
    SC   = 2.0 / (length + 1)
    SD_V = ta.stdev(src, length) / ta.stdev(src, hist_length)
    v    = 0.0
    v   := nz(SD_V * SC * src + (1 - SD_V * SC) * v[1], 0)
    v


// Final Processing

// VIDYA baseline
avg_bb       = vidya_calc(source, len_V_bb, len_VHist_bb)

// VIDYA-smoothed deviation
vidya_dev_bb = vidya_calc(math.abs(source - avg_bb), len_V_bb, len_VHist_bb)

// Bands
bb_positive_band = avg_bb + (vidya_dev_bb * vidya_multp)
bb_negative_band = avg_bb - (vidya_dev_bb * vidya_multn)


// Score
var int score    = 0
var int bb_score = 0

if ta.crossover(source, bb_positive_band)
    bb_score := 1
    score    := 1

if ta.crossunder(source, bb_negative_band)
    bb_score := -1
    score    := -1


// Plot Colors
pc      = score    == 1 ? UpC : score    == -1 ? DnC : color.gray
pc_bb   = bb_score == 1 ? UpC : bb_score == -1 ? DnC : color.gray
cloud_c = color.new(pc_bb, cloud_transp)

// Band display — hidden when midline_only is true
band_display = midline_only ? display.none : display.pane + display.price_scale
fill_color   = midline_only ? color.new(color.black, 100) : cloud_c


// Plots

// -- VAD Cloud Bands (hidden when midline_only = true)
upper = plot(bb_positive_band, color=color.new(UpC, 50), title="VAD Upper Band", display=band_display, force_overlay=true)
lower = plot(bb_negative_band, color=color.new(DnC, 50), title="VAD Lower Band", display=band_display, force_overlay=true)

// -- Cloud Fill (fully transparent when midline_only = true)
fill(upper, lower, color=fill_color, title="VAD Cloud Fill")


// -- VIDYA Midline (always visible)
avgbbbb = plot(DynamicMA.ALMA(avg_bb, 20, 0, 20), color=pc_bb,                title="VIDYA Line",        force_overlay=true)
plot(DynamicMA.ALMA(avg_bb, 20, 0, 20), color=color.new(pc_bb, 85), title="VIDYA Glow Effect", linewidth=10, force_overlay=true, display= midline_only == false ? display.pane : display.none)
fill(avgbbbb, plot(close, force_overlay = true, display = display.none, editable = false), avg_bb, close, color.new(pc, 25), color.new(chart.bg_color, 75), display = midline_only == true ? display.all : display.none)


// -- Signals
plotshape(ta.crossover(score, 0),  title="Buy Signal",  location=location.belowbar, style=shape.labelup,   text="𝓛𝓸𝓷𝓰",  textcolor=#000000, size=size.small, color=UpC, force_overlay=true, display=display.pane)
plotshape(ta.crossunder(score, 0), title="Sell Signal", location=location.abovebar, style=shape.labeldown, text="𝓢𝓱𝓸𝓻𝓽", textcolor=#000000, size=size.small, color=DnC, force_overlay=true, display=display.pane)


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


// Alerts
alertcondition(score == 1  and score[1] != 1,  "VAD Cloud Trend - Long",  "Volatility Adjusted Cloud Trend is Long {{exchange}}:{{ticker}}")
alertcondition(score == -1 and score[1] != -1, "VAD Cloud Trend - Short", "Volatility Adjusted Cloud Trend is Short {{exchange}}:{{ticker}}")

Overview

Cloud width comes from the standard deviation of price over a history window, with separate positive and negative multipliers for the upper and lower edges. The cloud and midline change color with trend direction, an option can show the midline only, and cloud transparency and color palettes are adjustable. It plots on the price chart.

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

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
Midline Onlyboolfalsemidline_only
VIDYA Lengthint25len_V_bb
SD History Lengthint35len_VHist_bb
+ Multiplierfloat1.5vidya_multp
- Multiplierfloat0.7vidya_multn
Cloud Transparencyint80cloud_transp
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

318 stars

This indicator plots four customizable moving averages directly on the main price chart using default lengths of 3, 8, 21, and 50 periods. It fills the space between adjacent averages in green or maroon depending on trend alignment. Additionally, it computes B

Indicator v5 Moving averagesTrend
Updated 2 months ago · MIT GitHub repository of Multiple Moving Averages

NVDA Trend Ribbon

by longsurf-ai
277 stars

This indicator plots three exponential moving averages and ATR volatility envelopes on the price chart. It compares the fast and slow EMAs to shade a trend ribbon and marks confirmed upward and downward crossovers with triangle labels. Settings change the thre

Indicator v6 TrendMoving averages
Updated 2 days ago · MIT GitHub repository of NVDA Trend Ribbon

Bollinger Bands Force

by harryguiacorn
219 stars

This indicator modifies standard Bollinger Bands to measure directional trend force based on line alignment. It calculates a simple moving average basis along with upper and lower volatility bands. When all three lines move upward or downward simultaneously, i

Indicator v5 Volatility & bandsTrend
Updated 1 year ago · None stated GitHub repository of Bollinger Bands Force

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

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