Skip to content

AverageDirectionalIndex


class backtide.indicators.AverageDirectionalIndex(period=14)

Average Directional Index (ADX).

Quantifies trend strength on a scale of 0 to 100, regardless of direction. Values above 25 generally indicate a strong trend; below 20, a weak or ranging market. Useful for determining whether a market is trending or ranging before applying trend-following or mean-reversion strategies.

Formula:

\[ \begin{aligned} +DI_t &= 100 \cdot \frac{Smoothed(+DM_t)}{ATR_t} \\\\ -DI_t &= 100 \cdot \frac{Smoothed(-DM_t)}{ATR_t} \\\\ DX_t &= 100 \cdot \frac{|+DI_t - (-DI_t)|}{+DI_t + (-DI_t)} \\\\ ADX_t &= EMA_n(DX_t) \end{aligned} \]

Read more on Wikipedia.

Parameters

period : int, default=14

Look-back window length.

Attributes

acronym : str

Short ticker-style acronym.

name : str
Human-readable indicator name.


See Also

AverageTrueRange

Average True Range (ATR).

MovingAverageConvergenceDivergence

Moving Average Convergence Divergence (MACD).

RelativeStrengthIndex

Relative Strength Index (RSI).


Methods

compute Compute the indicator on a dataset.
description Short explanation of what the indicator measures.


method backtide.indicatorscompute(data)

Compute the indicator on a dataset.

Parameters

data : np.ndarray | pd.DataFrame | pl.DataFrame

Historical OHLCV data.

Returns

np.ndarray | pd.Series | pl.Series | pd.DataFrame | pl.DataFrame

The computed values. For multi-output indicators (e.g., upper and lower bounds), return a 2d structure.



method backtide.indicatorsdescription()

Short explanation of what the indicator measures.

Returns

str

The description.