Indicators¶
Technical analysis indicators.
- class AdaptiveMovingAverage¶
Bases:
objectAn indicator which calculates an adaptive moving average (AMA) across a rolling window. Developed by Perry Kaufman, the AMA is a moving average designed to account for market noise and volatility. The AMA will closely follow prices when the price swings are relatively small and the noise is low. The AMA will increase lag when the price swings increase.
- alpha_diff¶
- alpha_fast¶
- alpha_slow¶
- count¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- name¶
- period_efficiency_ratio¶
- period_fast¶
- period_slow¶
- price_type¶
- reset()¶
- update_raw(value)¶
- value¶
- class ArcherMovingAveragesTrends¶
Bases:
object- fast_period¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- long_run¶
- name¶
- reset()¶
- short_run¶
- signal_period¶
- slow_period¶
- update_raw(close)¶
Updates the indicator with a new raw price value.
- class AroonOscillator¶
Bases:
objectThe Aroon Oscillator calculates the Aroon Up and Aroon Down indicators to determine if an instrument is trending, and the strength of the trend.
- aroon_down¶
- aroon_up¶
- count¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- reset()¶
- update_raw(high, low)¶
- value¶
- class AverageTrueRange¶
Bases:
objectAn indicator which calculates an Average True Range (ATR) across a rolling window.
- count¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- ma_type¶
- name¶
- period¶
- reset()¶
- update_raw(high, low, close)¶
- use_previous¶
- value¶
- value_floor¶
- class Bias¶
Bases:
objectPercentage difference between price and its moving average.
- count¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- reset()¶
- update_raw(close)¶
- value¶
- class BollingerBands¶
Bases:
objectBollinger bands around a moving average.
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- k¶
- lower¶
- middle¶
- name¶
- period¶
- reset()¶
- stddev¶
- update_raw(value)¶
- upper¶
- class BookImbalanceRatio¶
Bases:
object- count¶
- handle_book(book)¶
- has_inputs¶
- initialized¶
- name¶
- reset()¶
- update(best_bid=None, best_ask=None)¶
- value¶
- class CandleBodySize¶
Bases:
object- Large = CandleBodySize.Large¶
- Medium = CandleBodySize.Medium¶
- None = CandleBodySize.None¶
- Small = CandleBodySize.Small¶
- Trend = CandleBodySize.Trend¶
- class CandleDirection¶
Bases:
object- Bear = CandleDirection.Bear¶
- Bull = CandleDirection.Bull¶
- None = CandleDirection.None¶
- class CandleSize¶
Bases:
object- ExtremelyLarge = CandleSize.ExtremelyLarge¶
- Large = CandleSize.Large¶
- Medium = CandleSize.Medium¶
- None = CandleSize.None¶
- Small = CandleSize.Small¶
- VeryLarge = CandleSize.VeryLarge¶
- VerySmall = CandleSize.VerySmall¶
- class CandleWickSize¶
Bases:
object- Large = CandleWickSize.Large¶
- Medium = CandleWickSize.Medium¶
- None = CandleWickSize.None¶
- Small = CandleWickSize.Small¶
- class ChandeMomentumOscillator¶
Bases:
objectChande momentum oscillator.
- count¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- reset()¶
- update_raw(close)¶
- value¶
- class CommodityChannelIndex¶
Bases:
objectCommodity channel index.
- handle_bar(bar)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- reset()¶
- scalar¶
- update_raw(high, low, close)¶
- value¶
- class DirectionalMovement¶
Bases:
objectWilder’s directional movement, smoothed as a running sum.
The up-move is high - previous_high and the down-move is previous_low - low; only the larger of the two contributes, and only when it is positive. The first period movements, which start with the second bar, are summed to seed pos and neg. Later bars update them with smoothed = smoothed - smoothed / period + movement, so both values are on the scale of a period-bar sum of movements. The first complete output arrives after period + 1 bars.
- handle_bar(bar)¶
- has_inputs¶
- initialized¶
- name¶
- neg¶
- period¶
- pos¶
- reset()¶
- update_raw(high, low)¶
- class DonchianChannel¶
Bases:
objectDonchian channel over rolling high and low prices.
- handle_bar(bar)¶
- has_inputs¶
- initialized¶
- lower¶
- middle¶
- name¶
- period¶
- reset()¶
- update_raw(high, low)¶
- upper¶
- class DoubleExponentialMovingAverage¶
Bases:
objectThe Double Exponential Moving Average attempts to a smoother average with less lag than the normal Exponential Moving Average (EMA)
- count¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- price_type¶
- reset()¶
- update_raw(value)¶
- value¶
- class EfficiencyRatio¶
Bases:
objectCalculates Kaufman’s Efficiency Ratio (ER) across a rolling window.
The period must be positive.
For period n, the ratio is:
ER(t) = |P(t) - P(t - n)| / sum(|P(i) - P(i - 1)|, i = t - n + 1 to t)
A full n-period window requires n + 1 prices for n price changes. For finite inputs within the model price range, values range from 0.0 to 1.0: lower values indicate more noise, while 1.0 indicates directional price movement without reversals.
For compatibility, initialized becomes true after n inputs, so the first initialized value covers the n - 1 available price changes.
# References
Kaufman, P. J. (1995). Smarter Trading. McGraw-Hill.
- handle_bar(bar)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- reset()¶
- update_raw(value)¶
- value¶
- class ExponentialMovingAverage¶
Bases:
objectExponential moving average.
- alpha¶
- count¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- price_type¶
- reset()¶
- update_raw(value)¶
- value¶
- class FuzzyCandlesticks¶
Bases:
object- handle_bar(bar)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- reset()¶
- threshold1¶
- threshold2¶
- threshold3¶
- threshold4¶
- update_raw(open, high, low, close)¶
- value¶
- vector¶
- class HullMovingAverage¶
Bases:
objectAn indicator which calculates a Hull Moving Average (HMA) across a rolling window. The HMA, developed by Alan Hull, is an extremely fast and smooth moving average.
- count¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- price_type¶
- reset()¶
- update_raw(value)¶
- value¶
- class IchimokuCloud¶
Bases:
objectIchimoku Kinko Hyo: the five-line cloud chart.
`text tenkan_sen = midpoint(high, low over tenkan_period) kijun_sen = midpoint(high, low over kijun_period) senkou_span_a = (tenkan_sen + kijun_sen) / 2 as computed `displacement - 1` bars ago senkou_span_b = midpoint(high, low over senkou_period) as computed `displacement - 1` bars ago chikou_span = close from `displacement - 1` bars ago `The two Senkou spans form the Kumo (cloud). Charts draw them displacement bars ahead and the Chikou span displacement bars behind; streaming in chronological order, the values visible at bar n are the ones buffered displacement updates ago, that is bar n - displacement + 1.
Each line becomes available at its own bar: tenkan_sen after tenkan_period bars, kijun_sen after kijun_period, chikou_span after displacement, senkou_span_a after kijun_period + displacement - 1, and senkou_span_b after senkou_period + displacement - 1 (77 bars at the classic (9, 26, 52, 26)). The matching has_* flag reports whether each field holds a value, and initialized gates on all five.
- chikou_span¶
- count¶
- displacement¶
- handle_bar(bar)¶
- has_chikou¶
- has_inputs¶
- has_kijun¶
- has_senkou_a¶
- has_senkou_b¶
- has_tenkan¶
- initialized¶
- kijun_period¶
- kijun_sen¶
- name¶
- reset()¶
- senkou_period¶
- senkou_span_a¶
- senkou_span_b¶
- tenkan_period¶
- tenkan_sen¶
- update_raw(high, low, close)¶
Updates the indicator with the given high, low and close.
- class KeltnerChannel¶
Bases:
objectKeltner channel.
- atr_floor¶
- atr_period¶
- handle_bar(bar)¶
- has_inputs¶
- initialized¶
- k_multiplier¶
- lower¶
- ma_type¶
- ma_type_atr¶
- middle¶
- name¶
- period¶
- reset()¶
- update_raw(high, low, close)¶
- upper¶
- use_previous¶
- class KeltnerPosition¶
Bases:
object- atr_floor¶
- handle_bar(bar)¶
- has_inputs¶
- initialized¶
- k_multiplier¶
- name¶
- period¶
- reset()¶
- update_raw(high, low, close)¶
- use_previous¶
- value¶
- class KlingerVolumeOscillator¶
Bases:
objectStephen J. Klinger’s Volume Oscillator: a fast/slow moving-average difference over the per-bar “volume force”.
`text dm_t = high_t - low_t (the daily measurement) trend = sign(hlc_t - hlc_{t-1}), carried over when equal, with hlc = high + low + close cm_t = cm_{t-1} + dm_t while the trend holds cm_t = dm_{t-1} + dm_t when the trend flips vf_t = volume_t * |2 * (dm_t / cm_t - 1)| * trend * 100 KVO_t = MA(vf, fast) - MA(vf, slow) `Klinger’s textbook configuration is fast = 34, slow = 55 with exponential averages, which is the default ma_type.
- fast_period¶
- handle_bar(bar)¶
- has_inputs¶
- initialized¶
- name¶
- reset()¶
- slow_period¶
- update_raw(high, low, close, volume)¶
- value¶
- class LinearRegression¶
Bases:
objectLinear regression over a rolling price window.
- cfo¶
- degree¶
- handle_bar(bar)¶
- has_inputs¶
- initialized¶
- intercept¶
- name¶
- period¶
- r2¶
- reset()¶
- slope¶
- update_raw(close)¶
Updates the linear regression with a new data point.
- value¶
- class MovingAverageConvergenceDivergence¶
Bases:
objectMoving average convergence/divergence, signal, and histogram.
- count¶
- fast_period¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- histogram¶
- initialized¶
- ma_type¶
- name¶
- price_type¶
- reset()¶
- signal¶
- signal_period¶
- slow_period¶
- update_raw(close)¶
- value¶
- class MovingAverageType¶
Bases:
object- DoubleExponential = MovingAverageType.DoubleExponential¶
- Exponential = MovingAverageType.Exponential¶
- Hull = MovingAverageType.Hull¶
- Simple = MovingAverageType.Simple¶
- Wilder = MovingAverageType.Wilder¶
- class OnBalanceVolume¶
Bases:
objectOn-Balance Volume: Granville’s cumulative signed-volume series.
Each bar adds +volume, -volume, or 0 depending on whether its close is above, below, or equal to the previous close. The first bar establishes the baseline at 0.
- handle_bar(bar)¶
- has_inputs¶
- initialized¶
- name¶
- reset()¶
- update_raw(close, volume)¶
- value¶
- class Pressure¶
Bases:
object- handle_bar(bar)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- reset()¶
- update_raw(high, low, close, volume)¶
- value¶
- value_cumulative¶
- class PsychologicalLine¶
Bases:
object- handle_bar(bar)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- reset()¶
- update_raw(close)¶
- value¶
- class RateOfChange¶
Bases:
objectRate of change with configurable output units.
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- mode¶
- name¶
- period¶
- reset()¶
- update_raw(price)¶
- use_log¶
- value¶
- class RateOfChangeMode¶
Bases:
objectOutput convention for [RateOfChange].
- Fraction = RateOfChangeMode.Fraction¶
- Log = RateOfChangeMode.Log¶
- Percentage = RateOfChangeMode.Percentage¶
- Ratio = RateOfChangeMode.Ratio¶
- RatioPercent = RateOfChangeMode.RatioPercent¶
- class RelativeStrengthIndex¶
Bases:
objectAn indicator which calculates a relative strength index (RSI) across a rolling window.
- count¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- reset()¶
- update_raw(value)¶
- value¶
- class RelativeVolatilityIndex¶
Bases:
objectAn indicator which calculates a Relative Volatility Index (RVI) across a rolling window.
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- ma_type¶
- name¶
- period¶
- reset()¶
- scalar¶
- update_raw(close)¶
- value¶
- class SimpleMovingAverage¶
Bases:
objectSimple moving average.
- count¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- price_type¶
- reset()¶
- update_raw(value)¶
- value¶
- class SpreadAnalyzer¶
Bases:
objectAn indicator which calculates the efficiency ratio across a rolling window.
The Kaufman Efficiency measures the ratio of the relative market speed in relation to the volatility, this could be thought of as a proxy for noise.
- average¶
- capacity¶
- current¶
- handle_quote_tick(quote)¶
- has_inputs¶
- initialized¶
- instrument_id¶
- name¶
- reset()¶
- class Stochastics¶
Bases:
objectStochastic oscillator with smoothed K and D outputs.
Defaults to slowing = 1, ma_type = Simple, and d_method = MovingAverage, so D is a simple moving average of K. Select [StochasticsDMethod::Ratio] for the legacy Nautilus range-weighted D calculation.
- d_method¶
- handle_bar(bar)¶
- has_inputs¶
- initialized¶
- ma_type¶
- name¶
- period_d¶
- period_k¶
- reset()¶
- slowing¶
- update_raw(high, low, close)¶
Updates the indicator with raw price values.
# Parameters
high: The high price for the period.
low: The low price for the period.
close: The close price for the period.
- value_d¶
- value_k¶
- class StochasticsDMethod¶
Bases:
objectMethod for calculating %D in the Stochastics indicator.
The %D line is the smoothed version of %K and can provide trading signals. Two calculation methods are supported:
Ratio: Original Nautilus method using 100 * SUM(close-LL) / SUM(HH-LL) over period_d. This is range-weighted and has less lag than MA-based methods.
`MovingAverage`: Uses MA of slowed %K values, compatible with cTrader/MetaTrader/TradingView implementations.
- MovingAverage = StochasticsDMethod.MovingAverage¶
- Ratio = StochasticsDMethod.Ratio¶
- class Swings¶
Bases:
object- changed¶
- direction¶
- duration¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- high_datetime¶
- high_price¶
- initialized¶
- length¶
- low_datetime¶
- low_price¶
- name¶
- period¶
- reset()¶
- since_high¶
- since_low¶
- update_raw(high, low, timestamp)¶
- class VariableIndexDynamicAverage¶
Bases:
objectVariable index dynamic average.
- alpha¶
- cmo_pct¶
- cmo_period¶
- count¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- price_type¶
- reset()¶
- update_raw(value)¶
- value¶
- class VerticalHorizontalFilter¶
Bases:
objectVertical horizontal filter.
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- ma_type¶
- name¶
- period¶
- reset()¶
- update_raw(close)¶
- value¶
- class VolatilityRatio¶
Bases:
objectSchwager volatility ratio.
- count¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- reset()¶
- update_raw(high, low, close)¶
Updates the indicator from high, low, and close prices.
- value¶
- class VolumeWeightedAveragePrice¶
Bases:
objectVolume-weighted average price.
- handle_bar(bar)¶
- has_inputs¶
- initialized¶
- name¶
- reset()¶
- update_raw(value, volume)¶
Adds a price and nonnegative volume to the current manually reset window. Non-finite inputs and negative volume leave state unchanged.
- value¶
- class WeightedMovingAverage¶
Bases:
objectAn indicator which calculates a weighted moving average across a rolling window.
- count¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- price_type¶
- reset()¶
- update_raw(value)¶
- value¶
- weights¶
- class WilderMovingAverage¶
Bases:
objectWilder moving average.
- alpha¶
- count¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- name¶
- period¶
- price_type¶
- reset()¶
- update_raw(value)¶
- value¶
- class ZScore¶
Bases:
objectZ-Score: how many standard deviations the latest price sits from its rolling mean.
`text ZScore = (price - SMA(price, n)) / population_stddev(price, n) `A reading of +2 means price is two standard deviations above its recent average, statistically stretched to the upside; -2 is the mirror. It is the standard normalization behind mean-reversion strategies: a large magnitude flags an extension, a return toward 0 flags reversion. A window with zero dispersion yields 0 rather than dividing by zero.
- count¶
- handle_bar(bar)¶
- handle_quote_tick(quote)¶
- handle_trade_tick(trade)¶
- has_inputs¶
- initialized¶
- mean¶
- name¶
- period¶
- price_type¶
- reset()¶
- std¶
- update_raw(value)¶
Updates the indicator with the given raw price value.
- value¶