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[源代码]

基类:Indicator

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

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

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.AccumulationDistributionLine[源代码]

基类:Indicator

Accumulate the ADL indicator from price and volume progression.

next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ChaikinOscillator[源代码]

基类:Indicator

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

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

基类:Indicator

Custom CCI computation on the selected input data.

next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.CCIDualOnMA[源代码]

基类:Indicator

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

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

基类: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()[源代码]

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

once(start, end)[源代码]

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

参数:
  • 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[源代码]

基类: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()[源代码]

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

once(start, end)[源代码]

Vectorized batch computation of smoothed breadth counts over a range.

参数:
  • 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[源代码]

基类:Indicator

DMI direction indicator exposing plus/minus directional values.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.AIAccelerationDecelerationOscillator[源代码]

基类:Indicator

Indicator computing acceleration/deceleration oscillator from SMA spread.

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

基类:Indicator

Adaptive trend breakout indicator used by the strategy.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.AnchoredMomentumLine[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.AnchoredMomentumCandleIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.AnyRangeCldTailIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.AroonHornSignIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.AroonOscillatorSignAlert[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ArrowsCurvesIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ASCtrendIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.AsimmetricStochNRIndicator[源代码]

基类:Indicator

Asymmetric stochastic oscillator indicator with dynamic MA smoothing.

__init__(*args, **kwargs)
next()[源代码]

Compute current stoch and signal values using the active periods.

once(start, end)[源代码]

Batch compute indicator lines for historical range in one pass.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.AtrNormalizeHistogram[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.AverageChangeCandle[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.BBSqueezeIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.BezierStDevIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.BinaryWaveIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

Update raw and smoothed wave values for a single bar.

once(start, end)[源代码]

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

参数:
  • start -- Start index for batch evaluation.

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

frompackages = ()
packages = ()
class backtrader.indicators.contrib.BlauCMomentumIndicator[源代码]

基类:Indicator

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

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

基类:Indicator

Compute the CMI oscillator from nested moving averages of momentum.

__init__(*args, **kwargs)
next()[源代码]

Populate the indicator value on a per-bar basis.

once(start, end)[源代码]

Compute indicator values in a vectorized range for Backtrader backfills.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.BlauCSI[源代码]

基类:Indicator

Blau CSI indicator built from smoothed momentum vs. range.

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

基类: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[源代码]

基类:Indicator

Indicator generating a smoothed Blau T-Stoch histogram.

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

基类: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[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.BrainTrend2Indicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.AbsolutelyNoLagLwmaIndicator[源代码]

基类:Indicator

No-lag LWMA indicator with color state transitions.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.BrainTrendSignalProxy[源代码]

基类:Indicator

Signal proxy that combines ATR and stochastic cross conditions.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.BrakeParbIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.BreakoutBarsTrendV2[源代码]

基类: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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

next()[源代码]

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

class backtrader.indicators.contrib.BSIIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.BullsBearsEyes[源代码]

基类:Indicator

Rebuild a signal oscillator from recursive smoothed directional momentum.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.BullsPower[源代码]

基类:Indicator

Indicator for Bulls Power built from high price minus EMA.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.BearsPower[源代码]

基类:Indicator

Indicator for Bears Power built from low price minus EMA.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.BWWiseMan1Signal[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.BykovTrendIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.CandleStopColor[源代码]

基类:Indicator

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

next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.CandlesXSmoothedIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.CandlesticksBW[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.CaudateXPeriodCandleColor[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.CCIHistogramIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.CCIWoodiesIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.CenterOfGravityCandleIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.CenterOfGravityIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.CGOscillator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.CloseLineCCI[源代码]

基类: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[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.Color3rdGenXMAIndicator[源代码]

基类: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[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ColorCoppockIndicator[源代码]

基类:Indicator

Compute Coppock oscillator value and its directional color state.

__init__(*args, **kwargs)
next()[源代码]

Update value and color for the current bar.

once(start, end)[源代码]

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

frompackages = ()
packages = ()
class backtrader.indicators.contrib.ColorHMA[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ColorJVariationIndicator[源代码]

基类:Indicator

Indicator deriving a custom color variation series from MA residuals.

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

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ColorMetroStochasticIndicator[源代码]

基类:Indicator

Indicator producing adaptive fast/slow ColorMETRO stochastic levels.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ColorMetroWprIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ColorSchaffDeMarkerTrendCycle[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ColorSchaffTrendCycleIndicator[源代码]

基类:Indicator

Custom indicator producing Schaff Trend Cycle value and color states.

__init__(*args, **kwargs)
next()[源代码]

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

once(start, end)[源代码]

Compute indicator output in vectorized mode for backtest startup.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.ColorStepXCCXIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

Update fast and slow channel lines on the next bar.

once(start, end)[源代码]

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

frompackages = ()
packages = ()
class backtrader.indicators.contrib.ColorX2MA[源代码]

基类:Indicator

Indicator that outputs smoothed MA value and directional color index.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ColorXDerivative[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ColorZerolagDeMarker[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.CorrectedAverageIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

Compute the corrected average for the current bar.

once(start, end)[源代码]

Vectorized corrected-average computation over the array index range.

参数:
  • 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[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.DemaRangeChannelColor[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.DerivativeIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.DigitalFT01Indicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.DigitalMacd[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.DonchianChannelsSystem[源代码]

基类:Indicator

Donchian-channel indicator emitting breakout-oriented color states.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.DotsIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.EFDistanceIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.EmaRsiVa[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.EnvelopesJpAlonso[源代码]

基类:Indicator

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

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

基类: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()[源代码]

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)[源代码]

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.

参数:
  • start -- First bar index to process.

  • end -- Stop index (exclusive) for processing.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.FatlFilter[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.JFatlApprox[源代码]

基类:Indicator

Double-smoothed approximation indicator built from JFatl coefficients.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.JFatlCandleApprox[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.FiboCandlesIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.FineTuningMA[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
frompackages = ()
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.FisherOrgV1[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.FisherOrgV1Sign[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ForceIndexEMA[源代码]

基类:Indicator

Indicator producing a smoothed force index.

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

基类:Indicator

Divergence signal detector built from two force-index EMAs.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ForceIndexEma[源代码]

基类:Indicator

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

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

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.FractalAMAMBK[源代码]

基类:Indicator

FRAMA-style indicator exposing smoothed trend and trigger lines.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.FramaSeries[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.FramaLinesIndicator[源代码]

基类:Indicator

FrAMA candle indicator emitting smoothed OHLC and a color line.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.FRASMAv2Indicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.GOIndicator[源代码]

基类:Indicator

Indicator that derives a GO signal from smoothed OHLC components.

__init__(*args, **kwargs)
next()[源代码]

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

once(start, end)[源代码]

Compute GO for buffered bars in run-once mode.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.HLRIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ZeroLagHLRIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.HMA[源代码]

基类:Indicator

Hull Moving Average indicator used by OsHMA.

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

基类:Indicator

Histogram indicator that combines fast and slow HMA lines.

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

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.I4DRFV3[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.IAnchMomIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.IDeMarkerSignIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.IGapIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.IStochKomposterIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ITrendIndicator[源代码]

基类: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[源代码]

基类:Indicator

Indicator implementation of i-AMMA value progression.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.IndexedMovingAverage[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.InstantaneousTrendFilterIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.InverseReactionIndicator[源代码]

基类:Indicator

Indicator that tracks candle reaction amplitude and dynamic thresholds.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.IRSISignIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.IWPRSignIndicator[源代码]

基类:Indicator

Indicator computing WPR buy/sell levels with ATR context.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.JBrainTrend1SigIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.UltraRSIIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.JTpoProxy[源代码]

基类:Indicator

Proxy oscillator measuring close deviation from its moving average.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.JMASlopeIndicator[源代码]

基类: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[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.KalmanFilterLine[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.KalmanFilterCandleIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.KAMAIndicator[源代码]

基类:Indicator

Kaufman Adaptive Moving Average with both event and vectorized modes.

__init__(*args, **kwargs)
next()[源代码]

Compute the adaptive moving average for the current bar.

once(start, end)[源代码]

Vectorized KAMA computation over the array index range.

参数:
  • 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[源代码]

基类:Indicator

EMA-smoothed momentum line used by the ColorMomentum_AMA strategy.

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

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.KDJIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.KwanCccIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.KwanNrpIndicator[源代码]

基类:Indicator

Compute smoothed KWAN_NRP value and direction direction states.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.KwanRdpIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.LaguerreAdxIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.LaguerreFilterIndicator[源代码]

基类:Indicator

Laguerre smoothing indicator with finite impulse response fallback lines.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.LaguerrePlusDiProxy[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.LaguerreRocIndicator[源代码]

基类:Indicator

Laguerre ROC indicator emitting value, midline, and color.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.LeManSignalIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.LinearRegSlopeV2Indicator[源代码]

基类: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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

next()[源代码]

Update one bar of regression slope and trigger calculations.

class backtrader.indicators.contrib.LocoIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.LRMAIndicator[源代码]

基类:Indicator

Linear regression moving average projected to the latest bar.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ChangeOfVolatilityIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.VininITrendLRMAIndicator[源代码]

基类:Indicator

Trend oscillator scoring LRMA against a fan of moving averages.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.LsmaAngleIndicator[源代码]

基类: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.

参数:
  • 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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.MARoundingChannelIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.Macd2Indicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.MacdCandleIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.MalrIndicator[源代码]

基类:Indicator

Compute MALR trend channels used for breakout-trigger detection.

__init__(*args, **kwargs)
next()[源代码]

Calculate MALR center and channel boundaries for the current bar.

once(start, end)[源代码]

Vectorized computation path for backtesting efficiency.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.MomentumCandleSignIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.MovingAverageFNIndicator[源代码]

基类:Indicator

FIR moving average built from named filter coefficients plus smoothing.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.Mt5StochasticCloseClose[源代码]

基类:Indicator

Close-close based Smoothed Stochastic oscillator implementation.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.MUVNorDiffCloudIndicator[源代码]

基类:Indicator

Calculate normalized DIFF cloud signals used by the strategy.

__init__(*args, **kwargs)
next()[源代码]

Compute cloud values for the current bar.

once(start, end)[源代码]

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

frompackages = ()
packages = ()
class backtrader.indicators.contrib.NonLagDotIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.NRTRExtrIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.NRTRIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.PChannelSystem[源代码]

基类:Indicator

Indicator that classifies current bar position versus rolling channel bounds.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.PercentEnvelope[源代码]

基类:Indicator

Percent envelope built from a moving-average midpoint.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.PercentageCrossoverChannel[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.PivotZigZagProxy[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.PriceChannelStopIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.PriceExtremeChannel[源代码]

基类: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[源代码]

基类:Indicator

Indicator computing smoothed QQE-like trend values from RSI.

参数:
  • 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()[源代码]

Update output lines on each tick using previous envelope state.

once(start, end)[源代码]

Vectorized indicator evaluation for vectorized Backtrader runs.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.RaviIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.RawCloseCloseStochastic[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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

once(start, end)[源代码]

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

参数:
  • 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[源代码]

基类:Indicator

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

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

基类:Indicator

Custom indicator that derives normalized range-trend trigger values.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.RenkoLevel[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.RenkoLineBreak[源代码]

基类:Indicator

Indicator that models renko-like box transitions.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.RFTLIndicator[源代码]

基类:Indicator

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

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

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ROC2VGIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.RSIHistogramIndicator[源代码]

基类:Indicator

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

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.RSISlowdown[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.RsiomaV2[源代码]

基类: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[源代码]

基类:Indicator

Relative Vigor Index with a smoothed signal line and color state.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.SafeADX[源代码]

基类:Indicator

ADX indicator implementation without division by zero pitfalls.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.SafeAMA[源代码]

基类:Indicator

Adaptive moving average indicator with safe initialization.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.SkyscraperFixIndicator[源代码]

基类:Indicator

Channel-like adaptive indicator emitting buy/sell buffers and color state.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.SkyscraperFixDuplexIndicator[源代码]

基类:Indicator

Indicator for directional buffer-based skyline reversals.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.SkyscraperFixColorAMLIndicator[源代码]

基类:Indicator

Skyscraper fix channel indicator producing buy/sell buffers and color state.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.AppliedPriceCCI[源代码]

基类:Indicator

Commodity Channel Index computed on an arbitrary applied-price line.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ColorAMLIndicator[源代码]

基类:Indicator

Fractal-driven adaptive moving line with trend color transitions.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ColorAMLMeanReversionIndicator[源代码]

基类:Indicator

Adaptive moving-lowpass indicator for color-state trend capture.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.X2MACandleApprox[源代码]

基类:Indicator

Two-stage moving approximation of candle structure and color.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.XPeriodCandleColor[源代码]

基类:Indicator

Smoothing-based period-candle indicator producing color index.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.XPeriodCandleSystemColor[源代码]

基类:Indicator

SMA-smoothed candle color indicator with Bollinger Band breakout detection.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.AcceleratorOscillator[源代码]

基类:Indicator

Compute accelerator oscillator using short and long SMA of median price.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.AIAcceleratorOscillator[源代码]

基类:Indicator

Accelerator Oscillator indicator computed from Awesome Oscillator.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.AdaptiveMarketLevel[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.AmlIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.FunctionalAwesomeOscillator[源代码]

基类:Indicator

Awesome Oscillator: fast minus slow SMA of the median price.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.AIAwesomeOscillator[源代码]

基类:Indicator

Awesome Oscillator indicator using two SMAs on the price midpoint.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.BlauErgodicMDI[源代码]

基类:Indicator

Calculate layered EMA histograms used as the Blau Ergodic MDI signal.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.BlauErgodicMDIClassic[源代码]

基类:Indicator

Ergodic MDI indicator with up/down/histogram smoothing channels.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.BrakeExpIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.FlatTrendIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.FlatTrendDistanceIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.IinMASignalIndicator[源代码]

基类:Indicator

Cross-period MA signal indicator producing buy/sell trigger levels.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.KDJ[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.LaguerreIndicator[源代码]

基类:Indicator

Laguerre RSI-style oscillator over a four-stage Laguerre filter.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.LaguerreColorIndicator[源代码]

基类:Indicator

Ehlers Laguerre RSI oscillator with high/low colour-state transitions.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.RelativeVigorIndex[源代码]

基类:Indicator

Relative Vigor Index (RVI) with its 4-point symmetric signal line.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.SmoothedRelativeVigorIndex[源代码]

基类:Indicator

Relative Vigor Index indicator with smoothed signal line.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.SafeCCI[源代码]

基类:Indicator

Safe Commodity Channel Index indicator with guarded zero-variance handling.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.SafeCCIWithFactor[源代码]

基类:Indicator

CCI indicator with mean deviation, returning 0.0 when denominator is zero.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.SilverTrendSignalProxy[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.SilverTrendDirectionSignalProxy[源代码]

基类:Indicator

Proxy indicator emitting +1/-1 on SMA crossover direction flips.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.SidusIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.SilverTrendIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.SlidingRangeColor[源代码]

基类:Indicator

Indicator computing sliding-window average range channels with a color index for breakout direction.

next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.SlowStoch[源代码]

基类:Indicator

EMA-smoothed slow stochastic exposing an oscillator and a signal line.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.SmoothedADXIndicator[源代码]

基类: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[源代码]

基类:Indicator

Smooth RSI value using an outer simple moving average.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.SpearmanRankCorrelationHistogram[源代码]

基类:Indicator

Compute a Spearman-rank-style correlation histogram and regime color.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.StalinIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.StarterLaguerreFilter[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.StepMANRTRIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.StochasticHistogramIndicator[源代码]

基类: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()[源代码]

Compute indicator values for one new bar in Backtrader streaming mode.

once(start, end)[源代码]

Compute indicator arrays for run-once mode from start to end indices.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.T3AlarmIndicator[源代码]

基类:Indicator

Double-smoothed MA slope indicator emitting direction and reversal alarms.

__init__(*args, **kwargs)
next()[源代码]

Update the direction line and raise buy/sell alarms on slope flips.

once(start, end)[源代码]

Vectorised batch evaluation of direction and alarm lines.

参数:
  • 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[源代码]

基类:Indicator

Tillson T3 moving average built from a six-stage EMA cascade.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.T3Trix[源代码]

基类:Indicator

TRIX-style oscillator built from fast and slow T3 rate-of-change lines.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.T3Indicator[源代码]

基类:Indicator

Tillson T3 moving average — six cascaded EMAs with volume factor.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.The20sV020Signal[源代码]

基类:Indicator

Reversal signal from prior-bar 20% zones with an ATR-offset entry.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ThreeCandlesIndicator[源代码]

基类:Indicator

Indicator producing three-candle reversal signal labels.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ThreeLineBreakIndicator[源代码]

基类: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()[源代码]

Advance the Three Line Break trend and output the current trend lines.

返回:

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.TimeLine[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.TradingChannelIndexProxy[源代码]

基类:Indicator

Indicator computing Trading Channel Index (TCI) and quantized state.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.TrendArrowsIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.TrendContinuationIndicator[源代码]

基类:Indicator

Momentum continuation indicator using smoothed up/down directional components.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.TrendIntensityIndexProxy[源代码]

基类:Indicator

Indicator computing Trend Intensity Index (TII) and quantized state.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.TrendManagerIndicator[源代码]

基类:Indicator

Simple MA-based trend indicator generating color state.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.TriXCandleIndicator[源代码]

基类:Indicator

Indicator that transforms TRIX values into a candle-style representation.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.TriggerLine[源代码]

基类:Indicator

Trigger-line indicator tracking momentum-driven main and signal lines.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.TripleEmaRate[源代码]

基类:Indicator

TRIX: the bar-over-bar rate of change of a triple-smoothed EMA.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.TRVIIndicator[源代码]

基类:Indicator

TRVI indicator combining price-range velocity with volume-weighted smoothing.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ColorRMACDIndicator[源代码]

基类:Indicator

Custom RMACD composite indicator with configurable signal MA.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.TwoPbIdealXOSMAIndicator[源代码]

基类:Indicator

Compute the smoothed 2pbIdealXOSMA histogram from cascaded ideal-MAs.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.UltraAbsolutelyNoLagLwmaColor[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.UltraWPRIndicator[源代码]

基类:Indicator

Ultra Williams %R oscillator emitting bulls and bears strength lines.

__init__(*args, **kwargs)
next()[源代码]

Count rising vs falling smoothed WPR lines and emit bulls/bears.

once(start, end)[源代码]

Vectorized batch computation of bulls/bears over a bar range.

参数:
  • 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[源代码]

基类: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.

备注

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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.VininITrendIndicator[源代码]

基类:Indicator

Indicator that calculates a smoothed trend score from MA comparisons.

__init__(*args, **kwargs)
next()[源代码]

Compute trend score and one-step EMA-smoothed trend value.

once(start, end)[源代码]

Compute trend values for startup/backfill path.

frompackages = ()
packages = ()
class backtrader.indicators.contrib.VolumeWeightedMAIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.VolumeWeightedMAStDevIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.VWAPCloseIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.VWMACandle[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.VWMADigitSystem[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.Wami[源代码]

基类:Indicator

Calculate a WAMI-style oscillator and signal line from close-price MAs.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.WPRSISignalIndicator[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.XDeMarkerHistogramVolDirectIndicator[源代码]

基类:Indicator

Indicator that calculates DeMarker histogram zone and direct trend color.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.XFisherIndicator[源代码]

基类:Indicator

Fisher Transform of Williams %R position with an EMA-smoothed signal line.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.XCCIHistogramVolDirectIndicator[源代码]

基类:Indicator

Direct XCCI histogram indicator producing smoothed value and color state.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.XCCIHistogramVolIndicator[源代码]

基类:Indicator

Compute volume-scaled XCCI histogram levels and color state.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.XmaIchimoku[源代码]

基类:Indicator

Calculate a smoothed midpoint of selected high/low ranges.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.TwoXmaIchimokuOscillator[源代码]

基类:Indicator

Combine two XMA windows into oscillator value and color channels.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.XMAIshimokuChannelIndicator[源代码]

基类:Indicator

Compute XMA-smoothed midpoint channel lines.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.XMAIshimokuLine[源代码]

基类: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[源代码]

基类:Indicator

Moving-average midline with range-scaled upper and lower bands.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.XMACDIndicator[源代码]

基类: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[源代码]

基类:Indicator

Blend RSI and DeMarker into a smoothed histogram line.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.XRSIHistogramVolDirectIndicator[源代码]

基类:Indicator

Simple direct XRSI histogram indicator that emits color state transitions.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.XRSIHistogramVolIndicator[源代码]

基类:Indicator

Volume-scaled RSI histogram indicator producing directional color states.

__init__(*args, **kwargs)
next()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.XRVIIndicator[源代码]

基类: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()[源代码]

Advance XRVI and signal values for the current bar.

once(start, end)[源代码]

Vectorized XRVI and signal computation used by Backtrader runonce mode.

参数:
  • 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[源代码]

基类:Indicator

Zero-lag MACD indicator using double-smoothed EMA differences.

__init__(*args, **kwargs)
frompackages = ()
packages = ()
class backtrader.indicators.contrib.ZigZagRecentPivotSignal[源代码]

基类: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()[源代码]

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.

参数:
  • 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.

参数:
  • 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.

参数:
  • start -- Starting index

  • end -- Ending index

class backtrader.indicators.contrib.ZPFIndicator[源代码]

基类: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