Indicators

class AdaptiveMovingAverage

Bases: object

An 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: object

The 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: object

An 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
name
period
reset()
update_raw(high, low, close)
value
class Bias

Bases: object

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: object

handle_bar(bar)
handle_quote_tick(quote)
handle_trade_tick(trade)
has_inputs
initialized
k
lower
middle
name
period
reset()
update_raw(high, low, close)
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: object

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: object

handle_bar(bar)
has_inputs
initialized
name
period
reset()
scalar
update_raw(high, low, close)
value
class DirectionalMovement

Bases: object

handle_bar(bar)
has_inputs
initialized
name
neg
period
pos
reset()
update_raw(high, low)
class DonchianChannel

Bases: object

handle_bar(bar)
has_inputs
initialized
lower
middle
name
period
reset()
update_raw(high, low)
upper
class DoubleExponentialMovingAverage

Bases: object

The 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: object

An 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.

handle_bar(bar)
has_inputs
initialized
name
period
reset()
update_raw(value)
value
class ExponentialMovingAverage

Bases: object

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 FuzzyCandle

Bases: object

body_size
direction
lower_wick_size
size
upper_wick_size
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: object

An 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: object

chikou_span
displacement
handle_bar(bar)
has_inputs
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 OHLC values.

class KeltnerChannel

Bases: object

atr_floor
handle_bar(bar)
has_inputs
initialized
k_multiplier
lower
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: object

fast_period
handle_bar(bar)
has_inputs
initialized
name
reset()
signal_period
slow_period
update_raw(high, low, close, volume)
value
class LinearRegression

Bases: object

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: object

count
fast_period
handle_bar(bar)
handle_quote_tick(quote)
handle_trade_tick(trade)
has_inputs
initialized
name
reset()
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: object

handle_bar(bar)
has_inputs
initialized
name
period
reset()
update_raw(open, 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: object

handle_bar(bar)
handle_quote_tick(quote)
handle_trade_tick(trade)
has_inputs
initialized
name
period
reset()
update_raw(price)
use_log
value
class RelativeStrengthIndex

Bases: object

An 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: object

An 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
name
period
reset()
scalar
update_raw(close)
value
class SimpleMovingAverage

Bases: object

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: object

An 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: object

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: object

Method 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: object

alpha
cmo_pct
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: object

handle_bar(bar)
handle_quote_tick(quote)
handle_trade_tick(trade)
has_inputs
initialized
name
period
reset()
update_raw(close)
value
class VolatilityRatio

Bases: object

fast_period
handle_bar(bar)
handle_quote_tick(quote)
handle_trade_tick(trade)
has_inputs
initialized
name
reset()
slow_period
update_raw(high, low, close)
use_previous
value
value_floor
class VolumeWeightedAveragePrice

Bases: object

handle_bar(bar)
has_inputs
initialized
name
reset()
update_raw(value, volume, ts)
value
class WeightedMovingAverage

Bases: object

An 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: object

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