Skip to main content
Ctrl+K

screamer 0.12.0 documentation

  • Using screamer
  • Functions
  • Examples
  • References
  • Changelog
  • GitHub
  • PyPI
  • Using screamer
  • Functions
  • Examples
  • References
  • Changelog
  • GitHub
  • PyPI

Section Navigation

  • Statistics
    • AD
    • AmihudIlliquidity
    • ATR
    • BayesianRegression
    • BollingerBands
    • CumMax
    • CumMin
    • CumProd
    • CumSum
    • Detrend
    • Drawdown
    • EwBeta
    • EwCorr
    • EwCov
    • EwGarmanKlassVar
    • EwGarmanKlassVol
    • EwKurt
    • EwKyleLambda
    • EwMean
    • EwParkinsonVar
    • EwParkinsonVol
    • EwRms
    • EwRogersSatchellVar
    • EwRogersSatchellVol
    • EwSkew
    • EwStd
    • EwVar
    • EwZscore
    • ExpandingKurt
    • ExpandingMax
    • ExpandingMean
    • ExpandingMin
    • ExpandingProd
    • ExpandingSkew
    • ExpandingStd
    • ExpandingSum
    • ExpandingVar
    • First
    • KeltnerChannels
    • Last
    • Linear
    • MaxDrawdown
    • NATR
    • OBV
    • RollingAlpha
    • RollingArgmax
    • RollingArgmin
    • RollingBeta
    • RollingCorr
    • RollingCov
    • RollingDownsideDeviation
    • RollingGarmanKlassVar
    • RollingGarmanKlassVol
    • RollingHurst
    • RollingIqr
    • RollingKurt
    • RollingKyleLambda
    • RollingLinearRegression
    • RollingMad
    • RollingMax
    • RollingMean
    • RollingMedian
    • RollingMedianAD
    • RollingMin
    • RollingMinMax
    • RollingOU
    • RollingParkinsonVar
    • RollingParkinsonVol
    • RollingPercentile
    • RollingPoly1
    • RollingQuantile
    • RollingRange
    • RollingRank
    • RollingResidualStd
    • RollingRms
    • RollingRogersSatchellVar
    • RollingRogersSatchellVol
    • RollingSkew
    • RollingSpread
    • RollingStd
    • RollingSum
    • RollingTSF
    • RollingVar
    • RollingYangZhangVar
    • RollingYangZhangVol
    • RollingZscore
    • TrueRange
  • Smoothing & filters
    • Butter
    • ButterBandpass
    • ButterBandstop
    • ButterHighpass
    • DEMA
    • Hampel
    • HullMA
    • KalmanFilter
    • KAMA
    • MovingAverage
    • RollingPoly2
    • SchmittTrigger
    • TEMA
    • TRIMA
    • WMA
  • Technical indicators
    • ADOSC
    • ADX
    • BOP
    • CCI
    • Diff
    • Diff2
    • DonchianChannels
    • ExpandingSlope
    • Lag
    • LogReturn
    • MACD
    • MFI
    • Momentum
    • Return
    • ROC
    • ROCP
    • ROCR
    • RollingRSI
    • RollingVWAP
    • Stoch
    • StochRSI
    • TRIX
    • UltimateOscillator
    • WilliamsR
  • Market microstructure
    • BulkVolumeClassifier
    • ContOFI
    • EffectiveSpread
    • HawkesIntensity
    • LeeReadySign
    • MicroPrice
    • OFI
    • Propagator
    • QueueImbalance
    • RealizedSpread
    • RollingOrderImbalance
    • RollSpread
    • SignedVolume
    • TickRuleSign
    • VPIN
  • Backtesting & risk
    • backtest_report
    • BacktestL1Orders
    • BacktestL1Target
    • BacktestL1TradesOrders
    • BacktestOHLCOrders
    • BacktestOHLCTarget
    • BacktestPriceTarget
    • BacktestReport
    • BacktestTradesOrders
    • BacktestTradesTarget
    • Choosing a backtest engine
    • RollingCalmar
    • RollingCVaR
    • RollingHitRate
    • RollingInfoRatio
    • RollingMaxDrawdown
    • RollingOmega
    • RollingSharpe
    • RollingSortino
  • Math & logic
    • Abs
    • Acos
    • Add
    • And
    • Asin
    • Atan
    • Atan2
    • Cart2Polar
    • Ceil
    • Clip
    • Cos
    • Cube
    • Div
    • Elu
    • Equal
    • Erf
    • Erfc
    • Exp
    • Floor
    • GreaterEqual
    • GreaterThan
    • Hypot
    • Identity
    • IsFinite
    • IsNan
    • LessEqual
    • LessThan
    • Linear2
    • Log
    • Mul
    • NegPart
    • Not
    • NotEqual
    • Or
    • Polar2Cart
    • PosPart
    • Power
    • Relu
    • Round
    • Selu
    • Sigmoid
    • Sign
    • Sin
    • Softsign
    • Sqrt
    • Square
    • Sub
    • Tanh
    • Where
  • Data preparation
    • Dropna
    • Ffill
    • FillNa
    • ImpulseClip
    • RollingSigmaClip
  • Streaming & pipelines
    • CombineLatest
    • Delay
    • Filter
    • from_pandas
    • Merge
    • Pipeline
    • Resample
    • Select
    • split
    • Stream tuple convention
    • to_pandas
  • Machine learning
    • forecast_pairs
  • Functions
  • Statistics
  • AD

AD#

Description#

Chaikin Accumulation/Distribution Line:

\[ \text{CLV}[t] = \dfrac{(C - L) - (H - C)}{H - L} \qquad \text{AD}[t] = \text{AD}[t-1] + \text{CLV}\ \cdot\ V[t] \]

The "close location value" is in [-1, +1]: +1 means close at the high (full accumulation), -1 at the low (full distribution). When high == low the CLV is undefined and the AD line is unchanged (TA-Lib's convention).

4-input, 1-output on (high, low, close, volume). Cumulative; no window. Bit-exact to talib.AD.

NaN handling#

Policy: ignore. A NaN in any input at index t causes the function to skip that step: output at t is NaN and internal state is unchanged. Subsequent finite samples are processed as if step t had not occurred.

Examples#

Usage example#

import numpy as np
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from screamer import AD

np.random.seed(0)
close = 100*np.exp(np.cumsum(np.random.normal(0, 0.01, size=300)))
open_ = np.concatenate([[close[0]], close[:-1]])
wick = np.abs(np.random.normal(0, 0.4, size=300))
high = np.maximum(open_, close) + wick
low  = np.minimum(open_, close) - wick
volume = np.random.uniform(1e5, 5e5, size=300)
out = AD()(high, low, close, volume)

fig = make_subplots(rows=2, cols=1, shared_xaxes=True,
                    row_heights=[0.55, 0.45], vertical_spacing=0.08)
fig.add_trace(go.Scatter(y=close, name="close", line=dict(color="royalblue")), row=1, col=1)
fig.add_trace(go.Scatter(y=out, name="AD line", line=dict(color="red")), row=2, col=1)
fig.update_layout(title="Accumulation/distribution line (AD)",
                  margin=dict(l=20, r=20, t=60, b=20),
                  legend=dict(orientation="h", yanchor="bottom", y=1.02, xanchor="right", x=1))
fig.update_yaxes(title_text="close", row=1, col=1)
fig.update_yaxes(title_text="AD line", row=2, col=1)
fig.show()

previous

Statistics

next

AmihudIlliquidity

On this page
  • Description
  • NaN handling
  • Examples
    • Usage example

© Copyright 2026, Thijs van den Berg.

Created using Sphinx 9.1.0.

Built with the PyData Sphinx Theme 0.20.0.