Indicator · Pine Script v5 · Own pane

VWAP Percent Distance

by francolla· code credited to EFRAN1812

VWAP Percent Distance calculates and plots the relative percentage difference between the closing price and the Volume Weighted Average Price (VWAP).

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code18
Settings1inputs
LicenceGPL-3.0
Last update2 years ago3 Jun 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

18 lines of Pine Script v5 from src/vwap-percent-d.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.

vwap-percent-d.pine
// The following code is licensed under the GNU General Public License v3.0
// Please see the README for more complete documentation of the indicator and how it works
// © EFRAN1812
//@version=5

// Set indicator title and input values
indicator(title="VWAP Percent Distance", shorttitle="VWAP %D")
MALength = input(14) // Set how many candles back will be inputted into the moving average

// Compute the distance between the current price and VWAP values
vwap = ta.vwap
price_vwap_dist = close - vwap
relative_vwap_dist = (price_vwap_dist / vwap) * 100

// Plot the data
hline(0, "Mid Line", color=color.new(#787B86, 50)) // Plots a neutral line at 0 as a reference
plot(relative_vwap_dist, color=color.aqua) // VWAP %D plot
plot(ta.sma(relative_vwap_dist, MALength), color=color.lime) // VWAP %D moving average plot

Overview

Designed as a mean-reversion tool, it helps traders measure how far price has stretched from VWAP in percentage terms across different assets. The indicator plots the percentage distance alongside a Simple Moving Average signal line and a zero reference line in a separate pane. Setting adjustments allow customization of the moving average length.

Details

Published by

francolla on GitHub

Code credit

EFRAN1812, as written in the script's header

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Mean reversion, 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
MALengthint14MALength
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

114 stars

Calculates normalized reversal metrics across up to ten Forex currency pairs using user-selected moving average methods, including HarmonicMA, EMA, SMA, or WMA. The indicator identifies overbought, oversold, and mean-crossing conditions using a configurable th

Indicator v4 Screeners & dashboardsMean reversion
Updated 1 year ago · None stated GitHub repository of Multi-Pair Trend Reversal Widget
47 stars

This indicator applies the hyperbolic tangent to a chosen source series and plots the result in a separate pane. It centers the transform on a 200-bar simple moving average of that source, multiplies the deviation by a steepness factor, and maps the output int

Indicator v6 Moving averagesMean reversion
Updated 8 months ago · MIT GitHub repository of Hyperbolic Tangent (TANH)

This indicator builds a channel from a Hull moving average of the source and an ATR scaled by a band multiplier, then normalizes price inside that channel into a 0 to 100 oscillator. It smooths the result with a weighted moving average and plots the line in a

Indicator v6 Mean reversionVolatility & bands
Updated 3 months ago · None stated GitHub repository of Radiant Mean Reversion Channels [Pineify]

RSI

by trsdn
6 stars

This indicator calculates the Relative Strength Index along with a 200-period simple moving average. It plots the RSI oscillator line alongside horizontal reference levels for overbought and oversold thresholds in a separate pane below the main price chart. Co

Indicator v5 Oscillators & momentumMoving averages
Updated 5 days ago · MIT GitHub repository of RSI

MACD x RSI Study

by jerryinyang
5 stars

This indicator combines MACD and RSI to generate pullback signals on forex pairs. It plots MACD line, signal line and histogram alongside RSI and Wave Trend oscillator. Higher-timeframe MACD provides trend bias while RSI identifies overbought and oversold zone

Indicator v4 Oscillators & momentumMoving averages
Updated 2 years ago · None stated GitHub repository of MACD x RSI Study
3 stars

This indicator estimates how many bars typically pass before a custom skew measure falls back below its exponential moving average. It builds the skew from smoothed upside and downside true-range deviations, then applies five fixed EMA lengths from 2 to 110. O

Indicator v5 Mean reversionMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of Average Bars Before Reversion

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