Indicator · Pine Script v4 · On the chart

EMA with Volume Weighted EMA

by 0xRadicalEd· code credited to Flapjackcoin

This indicator plots an exponential moving average of close and a volume-weighted exponential moving average on the price chart.

View on GitHub

GitHub stars2on the repository
Pine versionv4older, still runs
Lines of code34
Settings2inputs
LicenceNone statedfile: MPL-2.0
Last update2 years ago4 Aug 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

34 lines of Pine Script v4 from src/pinelogs/ema-trend-predict.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

ema-trend-predict.txt
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Flapjackcoin

//@version=4
study(title="EMA with Volume Weighted EMA", shorttitle="EMA & VWEMA", overlay = true)

// EMA Parameters
emaLength = input(14, title="EMA Length")
emaSource = close
emaLine = ema(emaSource, emaLength)

// Volume Weighted EMA Parameters
vwemaLength = input(14, title="VWEMA Length")
halfVolume = volume / 2
vwemaSource = close * halfVolume
vwemaLine = ema(vwemaSource, vwemaLength) / ema(halfVolume, vwemaLength)

// Detect Trend Changes
emaCrossUp = crossover(emaLine, vwemaLine)
emaCrossDown = crossunder(emaLine, vwemaLine)

// Change VWEMA color based on trend
vwemaColor = emaCrossUp ? color.green : emaCrossDown ? color.red : color.rgb(245, 182, 11)

// Plot EMA
plot(emaLine, color=color.blue, title="EMA Line", linewidth=3)


// Plot Circles on VWEMA
plotshape(series=vwemaLine, location=location.absolute, style=shape.circle, color=vwemaColor, title="VWEMA Circles")

// Plot Arrows
plotshape(series=emaCrossUp, location=location.belowbar, color=color.green, style=shape.triangleup, title="Up Trend Arrow")
plotshape(series=emaCrossDown, location=location.abovebar, color=color.red, style=shape.triangledown, title="Down Trend Arrow")

Overview

EMA with Volume Weighted EMA builds the volume-weighted line from close multiplied by half the bar volume, divided by an exponential average of that half volume. Green and red circles mark the volume-weighted line when the two averages cross, and orange circles mark other bars. Triangle arrows appear below or above bars on those crosses. Length inputs change both averages. It does not place trades or set exits.

Details

Published by

0xRadicalEd on GitHub

Code credit

Flapjackcoin, as written in the script's header

Type

Indicator, Pine Script v4

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
EMA Lengthint14emaLength
VWEMA Lengthint14vwemaLength
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 3 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