Extended

Extended Indicators — Popular indicators not in the TA-Lib standard set.

All indicator logic is implemented in Rust (PyO3) for maximum performance. This module provides the public Python API with: - Input validation - _to_f64 conversion - pandas/polars-compatible return values (numpy arrays)

Functions

VWAP — Volume Weighted Average Price (cumulative or rolling) SUPERTREND — ATR-based trend-following signal ICHIMOKU — Ichimoku Cloud DONCHIAN — Donchian Channels PIVOT_POINTS — Classic / Fibonacci / Camarilla pivot levels KELTNER_CHANNELS — EMA ± ATR bands HULL_MA — Hull Moving Average (WMA-based) CHANDELIER_EXIT — ATR-based stop-loss / exit levels VWMA — Volume Weighted Moving Average CHOPPINESS_INDEX — Market choppiness / trending strength index

Rust backend

All computations delegate to Rust functions in the _ferro_ta extension:

from ferro_ta._ferro_ta import supertrend, donchian, vwap, ...
ferro_ta.extended.CHANDELIER_EXIT(high, low, close, timeperiod=22, multiplier=3.0)[source]

Chandelier Exit — ATR-based trailing stop levels.

Parameters:
  • high (array-like)

  • low (array-like)

  • close (array-like)

  • timeperiod (int, default 22) – Lookback period for highest high / lowest low and ATR.

  • multiplier (float, default 3.0) – ATR multiplier.

Returns:

long_exit, short_exit

Return type:

numpy.ndarray

Notes

Implemented in Rust with O(n) monotonic deque for rolling max/min.

ferro_ta.extended.CHOPPINESS_INDEX(high, low, close, timeperiod=14)[source]

Choppiness Index — measures market choppiness (range-bound vs trending).

Parameters:
  • high (array-like)

  • low (array-like)

  • close (array-like)

  • timeperiod (int, default 14)

Returns:

Values in [0, 100]. Values near 100 indicate choppy/range-bound markets; values near 0 indicate strong trends.

Return type:

numpy.ndarray

Notes

CI = 100 * log10(sum(ATR(1), n) / (highest_high lowest_low)) / log10(n)

Implemented in Rust with O(n) monotonic deques (no Python loop).

ferro_ta.extended.DONCHIAN(high, low, timeperiod=20)[source]

Donchian Channels — rolling highest high / lowest low.

Parameters:
  • high (array-like)

  • low (array-like)

  • timeperiod (int, default 20)

Returns:

upper, middle, lower – Rolling highest high, midpoint, and lowest low.

Return type:

numpy.ndarray

Notes

Implemented in Rust with O(n) monotonic deque (no Python loop).

ferro_ta.extended.HULL_MA(close, timeperiod=16)[source]

Hull Moving Average (HMA).

A fast-responding moving average that reduces lag.

Parameters:
  • close (array-like)

  • timeperiod (int, default 16)

Return type:

numpy.ndarray

Notes

Formula: HMA(n) = WMA(2 * WMA(n/2) - WMA(n), sqrt(n))

Implemented in Rust — all WMA computations are in-process.

ferro_ta.extended.ICHIMOKU(high, low, close, tenkan_period=9, kijun_period=26, senkou_b_period=52, displacement=26)[source]

Ichimoku Cloud (Ichimoku Kinko Hyo).

Parameters:
  • high (array-like)

  • low (array-like)

  • close (array-like)

  • tenkan_period (int, default 9) – Conversion line (Tenkan-sen) period.

  • kijun_period (int, default 26) – Base line (Kijun-sen) period.

  • senkou_b_period (int, default 52) – Leading Span B period.

  • displacement (int, default 26) – Displacement / cloud offset for Senkou A & B.

Returns:

tenkan, kijun, senkou_a, senkou_b, chikou – Each is a 1-D float64 array of the same length as the inputs.

Return type:

numpy.ndarray

Notes

Implemented in Rust with O(n) monotonic deque for all rolling windows.

ferro_ta.extended.KELTNER_CHANNELS(high, low, close, timeperiod=20, atr_period=10, multiplier=2.0)[source]

Keltner Channels — EMA ± (multiplier × ATR).

Parameters:
  • high (array-like)

  • low (array-like)

  • close (array-like)

  • timeperiod (int, default 20) – EMA period for the middle band.

  • atr_period (int, default 10) – ATR period for band width.

  • multiplier (float, default 2.0) – ATR multiplier.

Returns:

upper, middle, lower

Return type:

numpy.ndarray

Notes

Implemented in Rust — EMA and ATR computed inline without Python calls.

ferro_ta.extended.PIVOT_POINTS(high, low, close, method='classic')[source]

Pivot Points — support / resistance levels.

Computes pivot points for each bar using the previous bar’s H/L/C. The first bar output is NaN.

Parameters:
  • high (array-like)

  • low (array-like)

  • close (array-like)

  • method ({'classic', 'fibonacci', 'camarilla'}, default 'classic')

Returns:

pivot, r1, s1, r2, s2

Return type:

numpy.ndarray

Notes

Classic: P=(H+L+C)/3; R1=2P−L; S1=2P−H; R2=P+(H−L); S2=P−(H−L)

Fibonacci: P=(H+L+C)/3; R1=P+0.382*(H−L); S1=P−0.382*(H−L); R2=P+0.618*(H−L); S2=P−0.618*(H−L)

Camarilla: P=(H+L+C)/3; R1=C+1.1*(H−L)/12; S1=C−1.1*(H−L)/12; R2=C+1.1*(H−L)/6; S2=C−1.1*(H−L)/6

ferro_ta.extended.SUPERTREND(high, low, close, timeperiod=7, multiplier=3.0)[source]

Supertrend indicator.

An ATR-based trend-following indicator. Returns the Supertrend line and a direction array.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • close (array-like) – Sequence of closing prices.

  • timeperiod (int, optional) – ATR period (default 7).

  • multiplier (float, optional) – ATR multiplier for band width (default 3.0).

Returns:

  • supertrend (numpy.ndarray) – The Supertrend line values. NaN during the warmup period.

  • direction (numpy.ndarray) – 1 = uptrend (price above Supertrend), -1 = downtrend. 0 during warmup.

Return type:

tuple[ndarray, ndarray]

Notes

Implemented in Rust — the sequential band-adjustment loop that was previously a Python bottleneck now runs at native speed.

Examples

>>> import numpy as np
>>> from ferro_ta import SUPERTREND
>>> h = np.array([10.0, 11.0, 12.0, 11.0, 10.0, 9.0, 8.0, 9.0, 10.0, 11.0,
...               12.0, 13.0, 14.0, 13.0, 12.0])
>>> l = h - 1.0
>>> c = (h + l) / 2.0
>>> st, dir_ = SUPERTREND(h, l, c)
ferro_ta.extended.VWAP(high, low, close, volume, timeperiod=0)[source]

Volume Weighted Average Price.

Parameters:
  • high (array-like) – Sequence of high prices.

  • low (array-like) – Sequence of low prices.

  • close (array-like) – Sequence of closing prices.

  • volume (array-like) – Sequence of volumes.

  • timeperiod (int, optional) – Rolling window length. 0 (default) computes a cumulative VWAP from bar 0 (session VWAP). Any value >= 1 uses a rolling window of that length; the first timeperiod - 1 values are NaN.

Returns:

Array of VWAP values.

Return type:

numpy.ndarray

Notes

Typical price is used: (high + low + close) / 3. Implemented in Rust for maximum performance.

ferro_ta.extended.VWMA(close, volume, timeperiod=20)[source]

Volume Weighted Moving Average.

Parameters:
  • close (array-like)

  • volume (array-like)

  • timeperiod (int, default 20)

Return type:

numpy.ndarray

Notes

VWMA = sum(close * volume, n) / sum(volume, n) Implemented in Rust with O(n) prefix-sum approach.