Skip to main content
Indicators that analyze trading volume to confirm price movements and identify potential reversals.

Overview

FunctionDescription
obv()On-Balance Volume - cumulative volume based on price direction
mfi()Money Flow Index - volume-weighted RSI
vwap()Volume Weighted Average Price - average price weighted by volume

obv()

On-Balance Volume - running total of volume, adding on up days and subtracting on down days.

Signature

obv(source: TimeSeries): number

Parameters

ParameterTypeDescription
sourceTimeSeriesOHLCV data series

Returns

number - Cumulative OBV value

Example

//@version=2

define(title="OBV Indicator", position="offchart", axis=true);

timeseries ohlcvData = ohlcv(symbol=currentSymbol, exchange=currentExchange);

var obvValue = obv(source=ohlcvData);

plotLine(value=obvValue, width=2, colors=["blue"], label=["OBV"], desc=["On-Balance Volume"]);

mfi()

Money Flow Index - oscillator that uses both price and volume to measure buying and selling pressure.

Signature

mfi(source: TimeSeries, period?: number = 14): number

Parameters

ParameterTypeDescription
sourceTimeSeriesOHLCV data series
periodnumberCalculation period (default: 14)

Returns

number - MFI value between 0-100

Interpretation

MFI ValueSignal
> 80Overbought (potential sell)
< 20Oversold (potential buy)

Example

//@version=2

define(title="MFI Indicator", position="offchart", axis=true);

timeseries ohlcvData = ohlcv(symbol=currentSymbol, exchange=currentExchange);

var mfiValue = mfi(source=ohlcvData, period=14);

// Color based on overbought/oversold
var colorIndex = mfiValue > 80 ? 0 : (mfiValue < 20 ? 1 : 2);

plotLine(value=mfiValue, width=2, colors=["red", "green", "blue"], colorIndex=colorIndex, label=["MFI"], desc=["Money Flow Index"]);
hline(value=80, color="red", width=1, style="dashed", label="Overbought");
hline(value=20, color="green", width=1, style="dashed", label="Oversold");

vwap()

Volume Weighted Average Price - average price weighted by volume, typically reset daily.

Signature

vwap(source: TimeSeries): number

Parameters

ParameterTypeDescription
sourceTimeSeriesOHLCV data series

Returns

number - VWAP value

Example

//@version=2

define(title="VWAP", position="onchart", axis=false);

timeseries ohlcvData = ohlcv(symbol=currentSymbol, exchange=currentExchange);

var vwapValue = vwap(source=ohlcvData);

plotLine(value=vwapValue, width=2, colors=["purple"], label=["VWAP"], desc=["Volume Weighted Average Price"]);

Tips

Volume Confirmation

Use volume indicators to confirm price movements. Strong trends should be accompanied by increasing volume.

Divergence

Watch for divergences between price and volume indicators. Price making new highs with declining OBV can signal weakness.

VWAP as Support/Resistance

VWAP often acts as dynamic support in uptrends and resistance in downtrends. Institutional traders frequently use VWAP for entries.

Multiple Indicators

Combine volume indicators with price-based indicators for more reliable signals.