backtrader.indicators.contrib package

Contributed indicators migrated from functional strategy tests.

These indicators are lower-commonality or strategy-specific indicators. They are re-exported from backtrader.indicators so users can access them as bt.indicators.Xxx.

class backtrader.indicators.contrib.AbsolutelyNoLagLwma[source]

Bases: Indicator

Compute a low-lag LWMA proxy based on nested weighted moving averages.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.AbsolutelyNoLagLwmaColor[source]

Bases: Indicator

Indicator computing WMA-of-WMA (no-lag) upper/lower channels with color breakout signal.

__init__(*args, **kwargs)
next()[source]

Set the color index based on close position relative to the no-lag WMA channel.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.AccumulationDistributionLine[source]

Bases: Indicator

Accumulate the ADL indicator from price and volume progression.

next()[source]

Compute one bar’s accumulation/distribution line value.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ChaikinOscillator[source]

Bases: Indicator

Chaikin oscillator as EMA(short) minus EMA(long) of ADL.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.LineCCI[source]

Bases: Indicator

Custom CCI computation on the selected input data.

next()[source]

Calculate a bar’s CCI value with zero-handling for degenerate windows.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.CCIDualOnMA[source]

Bases: Indicator

Provide fast/slow CCI values computed on a smoothing moving average.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.ADXCrossHullStyleIndicator[source]

Bases: Indicator

Hull-style ADX cross indicator emitting up/down directional signal levels.

Builds smoothed +DI/-DI values from a full and a half-length directional index and marks an up level on a bullish DI cross or a down level on a bearish DI cross, each offset from price by a fraction of ATR.

__init__(*args, **kwargs)
next()[source]

Compute the per-bar up/down signal levels from smoothed DI crosses.

once(start, end)[source]

Vectorized batch computation of up/down signal levels over a range.

Parameters:
  • start – First index in the array range to compute.

  • end – One past the last index in the array range to compute.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.UltraXMAIndicator[source]

Bases: Indicator

UltraXMA breadth indicator counting rising vs falling fanned moving averages.

Computes a fan of moving averages over increasing periods, counts how many are rising (bulls) versus falling (bears) each bar, and smooths those counts with an exponential factor to produce trend-strength breadth lines.

__init__(*args, **kwargs)
next()[source]

Compute and smooth the per-bar bullish/bearish moving-average counts.

once(start, end)[source]

Vectorized batch computation of smoothed breadth counts over a range.

Parameters:
  • start – First index in the array range to compute.

  • end – One past the last index in the array range to compute.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.ADXDMI[source]

Bases: Indicator

DMI direction indicator exposing plus/minus directional values.

__init__(*args, **kwargs)
next()[source]

Write current directional index values to output lines.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.AIAccelerationDecelerationOscillator[source]

Bases: Indicator

Indicator computing acceleration/deceleration oscillator from SMA spread.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.AltrTrendSignalV22[source]

Bases: Indicator

Adaptive trend breakout indicator used by the strategy.

__init__(*args, **kwargs)
next()[source]

Compute breakout level and emit short/long trigger values.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.AnchoredMomentumLine[source]

Bases: Indicator

Anchored Momentum line: EMA-vs-SMA percentage plus a zone classifier.

__init__(*args, **kwargs)
next()[source]

Compute the percentage momentum and assign its up/neutral/down zone.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.AnchoredMomentumCandleIndicator[source]

Bases: Indicator

Synthetic candle from Anchored Momentum on each OHLC price plus colour.

__init__(*args, **kwargs)
next()[source]

Assemble the momentum candle OHLC and colour for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.AnyRangeCldTailIndicator[source]

Bases: Indicator

Compute a session-based daily channel and color-state trend signal.

__init__(*args, **kwargs)
next()[source]

Update channel bounds and emit color state for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.AroonHornSignIndicator[source]

Bases: Indicator

Reconstructs AroonHornSign indicator.

BULLS = 100 - (bars_since_highest_high + 0.5) * 100 / AroonPeriod BEARS = 100 - (bars_since_lowest_low + 0.5) * 100 / AroonPeriod trend = +1 if BULLS > BEARS and BULLS >= 50 trend = -1 if BULLS < BEARS and BEARS >= 50 BullsAroon (buy arrow) when trend flips from -1 to +1: low - ATR*3/8 BearsAroon (sell arrow) when trend flips from +1 to -1: high + ATR*3/8 Buffers: 0=BearsAroon(sell), 1=BullsAroon(buy).

__init__(*args, **kwargs)
next()[source]

Compute bear/bull arrow levels based on trend flips and ATR displacement.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.AroonOscillatorSignAlert[source]

Bases: Indicator

Aroon oscillator alert indicator with buy/sell level trigger lines.

__init__(*args, **kwargs)
next()[source]

Compute oscillator and emit trigger prices when levels are crossed.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ArrowsCurvesIndicator[source]

Bases: Indicator

Custom Arrows and Curves technical indicator.

Calculates channel boundaries (smax, smin, smax2, smin2) based on highest high and lowest low windows and returns trade entry signals (buy, sell, buy_stop, sell_stop).

__init__(*args, **kwargs)
next()[source]

Calculates channel lines and signals for each bar.

Generates buy/sell and buy_stop/sell_stop triggers based on price crossovers and trend state switches.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ASCtrendIndicator[source]

Bases: Indicator

Reconstructs ASCtrend from its MQ5 source.

Outputs:
  • buy_arrow : non-zero price level when a buy arrow fires

  • sell_arrow: non-zero price level when a sell arrow fires

__init__(*args, **kwargs)
next()[source]

Emit ASCtrend buy/sell arrows from the %R band transitions per bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.AsimmetricStochNRIndicator[source]

Bases: Indicator

Asymmetric stochastic oscillator indicator with dynamic MA smoothing.

__init__(*args, **kwargs)
next()[source]

Compute current stoch and signal values using the active periods.

once(start, end)[source]

Batch compute indicator lines for historical range in one pass.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.AtrNormalizeHistogram[source]

Bases: Indicator

ATR-normalized histogram indicator for multi-timeframe signal generation.

Computes a normalized ATR value where xdiff is smoothed range ratio, colored by threshold crossings (high/middle/low levels).

__init__(*args, **kwargs)
next()[source]

Compute per-bar normalized ATR value and color classification.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.AverageChangeCandle[source]

Bases: Indicator

Custom Average Change Candle indicator that computes power-scaled smoothed lines.

Lines:

open_line (LineSeries): Smoothed open line. high_line (LineSeries): Smoothed high line. low_line (LineSeries): Smoothed low line. close_line (LineSeries): Smoothed close line. color (LineSeries): Candle color state (0 = bearish, 1 = flat, 2 = bullish).

__init__(*args, **kwargs)
next()[source]

Compute smoothed and power-scaled candle lines on each bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.BBSqueezeIndicator[source]

Bases: Indicator

Bollinger Band Squeeze: measures BB width relative to Keltner Channel. Histogram = close - midline of (BB + KC) / 2, colored by whether BB is inside KC (squeeze on) or outside (squeeze off). Simplified: histogram = momentum (close - SMA), signal direction by BB bandwidth vs KC bandwidth.

__init__(*args, **kwargs)
next()[source]

Calculate squeeze state and momentum for every new bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.BezierStDevIndicator[source]

Bases: Indicator

Reconstructs Bezier_StDev indicator.

Bezier curve interpolation of price over BPeriod, then StDev filter on the first derivative to generate Bulls/Bears signals. Buffers: 0=BezierLine, 1=ColorIndex, 2=BearsBuffer(sell), 3=BullsBuffer(buy).

__init__(*args, **kwargs)
next()[source]

Compute Bezier line, color, and bullish/bearish derivative filters.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.BinaryWaveIndicator[source]

Bases: Indicator

Weighted indicator that builds a smoothed wave signal from multiple sub-indicators.

__init__(*args, **kwargs)
next()[source]

Update raw and smoothed wave values for a single bar.

once(start, end)[source]

Calculate raw and smoothed wave arrays for a range of bars.

Parameters:
  • start – Start index for batch evaluation.

  • end – End index (exclusive) for batch evaluation.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.BlauCMomentumIndicator[source]

Bases: Indicator

Blau composite momentum: triple-smoothed price-difference oscillator.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.BlauCMIIndicator[source]

Bases: Indicator

Compute the CMI oscillator from nested moving averages of momentum.

__init__(*args, **kwargs)
next()[source]

Populate the indicator value on a per-bar basis.

once(start, end)[source]

Compute indicator values in a vectorized range for Backtrader backfills.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.BlauCSI[source]

Bases: Indicator

Blau CSI indicator built from smoothed momentum vs. range.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.BlauErgodic[source]

Bases: Indicator

Blau Ergodic oscillator: triple-smoothed normalised momentum.

Price momentum and its absolute value are each triple-smoothed with EMAs; the main line is 100 times their ratio (guarded against division by zero). The signal line is an EMA of the main line, and spread is their difference.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.BlauTStochI[source]

Bases: Indicator

Indicator generating a smoothed Blau T-Stoch histogram.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.BlauTSStochastic[source]

Bases: Indicator

Blau TS Stochastic: triple-smoothed stochastic momentum oscillator.

A stochastic numerator (price minus lowest low) and its range (highest high minus lowest low) are each triple-smoothed with EMAs; the histogram is 200 times their ratio minus 100 (guarded against division by zero), and an EMA of the histogram forms the signal line exposed on the down line.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.BlauTVI[source]

Bases: Indicator

Blau Tick Volume Indicator: a triple-EMA-smoothed up/down tick oscillator.

__init__(*args, **kwargs)
next()[source]

Assign a color index based on the value’s sign and direction of change.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.BrainTrend2Indicator[source]

Bases: Indicator

ATR-derived trend-state indicator producing a four-state color signal.

__init__(*args, **kwargs)
next()[source]

Update trend river state and emit a color code.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.AbsolutelyNoLagLwmaIndicator[source]

Bases: Indicator

No-lag LWMA indicator with color state transitions.

__init__(*args, **kwargs)
next()[source]

Compute smoothed LWMA and directional color for each bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.BrainTrendSignalProxy[source]

Bases: Indicator

Signal proxy that combines ATR and stochastic cross conditions.

__init__(*args, **kwargs)
next()[source]

Emit buy and sell trigger levels for the latest bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.BrakeParbIndicator[source]

Bases: Indicator

Parabolic-style trailing-stop indicator with flip arrows.

Maintains a power-curve stop that rises while long (and falls while short) from a begin price; when price breaks the stop the direction flips. Exposes the active stop on up/down lines and direction-flip cues on buy/sell lines.

__init__(*args, **kwargs)
next()[source]

Advance the parabolic stop and emit up/down stop and flip lines.

Extends the stop along the power curve, flips direction (resetting the begin price and extremes) when price breaks the stop, and sets the up/down stop lines plus buy/sell flip cues for the bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.BreakoutBarsTrendV2[source]

Bases: Indicator

Custom trend-breakout indicator calculating dynamic trend boundaries and reversals.

Lines:

value: Trend state value (1.0 or positive series count for uptrend, -1.0 or negative series count for downtrend).

__init__(*args, **kwargs)
frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

next()[source]

Determine if a trend reversal has occurred, and update trend extremes.

class backtrader.indicators.contrib.BSIIndicator[source]

Bases: Indicator

Balance of power-style indicator returning BSI value and trend color.

__init__(*args, **kwargs)
next()[source]

Compute BSI and derive color from directional BSI movement.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.BullsBearsEyes[source]

Bases: Indicator

Rebuild a signal oscillator from recursive smoothed directional momentum.

__init__(*args, **kwargs)
next()[source]

Compute the next recursive signal value and write it to lines.value.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.BullsPower[source]

Bases: Indicator

Indicator for Bulls Power built from high price minus EMA.

__init__(*args, **kwargs)
next()[source]

Update current Bulls Power value.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.BearsPower[source]

Bases: Indicator

Indicator for Bears Power built from low price minus EMA.

__init__(*args, **kwargs)
next()[source]

Update current Bears Power value.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.BWWiseMan1Signal[source]

Bases: Indicator

Generate long/short trigger values based on Alligator-like MAs and ATR.

The indicator outputs two value lines (buy, sell) that represent candidate entry levels for short and long flips under the configured market regime.

__init__(*args, **kwargs)
next()[source]

Compute current buy/sell trigger values from MA and ATR relationships.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.BykovTrendIndicator[source]

Bases: Indicator

Reconstructs BykovTrend from its MQ5 source.

Uses WPR(SSP) + ATR(15) to detect trend flips. Outputs buy_arrow / sell_arrow (non-zero price level when arrow fires).

__init__(*args, **kwargs)
next()[source]

Update the trend state and emit buy/sell arrow offsets on flips.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.CandleStopColor[source]

Bases: Indicator

Indicator computing highest-high/ lowest-low trailing stop channels with color breakout signal.

next()[source]

Compute trailing high/low range and set color index based on close position.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.CandlesXSmoothedIndicator[source]

Bases: Indicator

Indicator that smooths OHLC bars with configurable MA and derives color state.

__init__(*args, **kwargs)
next()[source]

Set color state to bullish (0) or bearish (1) for current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.CandlesticksBW[source]

Bases: Indicator

Indicator that encodes AO/AC state into a numeric candle color code.

__init__(*args, **kwargs)
next()[source]

Compute the color code for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.CaudateXPeriodCandleColor[source]

Bases: Indicator

Synthetic period-candle indicator emitting a color index and smoothed OHLC.

__init__(*args, **kwargs)
next()[source]

Build the period candle and assign its color index from the midpoint.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.CCIHistogramIndicator[source]

Bases: Indicator

CCI-based colour-state indicator classifying CCI into three zones.

Lines

ccifloat

Commodity Channel Index value.

color_statefloat

0.0 = overbought (CCI > high_level), 1.0 = neutral, 2.0 = oversold.

hist_basefloat

Always 0.0 (placeholder for histogram baseline).

__init__(*args, **kwargs)
next()[source]

Classify current CCI value into colour state (0=overbought, 1=neutral, 2=oversold).

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.CCIWoodiesIndicator[source]

Bases: Indicator

Reconstructs CCI_Woodies indicator.

DRAW_FILLING between FastCCI and SlowCCI. Buffer 0 = FastCCI, Buffer 1 = SlowCCI. When Fast > Slow → bullish (Lime fill); when Fast < Slow → bearish (Plum fill).

__init__(*args, **kwargs)
next()[source]

Compute and store current fast and slow CCI values for each bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.CenterOfGravityCandleIndicator[source]

Bases: Indicator

Center-of-Gravity Candle indicator exposing center, signal, and state lines.

__init__(*args, **kwargs)
next()[source]

Set state to 2 when center is above signal, else 0, for the bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.CenterOfGravityIndicator[source]

Bases: Indicator

Center of Gravity indicator composed of price selection and smoothed center line.

__init__(*args, **kwargs)
next()[source]

Compute the state classification for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.CGOscillator[source]

Bases: Indicator

Center of Gravity (CG) oscillator with a one-bar-lagged signal line.

The main line is a length-weighted ratio of recent median prices, shifted to centre around zero. The signal line is the previous bar’s main value.

__init__(*args, **kwargs)
next()[source]

Compute the CG main and lagged signal value for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.CloseLineCCI[source]

Bases: Indicator

Custom CCI indicator designed to evaluate simple single close lines instead of HLC.

Lines:

cci (Line): Output Commodity Channel Index line.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.ClosePriceFractals[source]

Bases: Indicator

Custom 5-period Fractal indicator calculated solely on closing prices.

Lines:

upper: Contains fractal peak closing price if upper fractal is formed. lower: Contains fractal valley closing price if lower fractal is formed.

__init__(*args, **kwargs)
next()[source]

Determine if a peak or valley fractal forms on bar -2 based on close prices.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.Color3rdGenXMAIndicator[source]

Bases: Indicator

Third-generation (reduced-lag) moving average with a slope color.

Combines a base moving average with a re-smoothed version using a lambda-derived alpha to cut lag, exposing the resulting line on value and a color line marking whether it is rising (2), falling (0) or flat (1).

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.ColorBBCandlesIndicator[source]

Bases: Indicator

Color BBCandles indicator producing zone states from volatility envelopes.

The indicator computes a moving-average center line and standard deviation bands with multiple deviation levels, then emits a discrete state 0..10.

__init__(*args, **kwargs)
next()[source]

Evaluate the current bar and emit the normalized volatility state.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ColorCoppockIndicator[source]

Bases: Indicator

Compute Coppock oscillator value and its directional color state.

__init__(*args, **kwargs)
next()[source]

Update value and color for the current bar.

once(start, end)[source]

Fill value/color lines for preloaded bars in a batch run.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.ColorHMA[source]

Bases: Indicator

Hull Moving Average line plus its slope-direction (“color”) line.

__init__(*args, **kwargs)
next()[source]

Compute the HMA value for this bar and update its slope direction.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ColorJVariationIndicator[source]

Bases: Indicator

Indicator deriving a custom color variation series from MA residuals.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.ColorMetroDeMarkerIndicator[source]

Bases: Indicator

Colour Metro DeMarker indicator: derives fast/slow adaptive trend lines from the DeM oscillator.

__init__(*args, **kwargs)
next()[source]

Compute fast_line, slow_line and demarker from DeM value using step-based channel logic.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ColorMetroStochasticIndicator[source]

Bases: Indicator

Indicator producing adaptive fast/slow ColorMETRO stochastic levels.

__init__(*args, **kwargs)
next()[source]

Update fast/slow adaptive lines and push current values.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ColorMetroWprIndicator[source]

Bases: Indicator

ColorMETRO step lines (fast/slow NRTR) computed over Williams %R.

__init__(*args, **kwargs)
next()[source]

Update the fast and slow NRTR step lines from the current %R value.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ColorSchaffDeMarkerTrendCycle[source]

Bases: Indicator

Schaff Trend Cycle of DeMarker oscillators with a discrete color line.

__init__(*args, **kwargs)
next()[source]

Compute the STC value and discrete color code for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ColorSchaffTrendCycleIndicator[source]

Bases: Indicator

Custom indicator producing Schaff Trend Cycle value and color states.

__init__(*args, **kwargs)
next()[source]

Advance indicator by one bar and compute value/color for that bar.

once(start, end)[source]

Compute indicator output in vectorized mode for backtest startup.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.ColorStepXCCXIndicator[source]

Bases: Indicator

Compute fast/slow XCCX channel lines for directional step signals.

__init__(*args, **kwargs)
next()[source]

Update fast and slow channel lines on the next bar.

once(start, end)[source]

Compute channel lines for vectorized/cached bars from start to end.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.ColorX2MA[source]

Bases: Indicator

Indicator that outputs smoothed MA value and directional color index.

__init__(*args, **kwargs)
next()[source]

Update color index based on value momentum.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ColorXDerivative[source]

Bases: Indicator

Smoothed price-derivative indicator with a momentum color state.

Computes the average rate of change of a weighted price over i_slowing bars, smoothed across xlength windows, and classifies it into a color index: rising/falling while positive (0/1) or negative (3/4), with 2 as a neutral state.

__init__(*args, **kwargs)
next()[source]

Compute the smoothed derivative value and its color state.

Stores the smoothed derivative on the value line and a color index on color_idx reflecting whether the value is rising or falling above or below zero relative to the previous bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ColorZerolagDeMarker[source]

Bases: Indicator

Blend five weighted DeMarker oscillators into fast and slow trend lines.

__init__(*args, **kwargs)
next()[source]

Weight DeMarker values into a fast trend and smoothed slow trend.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.CorrectedAverageIndicator[source]

Bases: Indicator

Ehlers-style adaptive Corrected Average with event and vectorized modes.

__init__(*args, **kwargs)
next()[source]

Compute the corrected average for the current bar.

once(start, end)[source]

Vectorized corrected-average computation over the array index range.

Parameters:
  • start – Start index (inclusive) of the range to compute.

  • end – End index (exclusive) of the range to compute.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.DarvasBoxesSystem[source]

Bases: Indicator

Indicator that emits Darvas box color states from high/low progression.

__init__(*args, **kwargs)
next()[source]

Update the running Darvas box and emit the discrete color signal.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.DemaRangeChannelColor[source]

Bases: Indicator

Indicator computing DEMA-based upper/lower range channels with a color index for breakout direction.

__init__(*args, **kwargs)
next()[source]

Set the upper, lower, and color_idx line values based on close position relative to DEMA band.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.DerivativeIndicator[source]

Bases: Indicator

Derivative indicator derived from a selected applied price.

The computed value line is a momentum-like slope: 100 * (price[0] - price[-i_slowing]) / i_slowing.

__init__(*args, **kwargs)
next()[source]

Update the derivative value for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.DigitalFT01Indicator[source]

Bases: Indicator

Fixed-weight digital filter with a channel trigger for crossover signals.

__init__(*args, **kwargs)
next()[source]

Compute the digital-filter value and channel trigger for this bar.

Convolves the fixed DIGITAL_WEIGHTS kernel with the applied price, then sets the trigger to a reference close plus/minus the half-channel depending on whether the filtered value is above or below that close.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.DigitalMacd[source]

Bases: Indicator

Digital MACD indicator built from fixed FIR fast/slow filter banks.

FAST_COEFFS = [0.214984061, 0.2065763732, 0.190372889, 0.1675422436, 0.139705315, 0.1087951881, 0.0768869405, 0.0460244906, 0.0180517395, -0.0055294579, -0.0236660212, -0.0358140055, -0.041949776, -0.042533145, -0.0384279507, -0.0307917433, -0.0209443384, -0.0102335925, 9.32767e-05, 0.0089950015, 0.0157131144, 0.0198149331, 0.0211989019, 0.0200639819, 0.0168532934, 0.0121825067, 0.0067474241, 0.0012444305, -0.0037087682, -0.0076300416, -0.0102110543, -0.0113306266, -0.0110462105, -0.0095662166, -0.0072080453, -0.0043494435, -0.001377197, 0.0013575268, 0.0035760416, 0.0050946166, 0.0058339574, 0.0058160431, 0.0051486631, 0.0039984014, 0.002561938, 0.0010531475, -0.0003481453, -0.0014937154, -0.0022905986, -0.0027000514, -0.002735908, -0.0024543322, -0.0019409837, -0.0012957482, -0.0006179734, 5.7542e-06, 0.0005111297, 0.0008605279, 0.0010441921, 0.0010775684, 0.0009966494, 0.00085373, 0.0007142855, 0.0006599146, -0.0008151017]
SLOW_COEFFS = [0.0825641231, 0.082278308, 0.0814249974, 0.0800166909, 0.0780735197, 0.0756232268, 0.072700974, 0.0693478349, 0.0656105823, 0.0615409157, 0.057193954, 0.0526285643, 0.0479025123, 0.0430785482, 0.038215288, 0.0333706133, 0.028602116, 0.0239614376, 0.0194972056, 0.0152532583, 0.0112682658, 0.0075745482, 0.0041980052, 0.0011588603, -0.0015292889, -0.0038593393, -0.0058303888, -0.0074473108, -0.0087203043, -0.0096645874, -0.0102995666, -0.0106483424, -0.0107374524, -0.0105952115, -0.0102516944, -0.0097377645, -0.0090838346, -0.0083237046, -0.0074804382, -0.0065902734, -0.0056742995, -0.0047554314, -0.0038574209, -0.0029983549, -0.0021924972, -0.0014513858, -0.0007848072, -0.0001995891, 0.0003009728, 0.0007162164, 0.0010478905, 0.0012994016, 0.0014755433, 0.0015824007, 0.0016272598, 0.0016185271, 0.0015648336, 0.0014747659, 0.0013569946, 0.0012193896, 0.0010695971, 0.0009140878, 0.000759154, 0.0016019033]
__init__(*args, **kwargs)
next()[source]

Convolve the rolling close window with the FIR banks to set macd.

Emits NaN until the buffer is full, then writes the point-scaled difference of the fast and slow digital filter outputs to macd.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.DonchianChannelsSystem[source]

Bases: Indicator

Donchian-channel indicator emitting breakout-oriented color states.

__init__(*args, **kwargs)
next()[source]

Update rolling channel bounds and write the current breakout color.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.DotsIndicator[source]

Bases: Indicator

Compute a multi-cycle Dots value and color-change state.

lines

Custom lines dots and color.

params

Indicator parameters used in strategy logic.

__init__(*args, **kwargs)
next()[source]

Update smoothed value and color state for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.EFDistanceIndicator[source]

Bases: Indicator

Energy-field distance indicator producing a weighted applied-price value.

Weights each price in a window by the accumulated powered distance to the other prices in the window, yielding a smoothed value line whose turns signal momentum shifts.

__init__(*args, **kwargs)
next()[source]

Compute the energy-field weighted price value for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.EmaRsiVa[source]

Bases: Indicator

Volatility-adaptive EMA whose smoothing reacts to RSI distance from 50.

__init__(*args, **kwargs)
next()[source]

Update the adaptive EMA line using the RSI-modulated smoothing factor.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.EnvelopesJpAlonso[source]

Bases: Indicator

Compute static upper/lower envelope bands around a simple moving average.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.F2aAOIndicator[source]

Bases: Indicator

F2a_AO arrow indicator from a fast/slow/filter EMA system.

Builds fast, slow and filter EMAs of a weighted price and emits a buy arrow below the bar when the fast-minus-slow spread turns up with filter confirmation, or a sell arrow above the bar on the bearish turn, using an internal latch so arrows alternate direction.

__init__(*args, **kwargs)
next()[source]

Compute buy/sell arrows for the current bar (event-driven mode).

Detects a confirmed turn in the fast-minus-slow spread and plots a buy arrow below the low or a sell arrow above the high, offset by half the recent average range, toggling the internal trend latch.

once(start, end)[source]

Compute buy/sell arrows over a range of bars (vectorized mode).

Vectorized equivalent of next used under runonce: iterates the arrays from start to end, detecting confirmed spread turns and writing buy/sell arrow values while maintaining the trend latch.

Parameters:
  • start – First bar index to process.

  • end – Stop index (exclusive) for processing.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.FatlFilter[source]

Bases: Indicator

Finite impulse response filter approximation used by JFatl indicators.

coeffs = (0.436040945, 0.3658689069, 0.2460452079, 0.1104506886, -0.0054034585, -0.0760367731, -0.0933058722, -0.0670110374, -0.0190795053, 0.0259609206, 0.0502044896, 0.0477818607, 0.0249252327, -0.0047706151, -0.0272432537, -0.0338917071, -0.0244141482, -0.0055774838, 0.0128149838, 0.0226522218, 0.0208778257, 0.0100299086, -0.0036771622, -0.013674485, -0.0160483392, -0.0108597376, -0.0016060704, 0.0069480557, 0.0110573605, 0.0095711419, 0.0040444064, -0.0023824623, -0.0067093714, -0.00720034, -0.004771771, 0.0005541115, 0.000786016, 0.0130129076, 0.0040364019)
__init__(*args, **kwargs)
next()[source]

Compute the FIR-style filtered value for the active bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.JFatlApprox[source]

Bases: Indicator

Double-smoothed approximation indicator built from JFatl coefficients.

__init__(*args, **kwargs)
next()[source]

Update smoothed output from incoming raw weighted observations.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.JFatlCandleApprox[source]

Bases: Indicator

Reconstruct candle-like open/high/low/close and color state from JFatl.

__init__(*args, **kwargs)
next()[source]

Generate smoothed OHLC and direction color values for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.FiboCandlesIndicator[source]

Bases: Indicator

Reconstructs the FiboCandles indicator from MQ5 source.

Uses period-bar high/low range * fibo level to detect trend flips. color line: 0 = bullish (trend +1), 1 = bearish (trend -1).

__init__(*args, **kwargs)
next()[source]

Determine trend direction and assign bullish/bearish candle colors.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.FineTuningMA[source]

Bases: Indicator

Weighted moving average with rank/shift-shaped per-bar weights.

__init__(*args, **kwargs)
frompackages = ()
next()[source]

Output the weighted average of the applied price over the window.

once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.FisherOrgV1[source]

Bases: Indicator

Fisher Transform indicator producing a Gaussian-like signal line and its lagged trigger.

Lines

fisherfloat

Current smoothed Fisher Transform value.

triggerfloat

Previous bar’s fisher value, used for crossover detection.

__init__(*args, **kwargs)
next()[source]

Compute Fisher Transform value and set fisher/trigger lines.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.FisherOrgV1Sign[source]

Bases: Indicator

Fisher Transform Org V1 Sign indicator.

Normalises price within a highest-high/lowest-low window over length bars, smooths the normalised position via recursive formula, then applies the Fisher Transform (atanh) to produce a near-Gaussian signal. Buy/sell trigger lines are set at ATR-scaled price levels on threshold crossovers.

Lines

sellfloat

Price level for sell signals (high + 3/8 ATR), set on up-cross.

buyfloat

Price level for buy signals (low - 3/8 ATR), set on down-cross.

__init__(*args, **kwargs)
next()[source]

Compute Fisher Transform values and set buy/sell signal lines.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ForceIndexEMA[source]

Bases: Indicator

Indicator producing a smoothed force index.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.ForceDiverSign[source]

Bases: Indicator

Divergence signal detector built from two force-index EMAs.

__init__(*args, **kwargs)
next()[source]

Evaluate candle patterns and divergence confirmation each bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ForceIndexEma[source]

Bases: Indicator

Force Index (price change times volume) smoothed by an EMA.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.ForecastOscilator[source]

Bases: Indicator

Forecast Oscillator with T3-smoothed signal and arrow lines.

Computes the percentage deviation of price from a linear-regression forecast (the raw ind line), smooths it with a six-stage T3 moving average into the signal line, and emits buy/sell arrow values when the oscillator crosses its signal under the configured sign conditions.

__init__(*args, **kwargs)
next()[source]

Compute the oscillator, T3 signal and arrow lines for this bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.FractalAMAMBK[source]

Bases: Indicator

FRAMA-style indicator exposing smoothed trend and trigger lines.

__init__(*args, **kwargs)
next()[source]

Compute FRAMA and trigger values for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.FramaSeries[source]

Bases: Indicator

Fractal Adaptive Moving Average (FrAMA) of a single input series.

__init__(*args, **kwargs)
next()[source]

Compute the adaptive-alpha FrAMA value for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.FramaLinesIndicator[source]

Bases: Indicator

FrAMA candle indicator emitting smoothed OHLC and a color line.

__init__(*args, **kwargs)
next()[source]

Assemble the smoothed FrAMA candle and classify its color.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.FRASMAv2Indicator[source]

Bases: Indicator

Fractal-adaptive moving average exposing the frasma line and slope color.

__init__(*args, **kwargs)
next()[source]

Compute the fractal dimension, adapt the averaging speed, and set color.

Estimates the fractal dimension of the recent price window, derives an adaptive averaging length, writes the resulting value to frasma, and encodes its slope into color (0 rising, 1 flat, 2 falling).

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.GOIndicator[source]

Bases: Indicator

Indicator that derives a GO signal from smoothed OHLC components.

__init__(*args, **kwargs)
next()[source]

Compute GO for current bar and publish it to lines.go.

once(start, end)[source]

Compute GO for buffered bars in run-once mode.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.HLRIndicator[source]

Bases: Indicator

Base HLR indicator returning a normalized high-low range position.

__init__(*args, **kwargs)
next()[source]

Compute the HLR oscillator value for current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ZeroLagHLRIndicator[source]

Bases: Indicator

Zero-lag variant of HLR computed from a blended set of HLR periods.

__init__(*args, **kwargs)
next()[source]

Update fast and smoothed slow HLR outputs.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.HMA[source]

Bases: Indicator

Hull Moving Average indicator used by OsHMA.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.OsHMAIndicator[source]

Bases: Indicator

Histogram indicator that combines fast and slow HMA lines.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.I4DRFV2[source]

Bases: Indicator

Close-difference indicator producing value and binary color trend state.

__init__(*args, **kwargs)
next()[source]

Compute current indicator value and color.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.I4DRFV3[source]

Bases: Indicator

Indicator producing a direction color and synthetic value from highs/lows.

__init__(*args, **kwargs)
next()[source]

Calculate directional value and color for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.IAnchMomIndicator[source]

Bases: Indicator

Anchored-momentum oscillator: percentage gap of a fast EMA over a slow SMA.

__init__(*args, **kwargs)
next()[source]

Emit the percentage gap 100 * (ema / sma - 1) for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.IDeMarkerSignIndicator[source]

Bases: Indicator

DeMarker oscillator that emits buy/sell triggers on level crossings.

__init__(*args, **kwargs)
next()[source]

Compute the DeMarker value and set buy/sell triggers on crossings.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.IGapIndicator[source]

Bases: Indicator

Detect opening gaps and emit ATR-offset buy/sell arrow levels.

__init__(*args, **kwargs)
next()[source]

Emit buy/sell arrow levels when the prior close gaps past the open.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.IStochKomposterIndicator[source]

Bases: Indicator

Stochastic-and-ATR composite that prints offset buy/sell markers.

Emits a buy line below the bar low (and a sell line above the bar high), offset by 3/8 of ATR, whenever the slowed %K stochastic crosses up through the lower level or down through the upper level respectively.

__init__(*args, **kwargs)
next()[source]

Compute the slowed stochastic and emit ATR-offset cross markers.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ITrendIndicator[source]

Bases: Indicator

i_Trend indicator producing primary and signal crossover lines.

The primary line is the selected price minus a Bollinger band line and the signal line is a moving average mirrored around the bar’s high/low range; their crossovers drive the strategy’s entries and exits.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.IAMMAIndicator[source]

Bases: Indicator

Indicator implementation of i-AMMA value progression.

__init__(*args, **kwargs)
next()[source]

Compute adaptive MA value for current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.IndexedMovingAverage[source]

Bases: Indicator

Indicator that normalizes price-to-MA imbalance for directional signals.

__init__(*args, **kwargs)
next()[source]

Write indexed moving-average deviation to lines.ima for current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.InstantaneousTrendFilterIndicator[source]

Bases: Indicator

Indicator computing trend and trigger values from a low-lag trend filter.

__init__(*args, **kwargs)
next()[source]

Compute the current trend/trigger outputs.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.InverseReactionIndicator[source]

Bases: Indicator

Indicator that tracks candle reaction amplitude and dynamic thresholds.

__init__(*args, **kwargs)
next()[source]

Compute per-bar price-change and dynamic reaction upper/lower levels.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.IRSISignIndicator[source]

Bases: Indicator

Compute RSI sign-flip levels and adaptive ATR-adjusted marker lines.

__init__(*args, **kwargs)
next()[source]

Update buy/sell marker levels and RSI / ATR output lines.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.IWPRSignIndicator[source]

Bases: Indicator

Indicator computing WPR buy/sell levels with ATR context.

__init__(*args, **kwargs)
next()[source]

Compute WPR and create buy/sell trigger levels.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.JBrainTrend1SigIndicator[source]

Bases: Indicator

Generate directional trend-signal levels from ATR, stochastic, and MAs.

The indicator emits buy_signal and sell_signal pulses used by the main strategy.

__init__(*args, **kwargs)
next()[source]

Evaluate one bar and update buy_signal/sell_signal outputs.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.UltraRSIIndicator[source]

Bases: Indicator

Smooth RSI slope-count indicator with configurable averaging stages.

Counts bullish versus bearish RSI directional changes across multiple moving average steps and smooths both counters for a stable signal.

__init__(*args, **kwargs)
next()[source]

Update bullish and bearish counters and write smoothed values.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.JTpoProxy[source]

Bases: Indicator

Proxy oscillator measuring close deviation from its moving average.

__init__(*args, **kwargs)
next()[source]

Compute the current close-minus-SMA deviation value.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.JMASlopeIndicator[source]

Bases: Indicator

Slope of a Jurik-style moving average with a rising/falling color.

Approximates the JMA with an EMA of the applied price, then exposes its bar-over-bar change on the value line and a color line marking whether the slope is positive (4), negative (0) or flat (2).

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.KalmanFilterIndicator[source]

Bases: Indicator

Kalman-style adaptive price filter producing value and direction lines.

__init__(*args, **kwargs)
next()[source]

Update the filtered value and direction for each bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.KalmanFilterLine[source]

Bases: Indicator

Single-series Kalman-style adaptive filter with a velocity term.

__init__(*args, **kwargs)
next()[source]

Advance the filter one bar and emit the value and color lines.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.KalmanFilterCandleIndicator[source]

Bases: Indicator

Builds Kalman-filtered OHLC candles and a bull/bear color line.

__init__(*args, **kwargs)
next()[source]

Assemble the filtered candle and classify its bull/bear color.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.KAMAIndicator[source]

Bases: Indicator

Kaufman Adaptive Moving Average with both event and vectorized modes.

__init__(*args, **kwargs)
next()[source]

Compute the adaptive moving average for the current bar.

once(start, end)[source]

Vectorized KAMA computation over the array index range.

Parameters:
  • start – Start index (inclusive) of the range to compute.

  • end – End index (exclusive) of the range to compute.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.ColorMomentumAMAIndicator[source]

Bases: Indicator

EMA-smoothed momentum line used by the ColorMomentum_AMA strategy.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.KaracaticaIndicator[source]

Bases: Indicator

Reconstructs Karacatica from MQ5 source.

Uses ATR(iPeriod), ADX(iPeriod) +DI/-DI, and close-vs-close(iPeriod-ago) to generate buy/sell arrows with direction latch to avoid repeats.

__init__(*args, **kwargs)
next()[source]

Emit ATR-offset buy/sell arrows on latched directional breakouts.

Computes ATR and +DI/-DI over iperiod and, when the close exceeds its value iperiod bars ago with +DI dominant (and the last arrow was not a buy), places a buy arrow below the low; the symmetric condition places a sell arrow above the high. The direction latch prevents consecutive arrows of the same side.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.KDJIndicator[source]

Bases: Indicator

Indicator class implementing the custom KDJ oscillator.

Lines:

kdc (Line): Output difference line (%K - %D). rsv (Line): Raw Stochastic Value line. k (Line): Smoothed %K line. d (Line): Smoothed %D line.

__init__(*args, **kwargs)
next()[source]

Calculate RSV, %K, %D, and %K-%D values on each new bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.KwanCccIndicator[source]

Bases: Indicator

Custom Kwan CCC technical indicator.

Lines:

kwan (LineSeries): Smoothed combination of Chaikin, CCI, and Momentum. direction (LineSeries): Directional momentum flag (0 = bullish, 1 = flat, 2 = bearish).

__init__(*args, **kwargs)
next()[source]

Compute the Kwan CCC metric and directional momentum flags on each bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.KwanNrpIndicator[source]

Bases: Indicator

Compute smoothed KWAN_NRP value and direction direction states.

__init__(*args, **kwargs)
next()[source]

Update KWAN value and directional signal line.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.KwanRdpIndicator[source]

Bases: Indicator

Custom Kwan RDP technical indicator.

Lines:

kwan (LineSeries): Smoothed combination of DeMarker, MFI, and Momentum. direction (LineSeries): Directional momentum flag (0 = bullish, 1 = flat, 2 = bearish).

__init__(*args, **kwargs)
next()[source]

Compute Kwan RDP indicator: composite of DeMarker * MFI / momentum, smoothed.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.LaguerreAdxIndicator[source]

Bases: Indicator

Laguerre-filtered ADX directional components built from +/- DI.

__init__(*args, **kwargs)
next()[source]

Compute smoothed up/down values from directional indicators.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.LaguerreFilterIndicator[source]

Bases: Indicator

Laguerre smoothing indicator with finite impulse response fallback lines.

__init__(*args, **kwargs)
next()[source]

Compute current Laguerre and FIR values for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.LaguerrePlusDiProxy[source]

Bases: Indicator

Laguerre-style +DI proxy normalized to the 0..1 range.

Approximates the directional-movement balance used by the original EA by computing positive/negative directional movement and true range over the lookback period and emitting the normalized +DI share.

__init__(*args, **kwargs)
next()[source]

Compute the normalized +DI ratio for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.LaguerreRocIndicator[source]

Bases: Indicator

Laguerre ROC indicator emitting value, midline, and color.

__init__(*args, **kwargs)
next()[source]

Calculate laguerre recursive values and output normalized ROC color.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.LeManSignalIndicator[source]

Bases: Indicator

Reconstructs LeManSignal from its MQ5 source.

Compares two consecutive LPeriod-window high/low ranges shifted by 1 bar and by LPeriod bars to detect breakouts. buy_arrow: H3<=H4 && H1>H2 (high range expansion upward) sell_arrow: L3>=L4 && L1<L2 (low range expansion downward)

__init__(*args, **kwargs)
next()[source]

Compute LeManSignal buy/sell arrows from rolling high-low ranges.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.LinearRegSlopeV2Indicator[source]

Bases: Indicator

Indicator that computes a linear-regression slope proxy and trigger line.

__init__(*args, **kwargs)
frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

next()[source]

Update one bar of regression slope and trigger calculations.

class backtrader.indicators.contrib.LocoIndicator[source]

Bases: Indicator

Loco follow-through line with a binary bullish/bearish color flag.

Tracks the applied price and produces a loco line plus a color flag (0 = bullish, 1 = bearish) that flips when price reverses its run of higher or lower readings.

__init__(*args, **kwargs)
next()[source]

Update the Loco line and color flag for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.LRMAIndicator[source]

Bases: Indicator

Linear regression moving average projected to the latest bar.

__init__(*args, **kwargs)
next()[source]

Fit a least-squares line over the window and emit its endpoint.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ChangeOfVolatilityIndicator[source]

Bases: Indicator

Ratio of short- to long-window momentum dispersion (as a percentage).

__init__(*args, **kwargs)
next()[source]

Emit the short/long volatility ratio scaled to a percentage.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.VininITrendLRMAIndicator[source]

Bases: Indicator

Trend oscillator scoring LRMA against a fan of moving averages.

__init__(*args, **kwargs)
next()[source]

Score LRMA versus the MA fan and exponentially smooth the result.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.LsmaAngleIndicator[source]

Bases: Indicator

Compute LSMA slope angle and map it to a color-state indicator.

The indicator evaluates two least-squares MAs at different shifts and uses the angle and trend persistence to classify bullish/bearish momentum states.

Parameters:
  • lsma_period – Look-back window used for each LSMA estimate.

  • angle_threshold – Threshold used to classify the angle magnitude.

  • start_shift – Shift index for the start LSMA sample.

  • end_shift – Shift index for the end LSMA sample.

__init__(*args, **kwargs)
next()[source]

Calculate the current angle and update color index for the next bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.MARoundingChannelIndicator[source]

Bases: Indicator

Indicator that derives rounded moving-average centerline and channel bounds.

__init__(*args, **kwargs)
next()[source]

Update channel base/upper/lower values from latest MA and ATR context.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.Macd2Indicator[source]

Bases: Indicator

MACD-derived indicator carrying cloud and histogram state for MACD-2.

__init__(*args, **kwargs)
next()[source]

Populate cloud, histogram, and trend color lines each bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.MacdCandleIndicator[source]

Bases: Indicator

MACD-based candle indicator returning open/high/low/close values.

__init__(*args, **kwargs)
next()[source]

Populate output candle components and derive color state per bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.MalrIndicator[source]

Bases: Indicator

Compute MALR trend channels used for breakout-trigger detection.

__init__(*args, **kwargs)
next()[source]

Calculate MALR center and channel boundaries for the current bar.

once(start, end)[source]

Vectorized computation path for backtesting efficiency.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.MomentumCandleSignIndicator[source]

Bases: Indicator

Emit ATR-offset buy/sell dots on open/close momentum crossovers.

__init__(*args, **kwargs)
next()[source]

Detect momentum crossovers and place ATR-offset signal dots.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.MovingAverageFNIndicator[source]

Bases: Indicator

FIR moving average built from named filter coefficients plus smoothing.

__init__(*args, **kwargs)
next()[source]

Convolve the filter coefficients with price and emit the smoothed value.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.Mt5StochasticCloseClose[source]

Bases: Indicator

Close-close based Smoothed Stochastic oscillator implementation.

__init__(*args, **kwargs)
next()[source]

Compute smoothed %K/%D and emit current oscillator lines.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.MUVNorDiffCloudIndicator[source]

Bases: Indicator

Calculate normalized DIFF cloud signals used by the strategy.

__init__(*args, **kwargs)
next()[source]

Compute cloud values for the current bar.

once(start, end)[source]

Compute cloud values for a pre-allocated bar range in vectorized mode.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.NonLagDotIndicator[source]

Bases: Indicator

Reconstructs NonLagDot from its MQ5 source.

Applies a weighted cosine kernel over SMA values to produce a non-lag MA, then assigns color: 0=gray, 1=magenta(down), 2=green(up).

__init__(*args, **kwargs)
next()[source]

Compute smoothed value and trend color for current bar.

The method calculates weighted SMA contributions, applies optional filtering, and updates nlm and color lines.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.NRTRExtrIndicator[source]

Bases: Indicator

Reconstructs NRTR_extr indicator from its MQ5 source.

Same as NRTR but uses high/low extremes instead of close for price tracking. In uptrend: price = max(price, high[bar]); check close < value. In downtrend: price = min(price, low[bar]); check close > value. On flip up: price = low[bar], value = price*(1-dK). On flip down: price = high[bar], value = price*(1+dK).

__init__(*args, **kwargs)
next()[source]

Update trend state, channel values, and signal lines.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.NRTRIndicator[source]

Bases: Indicator

Reconstructs NRTR indicator from its MQ5 source.

Uses iPeriod average range to compute dK scaling factor. Tracks price (close-based) and value with trend ratchet. When close drops below value in uptrend → flip to downtrend. When close rises above value in downtrend → flip to uptrend. 4 buffers: TrendUp(0), TrendDown(1), SignUp(2), SignDown(3).

__init__(*args, **kwargs)
next()[source]

Update the trailing value, detect trend flips, and emit buffers.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.PChannelSystem[source]

Bases: Indicator

Indicator that classifies current bar position versus rolling channel bounds.

__init__(*args, **kwargs)
next()[source]

Compute channel colors from rolling high/low and current candle body.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.PercentEnvelope[source]

Bases: Indicator

Percent envelope built from a moving-average midpoint.

__init__(*args, **kwargs)
next()[source]

Update upper/lower envelope boundaries for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.PercentageCrossoverChannel[source]

Bases: Indicator

Percent-based dynamic channel indicator.

The middle line is gradually adjusted toward current price with separate upper/lower bands derived from the configured percentage distance.

__init__(*args, **kwargs)
next()[source]

Update middle, upper, and lower channel lines for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.PivotZigZagProxy[source]

Bases: Indicator

Compact pivot and zigzag proxy indicator used by the strategy.

It tracks the nearest recent high/low pivot pairs over a configurable depth and emits them as four separate output lines.

__init__(*args, **kwargs)
next()[source]

Compute and expose the most recent two high and two low pivot levels.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.PriceChannelStopIndicator[source]

Bases: Indicator

Reconstructs PriceChannel_Stop from its MQ5 source.

6 output buffers mapped to lines:

0=DownTrendSignal, 1=DownTrendBuffer, 2=DownTrendLine 3=UpTrendSignal, 4=UpTrendBuffer, 5=UpTrendLine

__init__(*args, **kwargs)
next()[source]

Update indicator lines from current and rolling high/low windows.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.PriceExtremeChannel[source]

Bases: Indicator

Custom indicator calculating local highest highs and lowest lows.

Lines:

upper (Line): Channel upper boundary. lower (Line): Channel lower boundary.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.QQECloudIndicator[source]

Bases: Indicator

Indicator computing smoothed QQE-like trend values from RSI.

Parameters:
  • rsi_period – RSI lookback period.

  • sf – Smoothing factor for XRSI and momentum smoothers.

  • darfactor – ATR-like factor used to offset trailing reference.

  • xma_method – Moving-average method alias used for RSI smoothing.

  • xphase – Unused legacy parameter preserved for compatibility.

__init__(*args, **kwargs)
next()[source]

Update output lines on each tick using previous envelope state.

once(start, end)[source]

Vectorized indicator evaluation for vectorized Backtrader runs.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.RaviIndicator[source]

Bases: Indicator

RAVI oscillator: percentage spread between a fast and slow EMA of close.

__init__(*args, **kwargs)
next()[source]

Compute the RAVI value as the percent spread of fast over slow EMA.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.RawCloseCloseStochastic[source]

Bases: Indicator

Raw close-based Stochastic (%K numerator) over a close-only window.

__init__(*args, **kwargs)
next()[source]

Compute the raw close-based Stochastic value for the current bar.

once(start, end)[source]

Vectorized raw close-based Stochastic over the array index range.

Parameters:
  • start – Start index (inclusive) of the range to compute.

  • end – End index (exclusive) of the range to compute.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.CloseCloseEmaStochastic[source]

Bases: Indicator

EMA-smoothed close-based Stochastic exposing percK and percD.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.RDTrendTriggerIndicator[source]

Bases: Indicator

Custom indicator that derives normalized range-trend trigger values.

__init__(*args, **kwargs)
next()[source]

Compute trend trigger value from rolling high/low comparisons.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.RenkoLevel[source]

Bases: Indicator

Fixed-brick Renko level tracker emitting upper/lower levels and color.

__init__(*args, **kwargs)
next()[source]

Advance the Renko brick levels for the current bar’s close.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.RenkoLineBreak[source]

Bases: Indicator

Indicator that models renko-like box transitions.

__init__(*args, **kwargs)
next()[source]

Update Renko upper/lower/box count states each bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.RFTLIndicator[source]

Bases: Indicator

Indicator that computes a weighted RFTL value from weighted close history.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.RKDIndicator[source]

Bases: Indicator

Compute a custom RKD line set from RSV/K/D values.

__init__(*args, **kwargs)
next()[source]

Update RSV, K, and D for the latest bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ROC2VGIndicator[source]

Bases: Indicator

Reconstructs ROC2_VG indicator.

DRAW_FILLING between ROC1 and ROC2. Buffer 0 = ROC1 (period1, type1), Buffer 1 = ROC2 (period2, type2).

__init__(*args, **kwargs)
next()[source]

Populate roc1 and roc2 for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.RSIHistogramIndicator[source]

Bases: Indicator

Compute RSI values and convert to a three-state color histogram.

__init__(*args, **kwargs)
next()[source]

Update value, midline, and current color state.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.RSISlowdown[source]

Bases: Indicator

RSI Slowdown — detects RSI extreme flattening as reversal signal.

Fires buy when RSI(2) >= level_max (overbought) and the change between consecutive bars is small (slowdown). Fires sell symmetrically at level_min (oversold). Signal lines store ATR-scaled price levels.

__init__(*args, **kwargs)
next()[source]

Compute RSI slowdown signal for the current bar.

Sets buy/sell lines to ATR-derived price levels when the RSI extreme + slowdown condition is met, or NaN otherwise.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.RsiomaV2[source]

Bases: Indicator

RSIOMA V2 indicator: an RSI of smoothed price with an EMA signal line.

The price close is smoothed with an EMA (optionally transformed by a Momentum step), an RSI is computed on that series to form the rsioma line, and the rsioma is smoothed again with an EMA to form the signal line.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.RVIHistogramIndicator[source]

Bases: Indicator

Relative Vigor Index with a smoothed signal line and color state.

__init__(*args, **kwargs)
next()[source]

Compute the RVI main/signal lines and the level-based color state.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.SafeADX[source]

Bases: Indicator

ADX indicator implementation without division by zero pitfalls.

__init__(*args, **kwargs)
next()[source]

Compute safe directional movement and ADX-like intensity.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.SafeAMA[source]

Bases: Indicator

Adaptive moving average indicator with safe initialization.

__init__(*args, **kwargs)
next()[source]

Update AMA based on efficiency ratio and smoothing.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.SkyscraperFixIndicator[source]

Bases: Indicator

Channel-like adaptive indicator emitting buy/sell buffers and color state.

__init__(*args, **kwargs)
next()[source]

Calculate up/down channel levels, pending buffers, and current color.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.SkyscraperFixDuplexIndicator[source]

Bases: Indicator

Indicator for directional buffer-based skyline reversals.

__init__(*args, **kwargs)
next()[source]

Update the skyscraper buffers for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.SkyscraperFixColorAMLIndicator[source]

Bases: Indicator

Skyscraper fix channel indicator producing buy/sell buffers and color state.

__init__(*args, **kwargs)
next()[source]

Compute current channel extrema and potential reversal buffers.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.AppliedPriceCCI[source]

Bases: Indicator

Commodity Channel Index computed on an arbitrary applied-price line.

__init__(*args, **kwargs)
next()[source]

Emit the CCI value: price deviation from its mean over mean abs deviation.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ColorAMLIndicator[source]

Bases: Indicator

Fractal-driven adaptive moving line with trend color transitions.

__init__(*args, **kwargs)
next()[source]

Update AML line value and color state for the current candle.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ColorAMLMeanReversionIndicator[source]

Bases: Indicator

Adaptive moving-lowpass indicator for color-state trend capture.

__init__(*args, **kwargs)
next()[source]

Update smooth and color values for the active bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.X2MACandleApprox[source]

Bases: Indicator

Two-stage moving approximation of candle structure and color.

__init__(*args, **kwargs)
next()[source]

Update approximated open/high/low/close and color from historical window.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.XPeriodCandleColor[source]

Bases: Indicator

Smoothing-based period-candle indicator producing color index.

__init__(*args, **kwargs)
next()[source]

Compute synthetic candle and color value for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.XPeriodCandleSystemColor[source]

Bases: Indicator

SMA-smoothed candle color indicator with Bollinger Band breakout detection.

__init__(*args, **kwargs)
next()[source]

Assign color index based on smoothed candle direction and Bollinger Band position.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.AcceleratorOscillator[source]

Bases: Indicator

Compute accelerator oscillator using short and long SMA of median price.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.AIAcceleratorOscillator[source]

Bases: Indicator

Accelerator Oscillator indicator computed from Awesome Oscillator.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.AdaptiveMarketLevel[source]

Bases: Indicator

Adaptive Market Level indicator using fractal dimension and adaptive smoothing.

The AML line adapts its smoothing alpha based on the measured fractal dimension of the price range, providing faster response in trending markets and slower response in mean-reverting regimes.

__init__(*args, **kwargs)
next()[source]

Compute AML value using fractal-range adaptive smoothing.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.AmlIndicator[source]

Bases: Indicator

Adaptive Market Level indicator for backtrader (on-chart version).

Uses the same fractal-range adaptive smoothing logic as AdaptiveMarketLevel but implemented as a Backtrader indicator with minperiod management.

__init__(*args, **kwargs)
next()[source]

Compute AML value using fractal-range adaptive smoothing.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.FunctionalAwesomeOscillator[source]

Bases: Indicator

Awesome Oscillator: fast minus slow SMA of the median price.

__init__(*args, **kwargs)
next()[source]

Emit the fast/slow SMA difference for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.AIAwesomeOscillator[source]

Bases: Indicator

Awesome Oscillator indicator using two SMAs on the price midpoint.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.BlauErgodicMDI[source]

Bases: Indicator

Calculate layered EMA histograms used as the Blau Ergodic MDI signal.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.BlauErgodicMDIClassic[source]

Bases: Indicator

Ergodic MDI indicator with up/down/histogram smoothing channels.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.BrakeExpIndicator[source]

Bases: Indicator

Exponential trailing-stop indicator with trend and flip lines.

Maintains an exponential-curve stop that rises while long (and falls while short) from a begin price; when price breaks the stop the direction flips. Exposes the active stop on up_trend/down_trend lines and direction-flip cues on buy_signal/sell_signal lines.

__init__(*args, **kwargs)
next()[source]

Advance the exponential stop and emit trend and flip lines.

Extends the stop along the exponential curve, flips direction (resetting the begin price and extremes) when price breaks the stop, and sets the up_trend/down_trend lines plus buy_signal/sell_signal flip cues for the bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.FlatTrendIndicator[source]

Bases: Indicator

Flat-trend regime indicator combining ADX/DI and Parabolic SAR.

Emits four binary lines (buy, sell, end_buy, end_sell) that classify each bar’s trend state from the SAR position relative to price and the dominance of the positive over the negative directional indicator.

__init__(*args, **kwargs)
next()[source]

Classify the current bar into a buy/sell/end-of-trend state.

Sets exactly one of the four output lines to 1.0 based on whether the SAR sits below price (uptrend context) and whether +DI exceeds -DI.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.FlatTrendDistanceIndicator[source]

Bases: Indicator

Volatility-regime classifier from smoothed ATR and standard-deviation slopes.

Compares the slopes of smoothed ATR and smoothed standard deviation to emit a state line flagging rising, falling, or flat volatility.

__init__(*args, **kwargs)
next()[source]

Classify the current volatility regime from ATR/stdev slope direction.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.IinMASignalIndicator[source]

Bases: Indicator

Cross-period MA signal indicator producing buy/sell trigger levels.

__init__(*args, **kwargs)
next()[source]

Detect MA transitions and write conditional trigger levels.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.KDJ[source]

Bases: Indicator

KDJ (Stochastic) Technical Indicator.

The KDJ indicator is a momentum oscillator that compares a specific closing price of a security to a range of its prices over a certain period of time. It consists of three lines: K, D, and J, where K and D are similar to the Stochastic oscillator, and J is a derivative line.

The indicator is calculated using the StochasticFull indicator as the base, with J calculated as: J = 3*K - 2*D.

Refactoring Note:

Uses the next() method instead of line binding (self.l.K = self.kd.percD) because line binding has idx synchronization issues in the current architecture.

lines

Tuple containing (‘K’, ‘D’, ‘J’) - the three output lines.

params

Tuple containing configuration parameters: - period (int): Lookback period for Stochastic calculation (default: 9). - period_dfast (int): Fast %D smoothing period (default: 3). - period_dslow (int): Slow %D smoothing period (default: 3).

kd

Internal StochasticFull indicator instance.

Type:

StochasticFull

__init__(*args, **kwargs)
next()[source]

Calculate KDJ values for the current bar.

Updates the K, D, and J lines based on the underlying StochasticFull indicator values. The J line is derived from K and D using the formula: J = 3*K - 2*D.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.LaguerreIndicator[source]

Bases: Indicator

Laguerre RSI-style oscillator over a four-stage Laguerre filter.

__init__(*args, **kwargs)
next()[source]

Advance the Laguerre filter and emit the oscillator value.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.LaguerreColorIndicator[source]

Bases: Indicator

Ehlers Laguerre RSI oscillator with high/low colour-state transitions.

__init__(*args, **kwargs)
next()[source]

Advance the Laguerre filter and update the value/colour lines.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.RelativeVigorIndex[source]

Bases: Indicator

Relative Vigor Index (RVI) with its 4-point symmetric signal line.

__init__(*args, **kwargs)
next()[source]

Compute the RVI ratio and its weighted signal value for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.SmoothedRelativeVigorIndex[source]

Bases: Indicator

Relative Vigor Index indicator with smoothed signal line.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.SafeCCI[source]

Bases: Indicator

Safe Commodity Channel Index indicator with guarded zero-variance handling.

__init__(*args, **kwargs)
next()[source]

Compute CCI value for the current bar with mean deviation protection.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.SafeCCIWithFactor[source]

Bases: Indicator

CCI indicator with mean deviation, returning 0.0 when denominator is zero.

__init__(*args, **kwargs)
next()[source]

Compute CCI from rolling typical-price SMA and mean deviation.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.SilverTrendSignalProxy[source]

Bases: Indicator

SilverTrend buy/sell signal proxy based on a moving-average crossover.

Emits a non-zero buy (or sell) value when price crosses above (or below) a risk-scaled simple moving average, mirroring the EA’s signal lines.

__init__(*args, **kwargs)
next()[source]

Set buy/sell signal lines from the price/MA crossover this bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.SilverTrendDirectionSignalProxy[source]

Bases: Indicator

Proxy indicator emitting +1/-1 on SMA crossover direction flips.

__init__(*args, **kwargs)
next()[source]

Carry the prior signal forward, flipping it on a fresh MA crossover.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.SidusIndicator[source]

Bases: Indicator

Reconstructs Sidus indicator from its MQ5 source.

Uses 4 MAs: FastEMA, SlowEMA, FastLWMA, SlowLWMA + ATR(15). Buy arrows on: FastLWMA crosses above SlowLWMA, or SlowLWMA crosses above SlowEMA. Sell arrows on reverse crosses. Arrow offset = ATR * digit scaling.

__init__(*args, **kwargs)
next()[source]

Emit buy/sell arrow offsets when the LWMA/EMA cross conditions fire.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.SilverTrendIndicator[source]

Bases: Indicator

Reconstructs SilverTrend_Signal from its MQ5 source.

Uses SSP-period average range to compute smin/smax bands. K = RISK * 100. smin = SsMin + (SsMax - SsMin) * K / 100 smax = SsMax - (SsMax - SsMin) * K / 100 Trend toggles: close < smin → downtrend, close > smax → uptrend. Buy arrow on uptrend toggle, sell arrow on downtrend toggle.

__init__(*args, **kwargs)
next()[source]

Update the adaptive bands and emit buy/sell arrows on trend flips.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.SlidingRangeColor[source]

Bases: Indicator

Indicator computing sliding-window average range channels with a color index for breakout direction.

next()[source]

Compute rounded average of recent highs/lows and set color based on close relative to the range.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.SlowStoch[source]

Bases: Indicator

EMA-smoothed slow stochastic exposing an oscillator and a signal line.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.SmoothedADXIndicator[source]

Bases: Indicator

ADX/DI system with each line smoothed by a configurable moving average.

Computes raw +DI, -DI and ADX over adx_period and exposes moving-average smoothed versions on the plus_di, minus_di and adx lines.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.SmoothedRsi[source]

Bases: Indicator

Smooth RSI value using an outer simple moving average.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.SpearmanRankCorrelationHistogram[source]

Bases: Indicator

Compute a Spearman-rank-style correlation histogram and regime color.

__init__(*args, **kwargs)
next()[source]

Compute one step of correlation value and color code.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.StalinIndicator[source]

Bases: Indicator

Reconstructs Stalin indicator from its MQ5 source.

Uses Fast/Slow MA crossover with optional RSI filter. BU() fires buy arrow at low if flat distance check passes. BD() fires sell arrow at high if flat distance check passes. Optional Confirm parameter adds a price-distance confirmation step.

__init__(*args, **kwargs)
next()[source]

Compute MA crossover and optional RSI filters, then emit buy/sell arrows.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.StarterLaguerreFilter[source]

Bases: Indicator

Laguerre filter oscillator bounded in the [0, 1] range.

Implements Ehlers’ four-stage Laguerre filter and converts the staged values into a normalised oscillator. Readings near 0 indicate oversold conditions and readings near 1 indicate overbought conditions.

__init__(*args, **kwargs)
next()[source]

Advance the Laguerre stages and emit the normalised oscillator value.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.StepMANRTRIndicator[source]

Bases: Indicator

Reconstructs StepMA_NRTR indicator.

StepSizeCalc: Volty-based step size from ATR-like calculation. StepMACalc: Trend-following MA with NRTR ratchet. 4 buffers: UpBuffer(0), DnBuffer(1), BuySignal(2), SellSignal(3). Buy when trend flips from down to up. Sell on reverse.

__init__(*args, **kwargs)
next()[source]

Compute trend-up/down lines and buy/sell trigger levels for this bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.StochasticHistogramIndicator[source]

Bases: Indicator

Stochastic-based indicator with a smoothed main line, signal line, and color state.

The indicator outputs: - main: smoothed %K values. - signal: smoothed trigger line derived from main. - hist_base: fixed base reference line (50.0). - color_state: 0 for overbought, 1 for neutral, 2 for oversold.

__init__(*args, **kwargs)
next()[source]

Compute indicator values for one new bar in Backtrader streaming mode.

once(start, end)[source]

Compute indicator arrays for run-once mode from start to end indices.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.T3AlarmIndicator[source]

Bases: Indicator

Double-smoothed MA slope indicator emitting direction and reversal alarms.

__init__(*args, **kwargs)
next()[source]

Update the direction line and raise buy/sell alarms on slope flips.

once(start, end)[source]

Vectorised batch evaluation of direction and alarm lines.

Parameters:
  • start – Inclusive start index of the range to fill.

  • end – Exclusive end index of the range to fill.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.T3Average[source]

Bases: Indicator

Tillson T3 moving average built from a six-stage EMA cascade.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.T3Trix[source]

Bases: Indicator

TRIX-style oscillator built from fast and slow T3 rate-of-change lines.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.T3Indicator[source]

Bases: Indicator

Tillson T3 moving average — six cascaded EMAs with volume factor.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.The20sV020Signal[source]

Bases: Indicator

Reversal signal from prior-bar 20% zones with an ATR-offset entry.

__init__(*args, **kwargs)
next()[source]

Emit buy/sell signal levels from the prior-bar 20% zone logic.

Resets both lines to zero, and once enough bars exist computes the prior-bar range, its upper/lower 20% zones, and the ATR. Under MODE_1 it flags a reversal when the previous bar spans the band and the current bar breaks beyond it by the level threshold; under MODE_2 it uses a three-bar expansion-then-inside pattern. The direct flag optionally swaps the buy and sell outputs.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ThreeCandlesIndicator[source]

Bases: Indicator

Indicator producing three-candle reversal signal labels.

__init__(*args, **kwargs)
next()[source]

Evaluate bullish/bearish setups and emit normalized signal codes.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ThreeLineBreakIndicator[source]

Bases: Indicator

Three Line Break indicator used as a higher-timeframe trend signal source.

The indicator tracks a directional swing state based on the last lines_break bars. A bearish-to-bullish and bullish-to-bearish shift is confirmed by breakouts above the recent highs or below the recent lows.

Output lines: - trend: 1.0 for bullish trend, 0.0 for bearish trend. - line_high: current bar high value. - line_low: current bar low value.

__init__(*args, **kwargs)
next()[source]

Advance the Three Line Break trend and output the current trend lines.

Returns:

None.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.TimeLine[source]

Bases: Indicator

Time average price line indicator

Calculate the cumulative average of the day’s closing prices as the time average price line

__init__(*args, **kwargs)
next()[source]

Calculate the time average price for the current bar.

This method is called for each bar in the data series. It: 1. Appends the current bar’s close price to the day’s price list 2. Calculates the cumulative average of all prices in the list 3. Resets the price list at the end of the trading day

The time average price line is useful for intraday strategies as it represents the average entry price of all market participants throughout the day.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.TradingChannelIndexProxy[source]

Bases: Indicator

Indicator computing Trading Channel Index (TCI) and quantized state.

__init__(*args, **kwargs)
next()[source]

Compute raw TCI and discretized color state for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.TrendArrowsIndicator[source]

Bases: Indicator

Reconstructs trend_arrows indicator.

Computes AverageHigh (avg of highest highs over iPeriod sub-windows) and AverageLow (avg of lowest lows over iPeriod sub-windows). TrendUp = LL when close > HH; TrendDown = HH when close < LL; else continues previous trend. SignUp when TrendUp appears fresh; SignDown when TrendDown appears fresh. Buffers: 0=TrendUp, 1=TrendDown, 2=SignUp(buy), 3=SignDown(sell).

__init__(*args, **kwargs)
next()[source]

Compute trend and signal buffers for the current bar.

The method: 1. Splits the lookback window into iperiod sub-windows and averages highs/lows. 2. Generates TrendUp/TrendDown buffers based on close relative to aggregated levels. 3. Emits SignUp/SignDown only on fresh transitions from inactive to active.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.TrendContinuationIndicator[source]

Bases: Indicator

Momentum continuation indicator using smoothed up/down directional components.

__init__(*args, **kwargs)
next()[source]

Compute smoothed up/down continuation values from directional price differences.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.TrendIntensityIndexProxy[source]

Bases: Indicator

Indicator computing Trend Intensity Index (TII) and quantized state.

__init__(*args, **kwargs)
next()[source]

Compute normalized TII value and discretized color state.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.TrendManagerIndicator[source]

Bases: Indicator

Simple MA-based trend indicator generating color state.

__init__(*args, **kwargs)
next()[source]

Update trend lines and color state on each bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.TriXCandleIndicator[source]

Bases: Indicator

Indicator that transforms TRIX values into a candle-style representation.

__init__(*args, **kwargs)
next()[source]

Compute per-bar TRIX O/H/L/C proxy values and color state.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.TriggerLine[source]

Bases: Indicator

Trigger-line indicator tracking momentum-driven main and signal lines.

__init__(*args, **kwargs)
next()[source]

Compute main and signal values for current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.TripleEmaRate[source]

Bases: Indicator

TRIX: the bar-over-bar rate of change of a triple-smoothed EMA.

__init__(*args, **kwargs)
next()[source]

Emit the fractional change of the triple EMA versus the prior bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.TRVIIndicator[source]

Bases: Indicator

TRVI indicator combining price-range velocity with volume-weighted smoothing.

__init__(*args, **kwargs)
next()[source]

Compute TRVI and smoothed signal for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ColorRMACDIndicator[source]

Bases: Indicator

Custom RMACD composite indicator with configurable signal MA.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.TwoPbIdealXOSMAIndicator[source]

Bases: Indicator

Compute the smoothed 2pbIdealXOSMA histogram from cascaded ideal-MAs.

__init__(*args, **kwargs)
next()[source]

Advance the ideal-MA cascade and emit the smoothed histogram value.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.UltraAbsolutelyNoLagLwmaColor[source]

Bases: Indicator

Low-lag LWMA range-position oscillator emitting bulls/bears and color.

Positions a smoothed weighted moving average within its recent high/low range to produce bulls/bears strength lines and a color state encoding their dominance and slope across configurable up/down levels.

__init__(*args, **kwargs)
next()[source]

Compute bulls/bears strengths and the color state for this bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.UltraWPRIndicator[source]

Bases: Indicator

Ultra Williams %R oscillator emitting bulls and bears strength lines.

__init__(*args, **kwargs)
next()[source]

Count rising vs falling smoothed WPR lines and emit bulls/bears.

once(start, end)[source]

Vectorized batch computation of bulls/bears over a bar range.

Parameters:
  • start – Index of the first bar to compute (inclusive).

  • end – Index just past the last bar to compute (exclusive).

frompackages = ()
packages = ()
class backtrader.indicators.contrib.UpDownCandleStrength[source]

Bases: Indicator

Up Down Candle Strength Indicator.

This indicator calculates the strength of price movement by measuring the ratio of up candles to down candles over a specified period.

The strength value ranges from 0.0 (all down candles) to 1.0 (all up candles), with 0.5 indicating an equal number of up and down candles.

lines.strength

The calculated strength ratio (0.0 to 1.0).

params.period

The number of periods to analyze for candle strength.

Note

A strength value of 0.5 is returned when there are no clear up or down candles (i.e., all candles have equal open and close prices).

__init__(*args, **kwargs)
next()[source]

Calculate the candle strength ratio for the current bar.

Counts the number of up candles (close > open) and down candles (close < open) over the specified period and calculates the ratio.

The strength value is calculated as:

strength = up_count / (up_count + down_count)

If no candles have clear directional movement (all open == close), the strength is set to 0.5 (neutral).

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.VininITrendIndicator[source]

Bases: Indicator

Indicator that calculates a smoothed trend score from MA comparisons.

__init__(*args, **kwargs)
next()[source]

Compute trend score and one-step EMA-smoothed trend value.

once(start, end)[source]

Compute trend values for startup/backfill path.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.VolumeWeightedMAIndicator[source]

Bases: Indicator

Volume-weighted moving average of an applied price.

Averages the applied price (selected by ipc) over length bars, weighting each bar by its tick volume (or open interest when use_tick_volume is False); falls back to the plain applied price when the total weight is zero.

__init__(*args, **kwargs)
next()[source]

Compute the volume-weighted average price for the current bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.VolumeWeightedMAStDevIndicator[source]

Bases: Indicator

Volume-weighted MA with standard-deviation graded signal lines.

Computes a volume-weighted moving average (vwma) and measures the standard deviation of its change. When the latest change exceeds the dk1/dk2 standard-deviation bands it sets the corresponding bulls1/bulls2 or bears1/bears2 signal lines.

__init__(*args, **kwargs)
next()[source]

Update the VWMA and set graded bull/bear signal lines.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.VWAPCloseIndicator[source]

Bases: Indicator

Reconstructs VWAP_Close indicator.

VWAP = sum(close[i] * volume[i], i=0..n-1) / sum(volume[i], i=0..n-1) Uses tick volume by default. Buffer 0 = VWAP line.

__init__(*args, **kwargs)
next()[source]

Compute and emit the next VWAP-close value.

The calculation uses close*volume weighted average over up to n prior bars and falls back to the previous VWAP value when volume is not available.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.VWMACandle[source]

Bases: Indicator

Volume-weighted candle color indicator.

Computes volume-weighted moving averages of the open and close over length bars and emits a color line of 2.0 (bullish), 0.0 (bearish) or 1.0 (neutral) depending on their relationship.

__init__(*args, **kwargs)
next()[source]

Set the candle color from volume-weighted open vs close.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.VWMADigitSystem[source]

Bases: Indicator

Digit-rounded volume-weighted band color indicator.

Builds digit-rounded volume-weighted high and low levels over length bars and emits a color line encoding whether the close breaks above the upper level or below the lower level, combined with candle direction.

__init__(*args, **kwargs)
next()[source]

Set the band color from close breaks of the weighted levels.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.Wami[source]

Bases: Indicator

Calculate a WAMI-style oscillator and signal line from close-price MAs.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.WPRSISignalIndicator[source]

Bases: Indicator

Reconstructs WPRSIsignal indicator from its MQ5 source.

Uses WPR and RSI with same period. Buy: WPR crosses above -20 from below AND RSI > 50, with filterUP lookback confirmation. Sell: WPR crosses below -80 from above AND RSI < 50, with filterDN lookback confirmation.

__init__(*args, **kwargs)
next()[source]

Emit buy/sell arrows on filtered Williams %R crosses confirmed by RSI.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.XDeMarkerHistogramVolDirectIndicator[source]

Bases: Indicator

Indicator that calculates DeMarker histogram zone and direct trend color.

__init__(*args, **kwargs)
next()[source]

Compute de_marker-derived raw value, smoothing, and colors.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.XFisherIndicator[source]

Bases: Indicator

Fisher Transform of Williams %R position with an EMA-smoothed signal line.

__init__(*args, **kwargs)
next()[source]

Compute the smoothed Fisher value and store it with its lagged signal.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.XCCIHistogramVolDirectIndicator[source]

Bases: Indicator

Direct XCCI histogram indicator producing smoothed value and color state.

__init__(*args, **kwargs)
next()[source]

Compute CCI*volume histogram value and binary color transition.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.XCCIHistogramVolIndicator[source]

Bases: Indicator

Compute volume-scaled XCCI histogram levels and color state.

__init__(*args, **kwargs)
next()[source]

Update scaled CCI, levels, and derived color state.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.XmaIchimoku[source]

Bases: Indicator

Calculate a smoothed midpoint of selected high/low ranges.

__init__(*args, **kwargs)
next()[source]

Compute smoothed range midpoint for each bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.TwoXmaIchimokuOscillator[source]

Bases: Indicator

Combine two XMA windows into oscillator value and color channels.

__init__(*args, **kwargs)
next()[source]

Update oscillator value and derived color trend state.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.XMAIshimokuChannelIndicator[source]

Bases: Indicator

Compute XMA-smoothed midpoint channel lines.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.XMAIshimokuLine[source]

Bases: Indicator

Smoothed Ishimoku-style midprice line.

Computes the midpoint of the rolling highest high and lowest low over the up/down periods, then smooths it with the configured moving average over xlength to produce a single xma trend line.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.XMARangeBandsIndicator[source]

Bases: Indicator

Moving-average midline with range-scaled upper and lower bands.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.XMACDIndicator[source]

Bases: Indicator

Configurable MACD indicator with selectable MA methods and price.

Computes the MACD line as the difference of a fast and slow moving average of a chosen applied price, then a signal line by smoothing the MACD. The moving-average type, signal-smoothing type, periods and applied price are all configurable via parameters.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.XrsiDeMarkerHistogram[source]

Bases: Indicator

Blend RSI and DeMarker into a smoothed histogram line.

__init__(*args, **kwargs)
next()[source]

Compute and smooth the combined histogram value.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.XRSIHistogramVolDirectIndicator[source]

Bases: Indicator

Simple direct XRSI histogram indicator that emits color state transitions.

__init__(*args, **kwargs)
next()[source]

Update scaled RSI values and binary color direction.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.XRSIHistogramVolIndicator[source]

Bases: Indicator

Volume-scaled RSI histogram indicator producing directional color states.

__init__(*args, **kwargs)
next()[source]

Calculate scaled histogram level and classify it into a color state.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.XRVIIndicator[source]

Bases: Indicator

Compute a custom XRVI oscillator and its smoothed signal line.

The indicator relies on candle body delta normalized by range and applies configurable moving-average methods to build both XRVI and signal streams.

__init__(*args, **kwargs)
next()[source]

Advance XRVI and signal values for the current bar.

once(start, end)[source]

Vectorized XRVI and signal computation used by Backtrader runonce mode.

Parameters:
  • start – First bar index to fill into line arrays.

  • end – Exclusive bar index end bound for computed slices.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.ZeroLagMacd[source]

Bases: Indicator

Zero-lag MACD indicator using double-smoothed EMA differences.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.ZigZagRecentPivotSignal[source]

Bases: Indicator

Custom indicator tracking local pivot age and pivot price breakout channels.

Lines:

signal (Line): Pivot direction signal line (1 for high, -1 for low). pivot_age (Line): Age of the confirmed pivot in bars. pivot_price (Line): Confirmed pivot price level.

__init__(*args, **kwargs)
next()[source]

Calculate local ZigZag pivot high and low levels on each new bar.

frompackages = ()
once(start, end)

Implement once using next for batch calculation.

This is used when next is overridden but once is not. It loops through the range and calls next for each step.

Parameters:
  • start – Starting index

  • end – Ending index

oncestart(start, end)

Implement oncestart using nextstart for batch calculation.

This is used when nextstart is overridden but oncestart is not.

Parameters:
  • start – Starting index

  • end – Ending index

packages = ()
preonce(start, end)

Implement preonce using prenext for batch calculation.

This is a generic implementation if prenext is overridden but preonce is not. It loops through the range and calls prenext for each step.

Parameters:
  • start – Starting index

  • end – Ending index

class backtrader.indicators.contrib.ZPFIndicator[source]

Bases: Indicator

Zero Power Flow oscillator (volume-weighted MA spread).

Multiplies a moving average of volume by the gap between a short and a long moving average of an applied price, producing a volume-weighted trend-strength value (zpf) that oscillates around zero, with symmetric line1/line2 envelopes.

__init__(*args, **kwargs)
frompackages = ()
packages = ()

Submodules