Indicator · Pine Script v4 · On the chart

VWMA Band

by tistaharahap· code credited to tista

The VWMA Band indicator calculates volume-weighted moving averages based on high, low, median (HL2), and close prices over a specified period.

View on GitHub

GitHub stars25on the repository
Pine versionv4older, still runs
Lines of code30
Settings3inputs
LicenceNone statedfile: MPL-2.0
Last update6 years ago29 Jun 2020

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

30 lines of Pine Script v4 from bands/vwma-bands.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

vwma-bands.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © tista

//@version=4
study("VWMA Band", overlay=true)

vwmaPeriod = input(title="VWMA Period", defval=5)
showVwmaBand = input(title="Show VWMA Band", defval=true)
minThreshold = input(title="Minimum Threshold", defval=26.0)

vwmaHigh = vwma(high, vwmaPeriod)
vwmaLow = vwma(low, vwmaPeriod)
vwmaHl2 = vwma(hl2, vwmaPeriod)
vwmaClose = vwma(close, vwmaPeriod)
diff = vwmaHigh - vwmaLow

closeUnderHL2 = crossunder(vwmaClose, vwmaHl2) and open > vwmaClose and diff >= minThreshold ? -1 : na
closeOverHL2 = crossover(vwmaClose, vwmaHl2) and open < vwmaClose and diff >= minThreshold ? 1 : na

alertcondition(closeUnderHL2, title="VWMA Band - Short", message="VWMA Close just crossed under VWMA HL2, time to short.")
alertcondition(closeOverHL2, title="VWMA Band - Long", message="VWMA Close just crossed over VWMA HL2, time to long.")

bandHigh = plot(showVwmaBand ? vwmaHigh : na, title="VWMA High", color=color.white, linewidth=1, transp=80)
bandLow = plot(showVwmaBand ? vwmaLow : na, title="VWMA Low", color=color.white, linewidth=1, transp=80)
plot(showVwmaBand ? vwmaHl2 : na, title="VWMA HL2", color=color.white, linewidth=1, transp=80)
plot(vwmaClose, title="VWMA Close", color=color.blue, linewidth=2, transp=0)

plotarrow(closeUnderHL2, title="Close Under HL2", colordown=color.orange, colorup=color.green, maxheight=15)
plotarrow(closeOverHL2, title="Close Over HL2", colordown=color.orange, colorup=color.green, maxheight=15)
fill(bandLow, bandHigh, title="VWMA Band", color=color.white, transp=95)

Overview

VWMA Band plots an upper band, lower band, median line, and close VWMA directly on the main price chart with a translucent channel fill. Directional signals and alerts trigger when the VWMA close crosses over or under the median VWMA, provided the spread between upper and lower bands meets a minimum threshold filter. Inputs allow customization of the VWMA period, minimum threshold, and band visibility.

Details

Published by

tistaharahap on GitHub

Code credit

tista, as written in the script's header

Type

Indicator, Pine Script v4

Draws

On the price chart

Category

Moving averages, Volatility & bands, Trend

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
VWMA Periodint5vwmaPeriod
Show VWMA BandbooltrueshowVwmaBand
Minimum Thresholdfloat26.0minThreshold
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 yesterday · 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