Indicator · Pine Script v4 · On the chart

RSTEmaVwap

by readysetcryptocodes· code credited to mrx_the_unknown

This indicator overlays exponential moving averages and a session VWAP on the price chart.

View on GitHub

GitHub stars43on the repository
Pine versionv4older, still runs
Lines of code99
Settings3inputs
LicenceNone statedfile: MPL-2.0
Last update2 years ago2 Jul 2024

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

99 lines of Pine Script v4 from scripts/RST_EmaVwap.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

RST_EmaVwap.txt
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © mrx_the_unknown

//@version=4
study(title="RSTEmaVwap", shorttitle="RSTEmaVwap", overlay=true)

showVwap = input(true, title="Show VWAP?")
showVwapStdev = input(true, title="Show VWAP Standard Deviations?")
showEmas = input(true, title="Show EMAs?")

var float ema200 = na
var float ema50 = na
var float ema21 = na
var float ema8 = na

var float sema200 = na
var float sema50 = na
var float vwapStdDev1Upper = na
var float vwapStdDev1Lower = na
var float vwapStdDev2Upper = na
var float vwapStdDev2Lower = na


t = time("D")
start = na(t[1]) or t > t[1]

float sumSrc = na
float sumVol = na
float sumVol2 = na

sumSrc := start ? hlc3 * volume : hlc3 * volume + sumSrc[1]
sumVol := start ? volume : volume + sumVol[1]
sumVol2 := start ? volume * hlc3 * hlc3 : volume * hlc3 * hlc3 + sumVol2[1]
vwapDaily = sumSrc / sumVol
dev = sqrt(max(sumVol2/sumVol - vwapDaily * vwapDaily, 0))

vwapDaily := na

if (timeframe.period == "D")
    sema200 := (ema(close, 200) + sma(close, 200)) / 2
    sema50 := (ema(close, 50) + sma(close, 50)) / 2
    vwapDaily := na

if (timeframe.isintraday)    
    ema200length = 45 / timeframe.multiplier * 200
    ema50length = 45 / timeframe.multiplier * 50
    ema200 := ema(close, ema200length)
    ema50 := ema(close, ema50length)

if (timeframe.period == "30")
    ema21 := na
    //ema21 := ema(close, 32)
    //ema8 := ema(close, 12)
    //vwapDaily := vwap
    //vwapStdDev1Upper := vwapDaily + dev
    //vwapStdDev1Lower := vwapDaily - dev
    //vwapStdDev2Upper := vwapDaily + dev * 2
    //vwapStdDev2Lower := vwapDaily - dev * 2

else if (timeframe.period == "15")
    ema21 := ema(close, 21)
    ema8 := ema(close, 8)
    vwapDaily := sumSrc / sumVol
    vwapStdDev1Upper := vwapDaily + dev
    vwapStdDev1Lower := vwapDaily - dev
    vwapStdDev2Upper := vwapDaily + dev * 2
    vwapStdDev2Lower := vwapDaily - dev * 2
    
else if (timeframe.period == "5")
    ema21 := ema(close, 21)
    ema8 := ema(close, 8)
    vwapDaily := sumSrc / sumVol
    vwapStdDev1Upper := vwapDaily + dev
    vwapStdDev1Lower := vwapDaily - dev
    vwapStdDev2Upper := vwapDaily + dev * 2
    vwapStdDev2Lower := vwapDaily - dev * 2
    
else if (timeframe.period == "3")
    ema21 := ema(close, 35)
    ema8 := ema(close, 13)
    vwapDaily := sumSrc / sumVol
    vwapStdDev1Upper := vwapDaily + dev
    vwapStdDev1Lower := vwapDaily - dev
    vwapStdDev2Upper := vwapDaily + dev * 2
    vwapStdDev2Lower := vwapDaily - dev * 2

plot(showEmas ? ema8 : na, title="EMA8", color=color.aqua, linewidth=2, transp=0)
plot(showEmas ? ema21 : na, title="EMA21", color=color.yellow, linewidth=2, transp=0)
plot(showEmas ? ema50 : na, title="EMA50", color=color.purple, linewidth=2, transp=0)
plot(showEmas ? ema200 : na, title="EMA200", color=color.red, linewidth=2, transp=0)
plot(showEmas ? sema50 : na, title="SEMA50", color=color.purple, linewidth=2, transp=0)
plot(showEmas ? sema200 : na, title="SEMA200", color=color.red, linewidth=2, transp=0)
plot(showVwap ? vwapDaily : na, title="VwapDaily", color=color.white, linewidth=1, transp=0)
vwapStdDev1UpperPlot = plot(showVwapStdev ? vwapStdDev1Upper : na, title="VwapStdDev1Upper", color=color.gray, linewidth=1, transp=0)
vwapStdDev1LowerPlot = plot(showVwapStdev ? vwapStdDev1Lower : na, title="VwapStdDev1Lower", color=color.gray, linewidth=1, transp=0)
vwapStdDev2UpperPlot = plot(showVwapStdev ? vwapStdDev2Upper : na, title="VwapStdDev2Upper", color=color.gray, linewidth=1, transp=0)
vwapStdDev2LowerPlot = plot(showVwapStdev ? vwapStdDev2Lower : na, title="VwapStdDev2Lower", color=color.gray, linewidth=1, transp=0)
fill(vwapStdDev1UpperPlot, vwapStdDev2UpperPlot)
fill(vwapStdDev1LowerPlot, vwapStdDev2LowerPlot)

Overview

RSTEmaVwap builds a daily VWAP from typical price and volume, then plots one- and two-standard-deviation bands around it on selected intraday charts. EMA lengths change by timeframe: short EMAs on three-, five-, and fifteen-minute charts, scaled longer EMAs on other intraday charts, and blended EMA-SMA lines on the daily chart. Three inputs hide the EMAs, the VWAP, or the deviation bands. It does not generate entries or exits.

Details

Published by

readysetcryptocodes on GitHub

Code credit

mrx_the_unknown, as written in the script's header

Type

Indicator, Pine Script v4

Draws

On the price chart

Category

Moving averages, Volume, Volatility & bands

Markets

Any symbol

Timeframes

M1-M5, M15-H1, H4 and above

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
Show VWAP?booltrueshowVwap
Show VWAP Standard Deviations?booltrueshowVwapStdev
Show EMAs?booltrueshowEmas
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

Snag - VWAP

by dearvn
257 stars

This indicator plots a custom Anchored Volume-Weighted Average Price (VWAP) directly on the price chart along with optional standard deviation bands. Users can anchor the VWAP to standard time periods like sessions, weeks, or months, or to corporate events suc

Indicator v5 Moving averagesVolatility & bands Repaints
Updated 6 weeks ago · None stated GitHub repository of Snag - VWAP

LiqSpikeBounceLong Feb2026

by agutinbaigo28
147 stars

LiqSpikeBounceLong Feb2026 is an indicator designed to identify long bounce entries following high-volume liquidation cascades in bearish market contexts. It checks if price is below an exponential moving average, then detects large single-bar drops exceeding

Indicator v5 Volatility & bandsVolume
Updated 6 weeks ago · MIT GitHub repository of LiqSpikeBounceLong Feb2026

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

BBW RSI 15 Study

by modster
32 stars

BBW RSI 15 Study is an overlay indicator designed for automated crypto trading via webhooks. It plots standard-deviation-adjusted Bollinger Bands directly on the price chart while calculating secondary metrics such as Stochastic RSI, volume moving averages, an

Indicator v4 Volatility & bandsVolume
Updated 3 years ago · None stated GitHub repository of BBW RSI 15 Study
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

This indicator overlays Bollinger Bands on the price chart and fills the area between upper and lower bands using a color based on Cumulative Volume Delta trend. It plots an EMA 9 line and fills between the EMA 9 and Bollinger basis in green or red depending o

Indicator v6 Volatility & bandsVolume
Updated 5 months ago · None stated GitHub repository of Deep Chart + BB (CVD Internal)

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