Indicator · Pine Script v6 · Own pane

[TVT] OBV with EMA

by namuan

Calculates On-Balance Volume (OBV) alongside two Exponential Moving Averages (EMAs) applied directly to the cumulative OBV line.

View on GitHub

GitHub stars321on the repository
Pine versionv6current
Lines of code16
Settings2inputs
LicenceMIT
Last update8 days ago16 Nov 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

16 lines of Pine Script v6 from tv-scripts/tvt-obv-ema-crossover.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

tvt-obv-ema-crossover.pine
//@version=6
indicator(title="[TVT] OBV with EMA", shorttitle="[TVT] OBV+EMA", precision=0, format=format.volume)

src = close
len1 = input.int(5, minval=1, title="Length EMA 1")
len2 = input.int(13, minval=1, title="Length EMA 2")

changesrc = ta.change(src)
obv = ta.cum(changesrc > 0 ? volume : changesrc < 0 ? -volume : 0 * volume)

ema1 = ta.ema(obv, len1)
ema2 = ta.ema(obv, len2)

plot(obv, title="OBV", color=#97c49a, linewidth=2)
plot(ema1, title="EMA 1", color=#ef5350, linewidth=1)
plot(ema2, title="EMA 2", color=#2196f3, linewidth=1)

Overview

The indicator tracks volume flow relative to price movement and smooths it using short-term and longer-term EMAs to highlight volume momentum trends and potential moving average crossovers. Users can adjust the lengths for both OBV EMAs. The indicator renders all three lines in a separate pane.

Details

Published by

namuan on GitHub

Draws

Separate pane below the chart

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.

Topics

dtaleearnings-calendarmarket-analysisoptions-tradingstock-market-analysistelegram-bottrading-strategies

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Length EMA 1int5len1
Length EMA 2int13len2
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

Aggregate Signal (v.2)

by capissimo
114 stars

Aggregate Signal (v.2) is an oscillator indicator that combines multiple technical factors into a single composite score. It scales OHLCV data using minimax normalization and evaluates indicators such as MACD, RSI, Stochastic, CCI, Momentum, On-Balance Volume,

Indicator v4 Oscillators & momentumMoving averages Repaints
Updated 2 years ago · None stated GitHub repository of Aggregate Signal (v.2)

Volume-Weighted MACD

by mihakralj
99 stars

This indicator plots a volume-weighted MACD in a separate pane. It subtracts a slow volume-weighted moving average of close from a faster one, then smooths that line with an exponential moving average to form the signal. A column histogram shows the gap betwee

Indicator v5 Oscillators & momentumMoving averages
Updated 8 weeks ago · Apache-2.0 GitHub repository of Volume-Weighted MACD

PPO ATR Bands

by cryptorife
75 stars

PPO ATR Bands plots a percentage price oscillator in a separate pane. It compares a Hull average of typical price with a volume-weighted exponential average of Parabolic SAR, then scales three true-range bands around the slow average into matching oscillator l

Indicator v4 Oscillators & momentumMoving averages
Updated 3 years ago · GPL-3.0 GitHub repository of PPO ATR Bands

RSI-VWMA

by Zettt
43 stars

This indicator calculates the Relative Strength Index using a volume-weighted moving average of the closing price as its source. It plots the resulting oscillator in a separate pane alongside configurable overbought and oversold threshold lines. The plot line

Indicator v4 Oscillators & momentumMoving averages
Updated 1 year ago · None stated GitHub repository of RSI-VWMA

Trap Shorts - Hamza Naveed

by ProfHamzaNaveed
43 stars

This indicator tracks and visualizes cryptocurrency net positioning across multiple derivative exchanges, including Binance, BitMEX, and Kraken. It calculates aggregated net longs, net shorts, net delta, and ratio metrics, or an optional Position RSI, renderin

Indicator v5 VolumeOscillators & momentum
Updated 10 months ago · None stated GitHub repository of Trap Shorts - Hamza Naveed
34 stars

MACD-X, More Than MACD by DGT is an advanced multi-engine oscillator that extends classic MACD calculations. It supports five calculation modes, including traditional fast/slow EMA differences, histogram slope momentum, leader bias, source-smoothed, and TRIX e

Indicator v6 Oscillators & momentumVolume
Updated 2 weeks ago · MIT GitHub repository of MACD-X, More Than MACD by DGT

More Volume scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers