Files
QuanTAlib/lib/volume/adl/adl.pine
T
Miha Kralj 24e86d762a Add documentation links for various volatility indicators and channels
- Updated BBWN, BBWP, CCV, CV, CVI, EWMA, GKV, HLV, HV, Jvolty, JVOLTYN, MASSI, NATR, RSV, RV, RVI, TR, UI, VOV, VR, YZV indicators with documentation links.
- Added documentation links for Aberration, Acceleration Bands, Andrews' Pitchfork, Adaptive Price Zone, ATR Bands, Bollinger Bands, Center of Gravity, Donchian Channels, Decay Min-Max Channel, Detrended Synthetic Price, EACP, EBSW, HOMOD, Jurik Volatility Bands, Keltner Channel, MA Envelope, Min-Max Channel, Price Channel, Regression Channels, Standard Deviation Channel, Stoller Average Range Channel, Super Trend Bands, Ultimate Bands, Ultimate Channel, VWAP Bands, and VWAP with Standard Deviation Bands.
2026-02-18 11:55:48 -08:00

29 lines
1.2 KiB
Plaintext

// The MIT License (MIT)
// © mihakralj
//@version=6
indicator("Accumulation/Distribution Line (ADL)", "ADL", overlay=false)
//@function Calculates the Accumulation/Distribution Line (ADL), a volume-based indicator that measures money flow into and out of a security
//@param src_high The high price (default: built-in high)
//@param src_low The low price (default: built-in low)
//@param src_close The close price (default: built-in close)
//@param src_vol The volume (default: built-in volume)
//@returns The cumulative ADL value representing buying/selling pressure
adl(src_high = high, src_low = low, src_close = close, src_vol = volume) =>
float mfm = 0.0
if not na(src_high) and not na(src_low) and not na(src_close)
mfm := (src_close - src_low) - (src_high - src_close)
mfm := src_high != src_low ? mfm / (src_high - src_low) : 0.0
float mfv = na(src_vol) ? 0.0 : src_vol * mfm
var float cumulativeSum = 0.0
cumulativeSum := na(mfv) ? cumulativeSum : cumulativeSum + mfv
cumulativeSum
// ---------- Inputs ----------
// ---------- Calculations ----------
adl_val = adl(high, low, close, volume)
// ---------- Plotting ----------
plot(adl_val, "ADL", color=color.yellow, linewidth=2)