API Documentation

Submodules

OnlineTechnicalIndicators is organized into submodules for better code organization:

OnlineTechnicalIndicators.CandlesticksModule
Candlesticks

Submodule containing candlestick/OHLCV data structures and utilities.

Exports

  • OHLCV: Candlestick data structure (Open, High, Low, Close, Volume, Time)
  • OHLCVFactory: Factory for creating OHLCV instances from vectors
  • ValueExtractor: Module with functions to extract values from candlesticks

Example

using OnlineTechnicalIndicators.Candlesticks: OHLCV, OHLCVFactory

# Create a single candlestick
candle = OHLCV(100.0, 105.0, 98.0, 103.0; volume=1000.0)

# Create multiple candlesticks from vectors
factory = OHLCVFactory(opens, highs, lows, closes; volume=volumes)
candles = collect(factory)
source
OnlineTechnicalIndicators.InternalsModule
Internals

Submodule containing internal utility functions for indicator implementation.

Note: These are internal implementation details. While exported for advanced use cases, the API may change between minor versions.

Exports

Type Queries

  • is_multi_input: Check if an indicator requires OHLCV input
  • is_multi_output: Check if an indicator produces multiple output values
  • expected_return_type: Get the expected return type of an indicator

Value Utilities

  • has_output_value: Check if an indicator has a valid output value
  • has_valid_values: Check if a circular buffer has enough valid values
  • always_true: Utility function that always returns true
  • is_valid: Check if a value is not missing

Calculation Functions

  • _fit!: Internal fit function for OnlineStatsBase integration
  • _calculate_new_value: Calculate new value from internal state
  • _calculate_new_value_only_from_incoming_data: Calculate value from incoming data only
source
OnlineTechnicalIndicators.IndicatorsModule
OnlineTechnicalIndicators.Indicators

The Indicators module provides access to all technical indicators for financial analysis.

Categories

  • SISO (Single Input, Single Output): SMA, EMA, RSI, MACD, etc.
  • SIMO (Single Input, Multiple Output): BB, MACD, StochRSI, KST
  • MISO (Multiple Input, Single Output): AccuDist, ATR, OBV, etc.
  • MIMO (Multiple Input, Multiple Output): Stoch, ADX, SuperTrend, etc.

Usage

using OnlineTechnicalIndicators.Indicators

# Create indicators
sma = SMA{Float64}(period=14)
ema = EMA{Float64}(period=10)
rsi = RSI{Float64}(period=14)

# Feed data
for price in prices
    fit!(sma, price)
    fit!(ema, price)
    fit!(rsi, price)
end

# Get values
println(value(sma))
println(value(ema))
println(value(rsi))

See also: OnlineTechnicalIndicators.Patterns

source
OnlineTechnicalIndicators.PatternsModule
OnlineTechnicalIndicators.Patterns

The Patterns module provides access to all candlestick pattern recognition indicators.

Categories

  • Single Candle Patterns: Doji, Hammer, ShootingStar, Marubozu, SpinningTop
  • Two Candle Patterns: Engulfing, Harami, PiercingDarkCloud, Tweezer
  • Three Candle Patterns: Star, ThreeSoldiersCrows, ThreeInside
  • Composite Detector: CandlestickPatternDetector

Usage

using OnlineTechnicalIndicators.Patterns

# Create pattern detectors
doji = Doji{OHLCV{Missing,Float64,Float64}}()
hammer = Hammer{OHLCV{Missing,Float64,Float64}}()

# Or use the comprehensive detector
detector = CandlestickPatternDetector{OHLCV{Missing,Float64,Float64}}()

# Feed data
for candle in candles
    fit!(doji, candle)
    fit!(detector, candle)
end

# Get values
println(value(doji))
println(value(detector))

See also: OnlineTechnicalIndicators.Indicators

source
OnlineTechnicalIndicators.WrappersModule
OnlineTechnicalIndicators.Wrappers

The Wrappers module provides access to wrapper/decorator types for composing indicators.

Wrapper types extend or modify the behavior of other indicators without changing their underlying implementation. They follow the decorator pattern to add functionality like smoothing, DAG integration, or other transformations.

Exports

  • Smoother: Generic wrapper that applies a moving average to any indicator's output
  • DAGWrapper: Wrapper for StatDAG integration with fit! infrastructure

Usage

using OnlineTechnicalIndicators.Wrappers

# Create a smoother that applies SMA(14) to TrueRange
smoother = Smoother(TrueRange; period=14, ma=SMA)

# Feed data
for candle in ohlcv_data
    fit!(smoother, candle)
end
println(value(smoother))

See also: OnlineTechnicalIndicators.Factories

source
OnlineTechnicalIndicators.FactoriesModule
OnlineTechnicalIndicators.Factories

The Factories module provides access to factory functions for creating indicator instances.

Factory functions provide a convenient way to create indicators with specific type parameters or configurations, abstracting away the details of type parameterization.

Exports

  • MovingAverage: Factory function for creating moving average indicators

Usage

using OnlineTechnicalIndicators.Factories

# Create a moving average factory with Float64 type
factory = MovingAverage(Float64)
ma = factory(SMA, period=10)  # Creates SMA{Float64}(period=10)

Deprecated

  • MAFactory: Use MovingAverage instead (deprecated alias maintained for backward compatibility)

See also: OnlineTechnicalIndicators.Wrappers

source

Candlesticks Module

The Candlesticks module contains OHLCV (Open, High, Low, Close, Volume) types and related utilities.

OnlineTechnicalIndicators.Candlesticks.OHLCVType
OHLCV{Ttime,Tprice,Tvol}

Represents OHLCV (Open, High, Low, Close, Volume) candlestick data with optional timestamp.

Fields

  • open::Tprice: Opening price of the period
  • high::Tprice: Highest price during the period
  • low::Tprice: Lowest price during the period
  • close::Tprice: Closing price of the period
  • volume::Tvol: Trading volume during the period (optional, defaults to missing)
  • time::Ttime: Timestamp of the candlestick (optional, defaults to missing)
source
OnlineTechnicalIndicators.Candlesticks.OHLCVFactoryType
OHLCVFactory{Ttime,Tprice,Tvol}

Factory for creating multiple OHLCV candlesticks from vectors of price data.

Fields

  • open::Vector{Tprice}: Vector of opening prices
  • high::Vector{Tprice}: Vector of high prices
  • low::Vector{Tprice}: Vector of low prices
  • close::Vector{Tprice}: Vector of closing prices
  • volume::Vector{Tvol}: Vector of volumes (optional)
  • time::Vector{Ttime}: Vector of timestamps (optional)

Use Base.collect(factory) to generate a vector of OHLCV instances.

source

The ValueExtractor submodule provides helper functions for extracting values from candlesticks:

  • extract_open(candle) - Get the open price
  • extract_high(candle) - Get the high price
  • extract_low(candle) - Get the low price
  • extract_close(candle) - Get the close price
  • extract_volume(candle) - Get the volume

Internals Module

The Internals module contains internal utility functions used by indicator implementations. These are exposed for users who want to implement custom indicators.

OnlineTechnicalIndicators.Internals.is_multi_outputFunction
is_multi_output(ind::Type{<:TechnicalIndicator}) -> Bool

Check if an indicator type produces multiple output values (e.g., MACD, Bollinger Bands).

Returns true if the indicator is a subtype of TechnicalIndicatorMultiOutput.

source
OnlineTechnicalIndicators.Internals.expected_return_typeFunction
expected_return_type(ind::TechnicalIndicatorSingleOutput) -> Type

Get the expected return type for a single-output indicator instance.

source
expected_return_type(ind::TechnicalIndicatorMultiOutput) -> Type

Get the expected return type for a multi-output indicator instance.

For multi-output indicators, this returns the corresponding *Val type (e.g., MACDVal for MACD).

source
expected_return_type(IND::Type{<:TechnicalIndicatorMultiOutput}) -> Type

Get the expected return type for a multi-output indicator type.

source
OnlineTechnicalIndicators.Internals.has_valid_valuesFunction
has_valid_values(sequence::CircBuff, window; exact=false) -> Bool

Check if a circular buffer has enough valid (non-missing) values for a given window.

Arguments

  • sequence: The circular buffer to check
  • window: The required number of valid values
  • exact: If true, checks that exactly window values are valid (for initialization)
source

Internal Fit Implementation

The OnlineStatsBase._fit! method for TechnicalIndicator types is implemented in the Internals module. This function:

  1. Applies input filter and modifier (if present in legacy indicators)
  2. Updates the input values circular buffer (if present)
  3. Fits sub-indicators (if present)
  4. Calculates and stores the new indicator value

Wrappers Module

The Wrappers module contains wrapper/decorator types for composing indicators.

OnlineTechnicalIndicators.Indicators.SmootherType
Smoother(InnerType::Type{<:TechnicalIndicator}; period = SMOOTHER_PERIOD, ma = SMA, input_modifier_return_type = OHLCV{Missing,Float64,Float64})

The Smoother type implements a generic smoothing wrapper that applies a moving average to any indicator's output.

Smoother wraps an inner indicator (e.g., TrueRange, IntradayRange, OBV) and applies a configurable moving average to smooth its output values. This provides a reusable pattern for creating "averaged" versions of indicators like ATR, ADR, ARDR, and SOBV.

Parameters

  • InnerType::Type{<:TechnicalIndicator}: The type of inner indicator to smooth (passed as first argument)
  • period::Integer = 14: The number of periods for the moving average
  • ma::Type = SMA: The moving average type to use (SMA, EMA, SMMA, WMA, etc.)
  • input_modifier_return_type::Type = OHLCV{Missing,Float64,Float64}: Input OHLCV type

Formula

Smoother = MA(InnerIndicator, period)

Input

OHLCV candlestick data compatible with the inner indicator's requirements.

Returns

Union{Missing,T} - The smoothed value, or missing during the warm-up period.

Examples

# Create a smoother that applies SMA(14) to TrueRange (similar to ATR with SMA)
smoother = Smoother(TrueRange; period=14, ma=SMA)

# Create a smoother that applies SMMA(14) to TrueRange (like standard ATR)
smoother = Smoother(TrueRange; period=14, ma=SMMA)

# Create a smoother for IntradayRange with EMA(10)
smoother = Smoother(IntradayRange; period=10, ma=EMA)

# Feed data
for candle in ohlcv_data
    fit!(smoother, candle)
end
println(value(smoother))

See also: ATR, ADR, ARDR, SOBV, TrueRange, IntradayRange, OBV

source
OnlineTechnicalIndicators.DAGWrapperType
DAGWrapper

Wrapper struct that integrates OnlineStatsChains.StatDAG with OnlineTechnicalIndicators' fit! infrastructure.

DAGWrapper allows composed indicators (like DEMA, TEMA, T3) to use StatDAG internally while maintaining compatibility with the standard OnlineStat fit! interface. When fit! is called on an indicator that uses DAGWrapper, data is automatically forwarded to the DAG's source node and propagated through all connected edges.

Fields

  • dag::StatDAG: The underlying OnlineStatsChains StatDAG that manages the indicator chain
  • source_node::Symbol: The entry point node where data is fed into the DAG
  • stats::Vector{OnlineStat}: Vector of OnlineStats for compatibility checks with Series infrastructure

Usage Pattern

DAGWrapper is typically used internally by composed indicators:

using OnlineStatsChains

# Inside a composed indicator constructor (e.g., DEMA)
dag = StatDAG()
add_node!(dag, :ma1, EMA{Float64}(period=10))
add_node!(dag, :ma2, EMA{Float64}(period=10))
connect!(dag, :ma1, :ma2, filter = !ismissing)

# Wrap for compatibility with fit! infrastructure
sub_indicators = DAGWrapper(dag, :ma1, [dag.nodes[:ma1].stat])

When fit!(indicator, data) is called on an indicator using DAGWrapper internally, data flows to the source node and automatically propagates through all filtered edges.

See also: Indicators.DEMA, Indicators.TEMA, Indicators.T3, Indicators.TRIX

source

Factories Module

The Factories module contains factory functions for creating indicator instances.

OnlineTechnicalIndicators.MovingAverageType
MovingAverage

Factory for creating moving average indicators with a specific type parameter.

Fields

  • T::Type: The type parameter to use when constructing the moving average indicator

Usage

factory = MovingAverage(Float64)
ma = factory(SMA, period = 10)  # Creates SMA{Float64}(period = 10)

See also: Indicators.SMA, Indicators.EMA, Indicators.SMMA, Indicators.WMA, Indicators.DEMA, Indicators.TEMA, Indicators.KAMA, Indicators.HMA, Indicators.McGinleyDynamic

source
OnlineTechnicalIndicators.MAFactoryType
MAFactory

DEPRECATED: Use MovingAverage instead.

MAFactory is a deprecated alias for MovingAverage. It is maintained for backward compatibility but will be removed in a future version.

Migration

# Old (deprecated):
factory = MAFactory(Float64)

# New (recommended):
factory = MovingAverage(Float64)
source

Indicators (alphabetically ordered)

OnlineTechnicalIndicators.Indicators.ADRType
ADR{Tohlcv}(; period = ADR_PERIOD, ma = SMA, input_modifier_return_type = Tohlcv)

The ADR type implements an Average Day Range indicator.

ADR measures the average absolute price range by calculating the moving average of IntradayRange (High - Low) over a specified period. Unlike ATR, ADR ignores gaps from the previous close, making it ideal for intraday volatility analysis.

Parameters

  • period::Integer = 14: The number of periods for averaging the Intraday Range
  • ma::Type = SMA: The moving average type to use (default: Simple Moving Average)
  • input_modifier_return_type::Type = Tohlcv: Input type (must be OHLCV-compatible)

Input

OHLCV candlestick data with high and low fields.

Formula

IntradayRange = High - Low
ADR = MA(IntradayRange, period)

Returns

Union{Missing,T} - The average day range value, or missing during the warm-up period.

See also: Smoother, ARDR, IntradayRange, ATR, TrueRange, OHLCV

source
OnlineTechnicalIndicators.Indicators.ARDRType
ARDR{Tohlcv}(; period = ARDR_PERIOD, ma = SMA, input_modifier_return_type = Tohlcv)

The ARDR type implements an Average Relative Day Range indicator.

ARDR measures the average percentage price range by calculating the moving average of RelativeIntradayRange ((High - Low) * 100 / Open) over a specified period. This enables cross-asset volatility comparison by normalizing the range as a percentage.

Parameters

  • period::Integer = 14: The number of periods for averaging the Relative Intraday Range
  • ma::Type = SMA: The moving average type to use (default: Simple Moving Average)
  • input_modifier_return_type::Type = Tohlcv: Input type (must be OHLCV-compatible)

Input

OHLCV candlestick data with open, high, and low fields.

Formula

RelativeIntradayRange = (High - Low) * 100 / Open
ARDR = MA(RelativeIntradayRange, period)

Returns

Union{Missing,T} - The average relative day range as a percentage, or missing during the warm-up period. Bars with Open=0 are skipped in the average.

See also: Smoother, ADR, RelativeIntradayRange, ATR, NATR, OHLCV

source
OnlineTechnicalIndicators.Indicators.ADXType
ADX{Tohlcv}(; di_period = ADX_DI_PERIOD, adx_period = ADX_PERIOD, input_modifier_return_type = Tohlcv)

The ADX type implements an Average Directional Index indicator.

ADX measures trend strength regardless of direction. Values above 25 suggest a strong trend, while values below 20 indicate a weak or non-trending market. The +DI and -DI lines show directional movement: +DI > -DI suggests uptrend, -DI > +DI suggests downtrend.

Parameters

  • di_period::Integer = 14: Period for directional indicator calculation
  • adx_period::Integer = 14: Period for ADX smoothing
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

+DM = high - high_prev (if positive and > -DM, else 0)
-DM = low_prev - low (if positive and > +DM, else 0)
+DI = 100 × smoothed(+DM) / ATR
-DI = 100 × smoothed(-DM) / ATR
DX = 100 × |+DI - -DI| / (+DI + -DI)
ADX = smoothed(DX)

Input

Requires OHLCV data with high, low, and close fields.

Output

  • ADXVal: Contains adx (trend strength 0-100), plus_di, and minus_di

Returns

Union{Missing,ADXVal} - The ADX values, or missing during warm-up.

See also: ATR, Aroon, VTX

source
OnlineTechnicalIndicators.Indicators.ALMAType
ALMA{T}(; period = ALMA_PERIOD, offset = ALMA_OFFSET, sigma = ALMA_SIGMA, input_modifier_return_type = T)

The ALMA type implements an Arnaud Legoux Moving Average indicator.

ALMA uses a Gaussian distribution to weight prices, providing a smooth moving average that can be tuned to emphasize either recent or older data. The offset parameter controls where the curve peaks (1 = recent, 0 = older), and sigma controls the width.

Parameters

  • period::Integer = 9: The number of periods for the moving average
  • offset::Number = 0.85: Controls the Gaussian peak location (0 to 1, higher = more recent)
  • sigma::Number = 6.0: Controls the Gaussian curve width (higher = smoother)
  • input_modifier_return_type::Type = T: Output value type (defaults to input type)

Formula

m = floor((period - 1) × offset)
s = period / sigma
w[i] = exp(-((i - 1 - m)²) / (2 × s²))
ALMA = sum(price[i] × w[i]) / sum(w)

Returns

Union{Missing,T} - The ALMA value, or missing during the warm-up period (first period - 1 observations).

See also: SMA, EMA, WMA

source
OnlineTechnicalIndicators.Indicators.AOType
AO{Tohlcv}(; fast_period = AO_FAST_PERIOD, slow_period = AO_SLOW_PERIOD, fast_ma = SMA, slow_ma = SMA, input_modifier_return_type = Tohlcv)

The AO type implements an Awesome Oscillator indicator.

The Awesome Oscillator measures market momentum by comparing short-term momentum to long-term momentum. It uses the median price (high + low) / 2 and calculates the difference between a fast and slow moving average of this median price.

Parameters

  • fast_period::Integer = 3: The period for the fast moving average
  • slow_period::Integer = 21: The period for the slow moving average
  • fast_ma::Type = SMA: The moving average type for the fast period
  • slow_ma::Type = SMA: The moving average type for the slow period
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

Median Price = (high + low) / 2
AO = SMA(Median Price, fast_period) - SMA(Median Price, slow_period)

Input

Requires OHLCV data with high and low fields.

Returns

Union{Missing,T} - The awesome oscillator value. Positive values indicate bullish momentum, negative values indicate bearish momentum. Returns missing during warm-up.

See also: MACD, RSI

source
OnlineTechnicalIndicators.Indicators.ATRType
ATR{Tohlcv}(; period = ATR_PERIOD, ma = SMMA, input_modifier_return_type = Tohlcv)

The ATR type implements an Average True Range indicator.

ATR measures market volatility by calculating the average of True Range values over a period. Developed by J. Welles Wilder Jr., it's commonly used for position sizing and stop-loss placement.

Parameters

  • period::Integer = 3: The number of periods for averaging the True Range
  • ma::Type = SMMA: The moving average type to use (default: Smoothed Moving Average)
  • input_modifier_return_type::Type = Tohlcv: Input type (must be OHLCV-compatible)

Input

OHLCV candlestick data with high, low, and close fields.

Formula

True Range = max(High - Low, |High - Close_prev|, |Low - Close_prev|)
ATR = MA(True Range, period)

Returns

Union{Missing,T} - The average true range value, or missing during the warm-up period.

See also: Smoother, TrueRange, NATR, IntradayRange, RelativeIntradayRange, ADR, ARDR, OHLCV

source
OnlineTechnicalIndicators.Indicators.AccuDistType
AccuDist{Tohlcv}(; input_modifier_return_type = Tohlcv)

The AccuDist type implements an Accumulation/Distribution Line (ADL) indicator.

The Accumulation/Distribution Line measures the cumulative flow of money into and out of a security. It uses the relationship between the close price and the trading range, weighted by volume. Rising ADL suggests accumulation (buying), falling ADL suggests distribution (selling).

Parameters

  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

MFI = ((close - low) - (high - close)) / (high - low)  # Money Flow Multiplier
MFV = MFI × volume                                      # Money Flow Volume
ADL = ADL_prev + MFV                                    # Cumulative sum

Returns previous value if high equals low (avoids division by zero).

Input

Requires OHLCV data with high, low, close, and volume fields.

Returns

Union{Missing,T} - The cumulative accumulation/distribution value. Available from the first observation.

See also: ChaikinOsc, OBV, ForceIndex, MFI

source
OnlineTechnicalIndicators.Indicators.AroonType
Aroon{Tohlcv}(; period = Aroon_PERIOD, input_modifier_return_type = Tohlcv)

The Aroon type implements an Aroon indicator.

The Aroon indicator measures the time since the most recent high and low within a period. It helps identify trend strength and potential reversals. Aroon Up near 100 indicates a strong uptrend (recent high), while Aroon Down near 100 indicates a strong downtrend.

Parameters

  • period::Integer = 10: The lookback period for the calculation
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

Aroon Up = 100 × (period - days_since_high) / period
Aroon Down = 100 × (period - days_since_low) / period

Input

Requires OHLCV data with high and low fields.

Output

  • AroonVal: Contains up and down values (0-100 scale)

Returns

Union{Missing,AroonVal} - The Aroon values, or missing during warm-up (first period observations).

See also: ADX, VTX, MACD

source
OnlineTechnicalIndicators.Indicators.BBType
BB{T}(; period = BB_PERIOD, std_dev_mult = BB_STD_DEV_MULT, ma = SMA, input_modifier_return_type = T)

The BB type implements a Bollinger Bands indicator.

Bollinger Bands consist of a middle band (moving average) with upper and lower bands at standard deviation intervals. They adapt to volatility: widening during volatile periods and contracting during calm periods. Price touching bands may signal reversals.

Parameters

  • period::Integer = 5: Period for the moving average and standard deviation
  • std_dev_mult::Number = 2.0: Multiplier for standard deviation bands
  • ma::Type = SMA: Moving average type for central band
  • input_modifier_return_type::Type = T: Output value type

Formula

Central = SMA(close, period)
Upper = Central + (std_dev_mult × StdDev(close, period))
Lower = Central - (std_dev_mult × StdDev(close, period))

Output

  • BBVal: Contains upper, central, and lower band values

Returns

Union{Missing,BBVal} - The band values, or missing during warm-up.

See also: KeltnerChannels, DonchianChannels, StdDev

source
OnlineTechnicalIndicators.Indicators.BOPType
BOP{Tohlcv}(; input_modifier_return_type = Tohlcv)

The BOP type implements a Balance Of Power indicator.

Balance of Power measures the strength of buyers vs sellers by comparing the close relative to the open within the high-low range. Values near +1 indicate strong buying pressure (close near high), while values near -1 indicate strong selling pressure (close near low).

Parameters

  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

BOP = (close - open) / (high - low)

Returns the previous value if high equals low (division by zero).

Input

Requires OHLCV data with open, high, low, and close fields.

Returns

Union{Missing,T} - The balance of power value in range [-1, 1]. Available from the first observation.

See also: RSI, OBV

source
OnlineTechnicalIndicators.Indicators.CCIType
CCI{Tohlcv}(; period = CCI_PERIOD, input_modifier_return_type = Tohlcv)

The CCI type implements a Commodity Channel Index.

CCI measures how far the current typical price deviates from its statistical mean. Developed by Donald Lambert, it's used to identify cyclical trends and overbought/oversold conditions.

Parameters

  • period::Integer = 3: The lookback period for the moving average and mean deviation
  • input_modifier_return_type::Type = Tohlcv: Input type (must be OHLCV-compatible)

Input

OHLCV candlestick data with high, low, and close fields.

Formula

Typical Price = (High + Low + Close) / 3
CCI = (Typical Price - SMA(Typical Price)) / (0.015 * Mean Deviation)

The constant 0.015 ensures that approximately 70-80% of CCI values fall between -100 and +100.

Returns

Union{Missing,T} - The CCI value, or missing during the warm-up period. Values above +100 indicate overbought, below -100 indicate oversold.

See also: MeanDev, OHLCV

source
OnlineTechnicalIndicators.Indicators.CHOPType
CHOP{Tohlcv}(; period = CHOP_PERIOD, input_modifier_return_type = Tohlcv)

The CHOP type implements a Choppiness Index indicator.

The Choppiness Index measures whether the market is trending or trading sideways (choppy). Values near 100 indicate a very choppy, range-bound market, while values near 0 indicate a strong trend. The indicator is useful for timing trend-following strategies.

Parameters

  • period::Integer = 14: The number of periods for the calculation
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

CHOP = 100 × log10(sum(ATR, period) / (highest_high - lowest_low)) / log10(period)

Input

Requires OHLCV data with high, low, and close fields.

Returns

Union{Missing,T} - The choppiness index value (0-100), or missing during the warm-up period.

See also: ATR, ADX

source
OnlineTechnicalIndicators.Indicators.ChaikinOscType
ChaikinOsc{Tohlcv}(; fast_period = ChaikinOsc_FAST_PERIOD, slow_period = ChaikinOsc_SLOW_PERIOD, fast_ma = EMA, slow_ma = EMA, input_modifier_return_type = Tohlcv)

The ChaikinOsc type implements a Chaikin Oscillator.

The Chaikin Oscillator measures the momentum of the Accumulation/Distribution Line (ADL) by calculating the difference between fast and slow moving averages of the ADL. It helps identify buying or selling pressure in the market. Positive values suggest accumulation, negative values suggest distribution.

Parameters

  • fast_period::Integer = 5: Period for the fast moving average
  • slow_period::Integer = 7: Period for the slow moving average
  • fast_ma::Type = EMA: Moving average type for the fast period
  • slow_ma::Type = EMA: Moving average type for the slow period
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

ChaikinOsc = EMA(AccuDist, fast_period) - EMA(AccuDist, slow_period)

Input

Requires OHLCV data with high, low, close, and volume fields.

Returns

Union{Missing,T} - The Chaikin Oscillator value, or missing during warm-up.

See also: AccuDist, OBV, KVO, MFI

source
OnlineTechnicalIndicators.Indicators.ChandeKrollStopType
ChandeKrollStop{Tohlcv}(; atr_period = ChandeKrollStop_ATR_PERIOD, atr_mult = ChandeKrollStop_ATR_MULT, period = ChandeKrollStop_PERIOD, input_modifier_return_type = Tohlcv)

The ChandeKrollStop type implements a Chande Kroll Stop indicator.

The Chande Kroll Stop is a volatility-based trailing stop indicator that adapts to market conditions using ATR. It calculates stop levels for both long and short positions, helping traders set protective stops that account for normal price fluctuations.

Parameters

  • atr_period::Integer = 5: Period for ATR calculation
  • atr_mult::Number = 2.0: Multiplier for ATR (controls stop distance)
  • period::Integer = 3: Period for stop level smoothing
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

High Stop = max(high, atr_period) - ATR × atr_mult
Low Stop = min(low, atr_period) + ATR × atr_mult
Short Stop = max(High Stop, period)
Long Stop = min(Low Stop, period)

Input

Requires OHLCV data with high, low, and close fields.

Output

Returns

Union{Missing,ChandeKrollStopVal} - The stop levels, or missing during warm-up.

See also: ATR, SuperTrend, ParabolicSAR

source
OnlineTechnicalIndicators.Indicators.CoppockCurveType
CoppockCurve{T}(; fast_roc_period = CoppockCurve_FAST_ROC_PERIOD, slow_roc_period = CoppockCurve_SLOW_ROC_PERIOD, wma_period = CoppockCurve_WMA_PERIOD, input_modifier_return_type = T)

The CoppockCurve type implements a Coppock Curve indicator.

The Coppock Curve is a long-term momentum indicator originally designed to identify major buying opportunities in stock market indices. It combines two Rate of Change indicators smoothed with a Weighted Moving Average. Buy signals occur when the curve crosses above zero.

Parameters

  • fast_roc_period::Integer = 11: Period for the fast ROC
  • slow_roc_period::Integer = 14: Period for the slow ROC
  • wma_period::Integer = 10: Period for the WMA smoothing
  • input_modifier_return_type::Type = T: Output value type (defaults to input type)

Formula

CoppockCurve = WMA(ROC(fast_period) + ROC(slow_period), wma_period)

Returns

Union{Missing,T} - The Coppock Curve value, or missing during the warm-up period.

See also: ROC, WMA, MACD

source
OnlineTechnicalIndicators.Indicators.DEMAType
DEMA{T}(; period = DEMA_PERIOD, ma = EMA, input_modifier_return_type = T)

The DEMA type implements a Double Exponential Moving Average indicator using OnlineStatsChains v0.2.0 with filtered edges.

Implementation Details

Uses OnlineStatsChains.StatDAG with filtered edges (v0.2.0 feature) to organize the 2-stage MA chain. Each connection uses filter = !ismissing to automatically skip missing values during propagation, eliminating the need for nested conditional logic.

The DAG structure provides:

  • Clear organization of the 2-stage MA pipeline (:ma1 → :ma2)
  • Automatic propagation through filtered edges
  • Named access to each stage for debugging and inspection
  • Clean separation of concerns (structure vs computation)
  • Support for any moving average type via MovingAverage factory (EMA, SMA, WMA, etc.)

Benefits over manual chaining:

  • No nested if statements for missing value handling
  • No manual fit! calls in calculatenew_value
  • Clear visualization of data flow
  • Easier to modify (add/remove stages, change filters)

Formula

DEMA = 2 * MA1 - MA2 where MA1 is the MA of price and MA2 is the MA of MA1. The type of moving average (EMA, SMA, etc.) is specified by the ma parameter.

source
OnlineTechnicalIndicators.Indicators.DPOType
DPO{T}(; period = DPO_PERIOD, ma = SMA, input_modifier_return_type = T)

The DPO type implements a Detrended Price Oscillator indicator.

DPO removes the trend from prices to help identify cycles and overbought/oversold levels. It compares a past price to a moving average, effectively filtering out longer-term trends and emphasizing shorter-term cycles.

Parameters

  • period::Integer = 20: The number of periods for the moving average
  • ma::Type = SMA: The moving average type used for detrending
  • input_modifier_return_type::Type = T: Output value type (defaults to input type)

Formula

DPO = price[period/2 + 1 days ago] - SMA(price, period)

The price is shifted back by (period/2 + 1) to align with the center of the moving average.

Returns

Union{Missing,T} - The detrended price oscillator value, or missing during the warm-up period.

See also: SMA, ROC

source
OnlineTechnicalIndicators.Indicators.DonchianChannelsType
DonchianChannels{Tohlcv}(; period = DonchianChannels_ATR_PERIOD, input_modifier_return_type = Tohlcv)

The DonchianChannels type implements a Donchian Channels indicator.

Donchian Channels plot the highest high and lowest low over a period, with a central line at the midpoint. Breakouts above the upper channel signal potential uptrends, while breaks below the lower channel signal potential downtrends. Also known as price channels.

Parameters

  • period::Integer = 5: The lookback period for channel calculation
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

Upper = highest_high(period)
Lower = lowest_low(period)
Central = (Upper + Lower) / 2

Input

Requires OHLCV data with high and low fields.

Output

Returns

Union{Missing,DonchianChannelsVal} - The channel values, or missing during warm-up.

See also: KeltnerChannels, BB, GannHiloActivator

source
OnlineTechnicalIndicators.Indicators.EMAType
EMA{T}(; period = EMA_PERIOD, input_modifier_return_type = T)

The EMA type implements an Exponential Moving Average indicator.

EMA gives more weight to recent prices, making it more responsive to new information than a simple moving average. The weighting decreases exponentially for older data points.

Parameters

  • period::Integer = 3: The number of periods for the EMA calculation
  • input_modifier_return_type::Type = T: Output value type (defaults to input type)

Formula

multiplier = 2 / (period + 1)
EMA = price * multiplier + EMA_prev * (1 - multiplier)

The first EMA value is calculated as a simple average of the first period prices.

Returns

Union{Missing,T} - The exponential moving average value, or missing during the warm-up period (first period - 1 observations).

See also: SMA, DEMA, TEMA, WMA

source
OnlineTechnicalIndicators.Indicators.EMVType
EMV{Tohlcv}(; period = EMV_PERIOD, volume_div = EMV_VOLUME_DIV, ma = SMA, input_modifier_return_type = Tohlcv)

The EMV type implements an Ease of Movement indicator.

EMV relates price change to volume, showing how easily a price can move. High positive values indicate the price is moving up on low volume (easy upward movement), while high negative values indicate easy downward movement. The indicator is smoothed with a moving average.

Parameters

  • period::Integer = 20: The number of periods for the moving average smoothing
  • volume_div::Integer = 10000: Divisor for volume normalization (typically 10000)
  • ma::Type = SMA: The moving average type used for smoothing
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

Distance = ((high + low) / 2) - ((high_prev + low_prev) / 2)
Box Ratio = (volume / volume_div) / (high - low)
EMV = MA(Distance / Box Ratio, period)

Input

Requires OHLCV data with high, low, and volume fields.

Returns

Union{Missing,T} - The smoothed ease of movement value, or missing during warm-up.

See also: OBV, AccuDist

source
OnlineTechnicalIndicators.Indicators.ForceIndexType
ForceIndex{Tohlcv}(; period = ForceIndex_PERIOD, ma = EMA, input_modifier_return_type = Tohlcv)

The ForceIndex type implements a Force Index indicator.

The Force Index combines price change and volume to measure the strength behind price movements. Large positive values indicate strong buying pressure, while large negative values indicate strong selling pressure. The raw values are smoothed with a moving average.

Parameters

  • period::Integer = 3: The period for the moving average smoothing
  • ma::Type = EMA: The moving average type used for smoothing
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

Raw Force = (close - close_prev) × volume
Force Index = MA(Raw Force, period)

Input

Requires OHLCV data with close and volume fields.

Returns

Union{Missing,T} - The smoothed force index value, or missing during warm-up.

See also: OBV, AccuDist, KVO

source
OnlineTechnicalIndicators.Indicators.GannHiloActivatorType
GannHiloActivator{Tohlcv}(; period = GANN_HILO_PERIOD, input_modifier_return_type = Tohlcv)

The GannHiloActivator type implements a Gann HiLo Activator indicator.

The Gann HiLo Activator helps identify trend direction and potential entry/exit points. It calculates simple moving averages of the highest highs and lowest lows over a period. When price closes above the high line, it signals an uptrend; below the low line signals a downtrend.

Parameters

  • period::Integer = 14: The lookback period for calculating highs/lows
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

Highest High = max(high, period)
Lowest Low = min(low, period)
High Line = SMA(Highest High, period)
Low Line = SMA(Lowest Low, period)

Input

Requires OHLCV data with high and low fields.

Output

Returns

Union{Missing,GannHiloActivatorVal} - The high and low lines, or missing during warm-up.

See also: SMA, DonchianChannels, SuperTrend

source
OnlineTechnicalIndicators.Indicators.GannSwingChartType
GannSwingChart{T}(; min_bars=GANN_SWING_MIN_BARS, input_modifier_return_type = T)

The GannSwingChart type implements Gann Swing Chart analysis for trend detection.

This indicator identifies:

  • Upswings: Two consecutive higher highs
  • Downswings: Two consecutive lower lows
  • Trend changes: When prices break previous swing peaks/valleys

Parameters

  • min_bars: Minimum number of bars to confirm a swing (default: 2)

Output

source
OnlineTechnicalIndicators.Indicators.HMAType
HMA{T}(; period = HMA_PERIOD, input_modifier_return_type = T)

The HMA type implements a Hull Moving Average indicator.

HMA was developed by Alan Hull to reduce lag while maintaining smoothness. It combines multiple WMAs at different periods to achieve this goal, using square root of period for the final smoothing.

Parameters

  • period::Integer = 20: The base period for the Hull Moving Average
  • input_modifier_return_type::Type = T: Output value type (defaults to input type)

Formula

WMA1 = WMA(price, period)
WMA2 = WMA(price, period/2)
Raw_HMA = 2 * WMA2 - WMA1
HMA = WMA(Raw_HMA, sqrt(period))

Returns

Union{Missing,T} - The Hull Moving Average value, or missing during the warm-up period.

See also: WMA, EMA, SMA

source
OnlineTechnicalIndicators.Indicators.IntradayRangeType
IntradayRange{Tohlcv}(; input_modifier_return_type = Tohlcv)

The IntradayRange type implements an Intraday Range indicator.

Intraday Range measures the absolute price range within a single bar, calculated as the difference between the high and low prices. Unlike True Range, it does not consider gaps from the previous close, making it ideal for intraday analysis where overnight gaps are not relevant.

Parameters

  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type (must have high and low fields)

Formula

IntradayRange = High - Low

Input

Requires OHLCV data with high and low fields.

Returns

Union{Missing,T} - The absolute bar range. Available from the first observation (no warm-up).

See also: RelativeIntradayRange, ADR, TrueRange, ATR

source
OnlineTechnicalIndicators.Indicators.KAMAType
KAMA{T}(; period = KAMA_PERIOD, fast_ema_constant_period = KAMA_FAST_EMA_CONSTANT_PERIOD, slow_ema_constant_period = KAMA_SLOW_EMA_CONSTANT_PERIOD, input_modifier_return_type = T)

The KAMA type implements Kaufman's Adaptive Moving Average indicator.

KAMA adapts its smoothing based on market volatility using an Efficiency Ratio (ER). In trending markets (high ER), it moves quickly like a fast EMA. In sideways markets (low ER), it moves slowly like a slow EMA.

Parameters

  • period::Integer = 14: The lookback period for the efficiency ratio calculation
  • fast_ema_constant_period::Integer = 2: Period for fast EMA smoothing constant
  • slow_ema_constant_period::Integer = 30: Period for slow EMA smoothing constant
  • input_modifier_return_type::Type = T: Output value type (defaults to input type)

Formula

ER = |Price_change| / Σ|Price_i - Price_{i-1}|  (Efficiency Ratio)
SC = (ER * (fast_SC - slow_SC) + slow_SC)²      (Smoothing Constant)
KAMA = KAMA_prev + SC * (Price - KAMA_prev)

Returns

Union{Missing,T} - The adaptive moving average value, or missing during the warm-up period.

See also: EMA, SMA

source
OnlineTechnicalIndicators.Indicators.KSTType
KST{T}(;
    roc1_period = KST_ROC1_PERIOD,
    roc1_ma_period = KST_ROC1_MA_PERIOD,
    roc2_period = KST_ROC2_PERIOD,
    roc2_ma_period = KST_ROC2_MA_PERIOD,
    roc3_period = KST_ROC3_PERIOD,
    roc3_ma_period = KST_ROC3_MA_PERIOD,
    roc4_period = KST_ROC4_PERIOD,
    roc4_ma_period = KST_ROC4_MA_PERIOD,
    signal_period = KST_SIGNAL_PERIOD,
    ma = SMA,
    input_modifier_return_type = T
)

The KST type implements Know Sure Thing indicator using OnlineStatsChains with filtered edges.

Implementation Details

Uses OnlineStatsChains.StatDAG with filtered edges to organize 4 parallel ROC→MA chains. Each chain computes ROC at different periods, then smooths with a moving average.

The DAG structure provides:

  • Clear organization of 4 parallel ROC→MA pipelines
  • Automatic propagation through filtered edges
  • Named access to each stage for debugging

Formula

KST = 1ROC1_MA + 2ROC2MA + 3*ROC3MA + 4*ROC4MA Signal = MA(KST, signalperiod)

Output

  • KSTVal: A value containing kst and signal values
source
OnlineTechnicalIndicators.Indicators.KVOType
KVO{Tohlcv}(; fast_period = KVO_FAST_PERIOD, slow_period = KVO_SLOW_PERIOD, ma = EMA, input_modifier_return_type = Tohlcv)

The KVO type implements a Klinger Volume Oscillator.

The Klinger Volume Oscillator measures the long-term trend of money flow while remaining sensitive to short-term fluctuations. It uses volume and price to determine if money is flowing into or out of a security. Crossovers of the fast and slow EMAs generate signals.

Parameters

  • fast_period::Integer = 5: Period for the fast moving average
  • slow_period::Integer = 10: Period for the slow moving average
  • ma::Type = EMA: Moving average type used for smoothing
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

HLC = high + low + close
Trend = +1 if HLC > HLC_prev, -1 otherwise
dm = high - low
cm = dm + cm_prev (if trend unchanged) or dm + dm_prev (if trend changes)
VF = volume × |2 × (dm/cm) - 1| × trend × 100
KVO = EMA(VF, fast_period) - EMA(VF, slow_period)

Input

Requires OHLCV data with high, low, close, and volume fields.

Returns

Union{Missing,T} - The Klinger Volume Oscillator value, or missing during warm-up.

See also: OBV, ChaikinOsc, ForceIndex

source
OnlineTechnicalIndicators.Indicators.KeltnerChannelsType
KeltnerChannels{Tohlcv}(; ma_period = KeltnerChannels_MA_PERIOD, atr_period = KeltnerChannels_ATR_PERIOD, atr_mult_up = KeltnerChannels_ATR_MULT_UP, atr_mult_down = KeltnerChannels_ATR_MULT_DOWN, ma = EMA, input_modifier_return_type = Tohlcv)

The KeltnerChannels type implements a Keltner Channels indicator.

Keltner Channels are volatility-based envelopes set above and below a moving average. They use ATR to determine channel width. Price touching the upper channel suggests overbought conditions, while touching the lower channel suggests oversold conditions.

Parameters

  • ma_period::Integer = 10: Period for the central moving average
  • atr_period::Integer = 10: Period for ATR calculation
  • atr_mult_up::Number = 2.0: ATR multiplier for upper channel
  • atr_mult_down::Number = 3.0: ATR multiplier for lower channel
  • ma::Type = EMA: Moving average type for central band
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

Central = EMA(close, ma_period)
Upper = Central + (atr_mult_up × ATR)
Lower = Central - (atr_mult_down × ATR)

Input

Requires OHLCV data with high, low, and close fields.

Output

Returns

Union{Missing,KeltnerChannelsVal} - The channel values, or missing during warm-up.

See also: BB, DonchianChannels, ATR

source
OnlineTechnicalIndicators.Indicators.MACDType
MACD{T}(; fast_period = MACD_FAST_PERIOD, slow_period = MACD_SLOW_PERIOD, signal_period = MACD_SIGNAL_PERIOD, ma = EMA, input_modifier_return_type = T)

The MACD type implements a Moving Average Convergence Divergence indicator.

MACD shows the relationship between two moving averages. The MACD line crossing above the signal line is a bullish signal, while crossing below is bearish. The histogram visualizes the difference between MACD and signal for easier trend identification.

Parameters

  • fast_period::Integer = 12: Period for the fast moving average
  • slow_period::Integer = 26: Period for the slow moving average
  • signal_period::Integer = 9: Period for the signal line
  • ma::Type = EMA: Moving average type (typically EMA)
  • input_modifier_return_type::Type = T: Output value type

Formula

MACD Line = EMA(fast_period) - EMA(slow_period)
Signal Line = EMA(MACD Line, signal_period)
Histogram = MACD Line - Signal Line

Output

  • MACDVal: Contains macd, signal, and histogram values

Returns

Union{Missing,MACDVal} - The MACD values, or missing during warm-up.

See also: EMA, RSI, Aroon

source
OnlineTechnicalIndicators.Indicators.MassIndexType
MassIndex{Tohlcv}(; ma_period = MassIndex_MA_PERIOD, ma_ma_period = MassIndex_MA_MA_PERIOD, ma_ratio_period = MassIndex_MA_RATIO_PERIOD, ma = EMA, input_modifier_return_type = Tohlcv)

The MassIndex type implements a Mass Index indicator.

The Mass Index identifies potential reversals by measuring the range between high and low prices. It looks for "reversal bulges" where the index rises above 27 and then falls below 26.5, which often precedes a price reversal regardless of direction.

Parameters

  • ma_period::Integer = 9: Period for the first EMA of the high-low range
  • ma_ma_period::Integer = 9: Period for the second EMA (of the first EMA)
  • ma_ratio_period::Integer = 10: Period to sum the EMA ratio
  • ma::Type = EMA: Moving average type used for smoothing
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

Single EMA = EMA(high - low, ma_period)
Double EMA = EMA(Single EMA, ma_ma_period)
EMA Ratio = Single EMA / Double EMA
Mass Index = sum(EMA Ratio, ma_ratio_period)

Input

Requires OHLCV data with high and low fields.

Returns

Union{Missing,T} - The Mass Index value, or missing during warm-up.

See also: ATR, ADX

source
OnlineTechnicalIndicators.Indicators.McGinleyDynamicType
McGinleyDynamic{T}(; period = McGinleyDynamic_PERIOD, input_modifier_return_type = T)

The McGinleyDynamic type implements a McGinley Dynamic indicator.

The McGinley Dynamic is an adaptive moving average that automatically adjusts its speed based on market volatility. It speeds up in trending markets and slows down in ranging markets, reducing whipsaws compared to traditional moving averages.

Parameters

  • period::Integer = 14: The base period for the calculation
  • input_modifier_return_type::Type = T: Output value type (defaults to input type)

Formula

MD = MD_prev + (price - MD_prev) / (period × (price / MD_prev)^4)

The first value is calculated as a simple average of the first period prices.

Returns

Union{Missing,T} - The McGinley Dynamic value, or missing during the warm-up period (first period - 1 observations).

See also: EMA, KAMA, ZLEMA

source
OnlineTechnicalIndicators.Indicators.MeanDevType
MeanDev{T}(; period = MeanDev_PERIOD, ma = SMA, input_modifier_return_type = T)

The MeanDev type implements a Mean Deviation indicator.

Mean Deviation (also called Mean Absolute Deviation) measures the average distance of data points from their mean. It's a measure of dispersion similar to standard deviation but uses absolute values instead of squares.

Parameters

  • period::Integer = 3: The lookback period for the calculation
  • ma::Type = SMA: The moving average type to use for the mean
  • input_modifier_return_type::Type = T: Output value type (defaults to input type)

Formula

MeanDev = Σ|price_i - MA(price)| / period

Returns

Union{Missing,T} - The mean deviation value, or missing during the warm-up period.

See also: StdDev, CCI, SMA

source
OnlineTechnicalIndicators.Indicators.MFIType
MFI{Tohlcv}(; period = MFI_PERIOD, input_modifier_return_type = Tohlcv)

The MFI type implements a Money Flow Index indicator.

The Money Flow Index (MFI) is a momentum oscillator that measures the flow of money into and out of a security over a specified period of time. It is related to the Relative Strength Index (RSI) but incorporates volume, making it a volume-weighted RSI. Values above 80 indicate overbought conditions, below 20 indicate oversold.

Parameters

  • period::Integer = 14: The lookback period for calculating money flow sums
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type (must have high, low, close, volume fields)

Formula

Typical Price (TP) = (High + Low + Close) / 3
Raw Money Flow = TP × Volume
If TP > TP_prev: Positive Money Flow = Raw Money Flow
If TP < TP_prev: Negative Money Flow = Raw Money Flow
If TP = TP_prev: No contribution (neutral)
Money Flow Ratio = Sum(Positive MF, period) / Sum(Negative MF, period)
MFI = 100 - (100 / (1 + Money Flow Ratio))

Input

Requires OHLCV data with high, low, close, and volume fields.

Returns

Union{Missing,T} - The MFI value (0-100), or missing during warm-up (first period observations).

See also: RSI, OBV, AccuDist, ChaikinOsc

source
OnlineTechnicalIndicators.Indicators.NATRType
NATR{Tohlcv}(; period = ATR_PERIOD, ma = SMMA, input_modifier_return_type = Tohlcv)

The NATR type implements a Normalized Average True Range indicator.

NATR expresses the Average True Range as a percentage of the closing price, making it easier to compare volatility across different securities regardless of their price levels. Higher NATR values indicate higher volatility relative to the price.

Parameters

  • period::Integer = 3: The number of periods for the ATR calculation
  • ma::Type = SMMA: The moving average type used for smoothing (default is Wilder's SMMA)
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type (must have high, low, close fields)

Formula

NATR = (ATR / close) × 100

Input

Requires OHLCV data with high, low, and close fields.

Returns

Union{Missing,T} - The normalized ATR as a percentage, or missing during the warm-up period (first period - 1 observations). Returns missing if close price is zero.

See also: ATR, TrueRange

source
OnlineTechnicalIndicators.Indicators.OBVType
OBV{Tohlcv}(; input_modifier_return_type = Tohlcv)

The OBV type implements an On Balance Volume indicator.

OBV is a momentum indicator that uses volume flow to predict changes in stock price. It adds volume on up days and subtracts volume on down days, creating a cumulative total that can confirm price trends or warn of potential reversals.

Parameters

  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type (must have close and volume fields)

Formula

If close > close_prev: OBV = OBV_prev + volume
If close < close_prev: OBV = OBV_prev - volume
If close = close_prev: OBV = OBV_prev

Input

Requires OHLCV data with close and volume fields.

Returns

Union{Missing,T} - The cumulative on-balance volume value. Available from the first observation.

See also: SOBV, AccuDist, ChaikinOsc, MFI

source
OnlineTechnicalIndicators.Indicators.ParabolicSARType
ParabolicSAR{Tohlcv}(; init_accel_factor = ParabolicSAR_INIT_ACCEL_FACTOR, accel_factor_inc = ParabolicSAR_ACCEL_FACTOR_INC, max_accel_factor = ParabolicSAR_MAX_ACCEL_FACTOR, input_modifier_return_type = Tohlcv)

The ParabolicSAR type implements a Parabolic Stop and Reverse indicator.

Parabolic SAR provides potential entry and exit points by trailing price with an accelerating curve. The SAR value acts as a trailing stop: below price in uptrends (support) and above price in downtrends (resistance). When price crosses SAR, trend reverses.

Parameters

  • init_accel_factor::Number = 0.02: Initial acceleration factor
  • accel_factor_inc::Number = 0.02: AF increment on new extreme
  • max_accel_factor::Number = 0.2: Maximum acceleration factor
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

SAR = SAR_prev + AF × (EP - SAR_prev)
AF increases by accel_factor_inc each time EP updates (capped at max_accel_factor)
EP = highest high (uptrend) or lowest low (downtrend)

Trend reverses when price crosses SAR.

Input

Requires OHLCV data with high and low fields.

Output

  • ParabolicSARVal: Contains value (SAR level), trend (UP/DOWN), ep, and accel_factor

Returns

Union{Missing,ParabolicSARVal} - The SAR values, or missing during initialization.

See also: SuperTrend, ChandeKrollStop, ATR

source
OnlineTechnicalIndicators.Indicators.PeakValleyDetectorType
PeakValleyDetector{T}(; lookback=PEAK_VALLEY_LOOKBACK, input_modifier_return_type = T)

The PeakValleyDetector type identifies significant peaks and valleys in price data.

This indicator detects:

  • Peaks: Local high points where price is higher than surrounding bars
  • Valleys: Local low points where price is lower than surrounding bars
  • Support/Resistance levels based on these peaks and valleys

Parameters

  • lookback: Number of bars to look back/forward for peak/valley confirmation (default: 5)

Output

Implements REQ-003: Identify peaks and valleys of each swing

source
OnlineTechnicalIndicators.Indicators.PivotsHLType
PivotsHL{Tohlcv}(; high_period = PivotsHL_HIGH_PERIOD, low_period = PivotsHL_LOW_PERIOD, memory = PivotsHL_MEMORY, input_modifier_return_type = Tohlcv)

The PivotsHL type implements a High/Low Pivots indicator.

PivotsHL identifies significant high and low pivot points in price data. A pivot high occurs when price makes a local maximum, and a pivot low occurs when price makes a local minimum within the lookback period.

Parameters

  • high_period::Integer = 7: Lookback period for identifying pivot highs
  • low_period::Integer = 7: Lookback period for identifying pivot lows
  • memory::Integer = 3: Number of pivot points to store
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Input

Requires OHLCV data with high and low fields.

Output

  • PivotsHLVal: Contains ohlcv (data at pivot), type (HIGH/LOW), isnew (Bool)

Returns

Always returns missing (pivot values stored in output_values CircBuff). Use has_output_value(ind) to check if pivots exist and access via ind.output_values.

See also: DonchianChannels, SuperTrend

source
OnlineTechnicalIndicators.Indicators.RelativeIntradayRangeType
RelativeIntradayRange{Tohlcv}(; input_modifier_return_type = Tohlcv)

The RelativeIntradayRange type implements a Relative Intraday Range indicator.

Relative Intraday Range measures the percentage price range within a single bar, calculated as the absolute range divided by the open price, expressed as a percentage. This allows comparison of volatility across assets with different price levels.

Parameters

  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type (must have open, high, and low fields)

Formula

RelativeIntradayRange = (High - Low) * 100 / Open

Input

Requires OHLCV data with open, high, and low fields.

Returns

Union{Missing,T} - The percentage bar range. Returns missing if Open is zero. Available from the first observation (no warm-up).

See also: IntradayRange, ARDR, TrueRange, ATR, NATR

source
OnlineTechnicalIndicators.Indicators.ROCType
ROC{T}(; period = ROC_PERIOD, input_modifier_return_type = T)

The ROC type implements a Rate Of Change indicator.

ROC measures the percentage change in price between the current price and the price period bars ago. It oscillates above and below zero, indicating bullish or bearish momentum.

Parameters

  • period::Integer = 3: The lookback period for calculating the rate of change
  • input_modifier_return_type::Type = T: Output value type (defaults to input type)

Formula

ROC = 100 * (current_price - price_n_periods_ago) / price_n_periods_ago

Returns

Union{Missing,T} - Rate of change as a percentage, or missing during the warm-up period (first period observations).

See also: RSI, TRIX

source
OnlineTechnicalIndicators.Indicators.RSIType
RSI{T}(; period = RSI_PERIOD, input_modifier_return_type = T)

The RSI type implements a Relative Strength Index indicator.

RSI is a momentum oscillator that measures the speed and magnitude of recent price changes to evaluate overbought or oversold conditions. Developed by J. Welles Wilder Jr.

Parameters

  • period::Integer = 3: The lookback period for calculating average gains and losses
  • input_modifier_return_type::Type = T: Output value type (defaults to input type)

Formula

RS = Average Gain / Average Loss
RSI = 100 - (100 / (1 + RS))

where Average Gain and Average Loss are calculated using SMMA (Smoothed Moving Average).

Returns

Union{Missing,T} - RSI value between 0 and 100, or missing during the warm-up period. Values above 70 typically indicate overbought conditions, below 30 indicate oversold.

See also: SMMA, MFI

source
OnlineTechnicalIndicators.Indicators.RetracementCalculatorType
RetracementCalculator{T}(; retracement_pct=0.38, input_modifier_return_type = T)

The RetracementCalculator type calculates retracement levels for swing trading.

This indicator calculates:

  • 38% retracement levels for both long and short positions
  • Current retracement percentage from swing peaks/valleys
  • Signals when specific retracement levels are hit

Parameters

  • retracement_pct: Retracement percentage to calculate (default: 0.38 for 38%)

Output

Implements REQ-310 to REQ-313: Calculate and monitor 38% retracement levels

source
OnlineTechnicalIndicators.Indicators.SFXType
SFX{Tohlcv}(; atr_period = SFX_ATR_PERIOD, std_dev_period = SFX_STD_DEV_PERIOD, std_dev_smoothing_period = SFX_STD_DEV_SMOOTHING_PERIOD, ma = SMA, input_modifier_return_type = Tohlcv)

The SFX type implements an SFX (Smoothed Forex) volatility indicator.

SFX combines Average True Range with standard deviation to measure market volatility. Comparing ATR to smoothed standard deviation helps identify when volatility is expanding or contracting, useful for timing entries and setting stop losses.

Parameters

  • atr_period::Integer = 12: Period for ATR calculation
  • std_dev_period::Integer = 12: Period for standard deviation
  • std_dev_smoothing_period::Integer = 3: Period for smoothing std dev
  • ma::Type = SMA: Moving average type for smoothing
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

ATR = Average True Range over atr_period
StdDev = Standard Deviation of close over std_dev_period
MA_StdDev = SMA(StdDev, std_dev_smoothing_period)

Input

Requires OHLCV data with high, low, and close fields.

Output

  • SFXVal: Contains atr, std_dev, and ma_std_dev values

Returns

Union{Missing,SFXVal} - The SFX values. std_dev available early, others after warm-up.

See also: ATR, StdDev, BB

source
OnlineTechnicalIndicators.Indicators.SMAType
SMA{T}(; period = SMA_PERIOD, input_modifier_return_type = T)

The SMA type implements a Simple Moving Average indicator.

SMA calculates the arithmetic mean of prices over a specified period. It gives equal weight to all prices in the period, providing a smooth representation of price trends.

Parameters

  • period::Integer = 3: The number of periods for the moving average
  • input_modifier_return_type::Type = T: Output value type (defaults to input type)

Formula

SMA = (P1 + P2 + ... + Pn) / n

where n is the period and P1...Pn are the prices in the window.

Returns

Union{Missing,T} - The simple moving average value, or missing during the warm-up period (first period - 1 observations).

See also: EMA, WMA, SMMA

source
OnlineTechnicalIndicators.Indicators.SMMAType
SMMA{T}(; period = SMMA_PERIOD, input_modifier_return_type = T)

The SMMA type implements a Smoothed Moving Average indicator.

SMMA (also known as Wilder's Moving Average or Modified Moving Average) applies more smoothing than EMA, making it less reactive to price changes. It's commonly used in indicators like RSI and ATR.

Parameters

  • period::Integer = 3: The number of periods for the smoothed average
  • input_modifier_return_type::Type = T: Output value type (defaults to input type)

Formula

SMMA = (SMMA_prev * (period - 1) + price) / period

The first SMMA value is calculated as a simple average of the first period prices.

Returns

Union{Missing,T} - The smoothed moving average value, or missing during the warm-up period (first period - 1 observations).

See also: SMA, EMA, RSI, ATR

source
OnlineTechnicalIndicators.Indicators.SOBVType
SOBV{Tohlcv}(; period = SOBV_PERIOD, ma = SMA, input_modifier_return_type = Tohlcv)

The SOBV type implements a Smoothed On Balance Volume indicator.

SOBV applies a moving average to the On Balance Volume (OBV) indicator, reducing noise and making the trend clearer. This helps filter out short-term fluctuations in the cumulative volume measure.

Parameters

  • period::Integer = 20: The number of periods for smoothing the OBV
  • ma::Type = SMA: The moving average type used for smoothing
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

SOBV = MA(OBV, period)

Where OBV is the On Balance Volume indicator.

Input

Requires OHLCV data with close and volume fields.

Returns

Union{Missing,T} - The smoothed on-balance volume value, or missing during the warm-up period (first period - 1 observations after OBV becomes available).

See also: Smoother, OBV, SMA, EMA

source
OnlineTechnicalIndicators.Indicators.STCType
STC{T}(; fast_macd_period = STC_FAST_MACD_PERIOD, slow_macd_period = STC_SLOW_MACD_PERIOD, stoch_period = STC_STOCH_PERIOD, stoch_smoothing_period = STC_STOCH_SMOOTHING_PERIOD, ma = SMA, input_modifier_return_type = T)

The STC type implements a Schaff Trend Cycle indicator.

STC combines MACD with double Stochastic smoothing to identify cyclical trends. It oscillates between 0 and 100, with values above 75 indicating overbought conditions and below 25 indicating oversold conditions. It often leads price reversals.

Parameters

  • fast_macd_period::Integer = 5: Fast EMA period for MACD
  • slow_macd_period::Integer = 10: Slow EMA period for MACD
  • stoch_period::Integer = 10: Lookback period for Stochastic
  • stoch_smoothing_period::Integer = 3: Smoothing for Stochastic %D
  • ma::Type = SMA: Moving average type for Stochastic smoothing
  • input_modifier_return_type::Type = T: Output value type

Formula

1. MACD = EMA(fast) - EMA(slow)
2. Stoch1 = Stochastic(MACD)
3. Stoch2 = Stochastic(Stoch1.%D)
4. STC = clamp(Stoch2.%D, 0, 100)

Returns

Union{Missing,T} - The STC value (0-100), or missing during warm-up.

See also: MACD, Stoch, RSI

source
OnlineTechnicalIndicators.Indicators.StdDevType
StdDev{T}(; period = StdDev_PERIOD, input_modifier_return_type = T)

The StdDev type implements a Standard Deviation indicator.

Standard Deviation measures the dispersion of data points from their mean. Higher values indicate greater volatility. Often used with Bollinger Bands.

Parameters

  • period::Integer = 3: The lookback period for the calculation
  • input_modifier_return_type::Type = T: Output value type (defaults to input type)

Formula

StdDev = sqrt(Σ(price_i - mean)² / period)

This is the population standard deviation (divides by n, not n-1).

Returns

Union{Missing,T} - The standard deviation value, or missing during the warm-up period.

See also: MeanDev, BB

source
OnlineTechnicalIndicators.Indicators.StochType
Stoch{Tohlcv}(; period = STOCH_PERIOD, smoothing_period = STOCH_SMOOTHING_PERIOD, ma = SMA, input_modifier_return_type = Tohlcv)

The Stoch type implements the Stochastic Oscillator indicator.

The Stochastic Oscillator compares a security's closing price to its price range over a given period. It generates values between 0 and 100, where readings above 80 indicate overbought conditions and below 20 indicate oversold conditions.

Parameters

  • period::Integer = 14: The lookback period for high/low range
  • smoothing_period::Integer = 3: Period for %D line smoothing
  • ma::Type = SMA: Moving average type for %D smoothing
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

%K = 100 × (close - lowest_low) / (highest_high - lowest_low)
%D = SMA(%K, smoothing_period)

Input

Requires OHLCV data with high, low, and close fields.

Output

  • StochVal: Contains k (%K fast line) and d (%D slow line) values

Returns

Union{Missing,StochVal} - The stochastic values, available from the first observation (%D becomes available after smoothing_period observations).

See also: StochRSI, RSI, UO

source
OnlineTechnicalIndicators.Indicators.StochRSIType
StochRSI{T}(; rsi_period = StochRSI_RSI_PERIOD, stoch_period = StochRSI_STOCH_PERIOD, k_smoothing_period = StochRSI_K_SMOOTHING_PERIOD, d_smoothing_period = StochRSI_D_SMOOTHING_PERIOD, ma = SMA, input_modifier_return_type = Tval)

The StochRSI type implements Stochastic RSI indicator using OnlineStatsChains with filtered edges.

Implementation Details

Uses OnlineStatsChains.StatDAG with filtered edges to organize the smoothing chain: smoothedk → valuesd

The RSI is computed separately and the stochastic oscillator is applied to it, then the result goes through a 2-stage smoothing process.

Formula

RSI = RSI(price, rsiperiod) K = 100 * (RSI - min(RSI, stochperiod)) / (max(RSI, stochperiod) - min(RSI, stochperiod)) smoothedK = MA(K, ksmoothingperiod) D = MA(smoothedK, dsmoothingperiod)

Output

source
OnlineTechnicalIndicators.Indicators.SuperTrendType
SuperTrend{Tohlcv}(; atr_period = SuperTrend_ATR_PERIOD, mult = SuperTrend_MULT, input_modifier_return_type = Tohlcv)

The SuperTrend type implements a Super Trend indicator.

SuperTrend is a trend-following indicator that uses ATR to create dynamic support and resistance levels. It flips between acting as support (in uptrends) and resistance (in downtrends), making it useful for trailing stops and trend identification.

Parameters

  • atr_period::Integer = 10: Period for ATR calculation
  • mult::Integer = 3: ATR multiplier for band width
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

HLA = (high + low) / 2
Upper Band = HLA + (mult × ATR)
Lower Band = HLA - (mult × ATR)
SuperTrend = Lower Band (in uptrend) or Upper Band (in downtrend)

The indicator switches bands when price crosses through.

Input

Requires OHLCV data with high, low, and close fields.

Output

  • SuperTrendVal: Contains value (the SuperTrend level) and trend (UP or DOWN)

Returns

Union{Missing,SuperTrendVal} - The SuperTrend value and direction, or missing during warm-up.

See also: ATR, ParabolicSAR, ChandeKrollStop

source
OnlineTechnicalIndicators.Indicators.SupportResistanceLevelType
SupportResistanceLevel{T}(; input_modifier_return_type = T)

The SupportResistanceLevel type calculates and monitors support and resistance levels.

This indicator tracks:

  • Support levels from previous swing valleys
  • Resistance levels from previous swing peaks
  • Break signals when price penetrates these levels

Output

Implements REQ-040 to REQ-043: Support/Resistance level calculation and monitoring

source
OnlineTechnicalIndicators.Indicators.T3Type
T3{T}(; period = T3_PERIOD, factor = T3_FACTOR, ma = EMA, input_modifier_return_type = T)

The T3 type implements a T3 Moving Average indicator using OnlineStatsChains v0.2.0 with filtered edges.

Implementation Details

Uses OnlineStatsChains.StatDAG with filtered edges (v0.2.0 feature) to organize the 6-stage MA chain. Each connection uses filter = !ismissing to automatically skip missing values during propagation, eliminating the need for nested conditional logic.

The DAG structure provides:

  • Clear organization of the 6-stage MA pipeline (:ma1 → :ma2 → ... → :ma6)
  • Automatic propagation through filtered edges
  • Named access to each stage for debugging and inspection
  • Clean separation of concerns (structure vs computation)
  • Support for any moving average type via MovingAverage factory (EMA, SMA, WMA, etc.)

Benefits over manual chaining:

  • No nested if statements for missing value handling
  • No manual fit! calls in calculatenew_value
  • Clear visualization of data flow
  • Easier to modify (add/remove stages, change filters)
source
OnlineTechnicalIndicators.Indicators.TEMAType
TEMA{T}(; period = TEMA_PERIOD, ma = EMA, input_modifier_return_type = T)

The TEMA type implements a Triple Exponential Moving Average indicator using OnlineStatsChains v0.2.0 with filtered edges.

Implementation Details

Uses OnlineStatsChains.StatDAG with filtered edges (v0.2.0 feature) to organize the 3-stage MA chain. Each connection uses filter = !ismissing to automatically skip missing values during propagation, eliminating the need for nested conditional logic.

The DAG structure provides:

  • Clear organization of the 3-stage MA pipeline (:ma1 → :ma2 → :ma3)
  • Automatic propagation through filtered edges
  • Named access to each stage for debugging and inspection
  • Clean separation of concerns (structure vs computation)
  • Support for any moving average type via MovingAverage factory (EMA, SMA, WMA, etc.)

Benefits over manual chaining:

  • No nested if statements for missing value handling
  • No manual fit! calls in calculatenew_value
  • Clear visualization of data flow
  • Easier to modify (add/remove stages, change filters)

Formula

TEMA = 3 * MA1 - 3 * MA2 + MA3 where MA1 is the MA of price, MA2 is the MA of MA1, and MA3 is the MA of MA2. The type of moving average (EMA, SMA, etc.) is specified by the ma parameter.

source
OnlineTechnicalIndicators.Indicators.TRIXType
TRIX{T}(; period = TRIX_PERIOD, ma = EMA, input_modifier_return_type = T)

The TRIX type implements a TRIX Moving Average indicator using OnlineStatsChains v0.2.0 with filtered edges.

Implementation Details

Uses OnlineStatsChains.StatDAG with filtered edges (v0.2.0 feature) to organize the 3-stage MA chain. Each connection uses filter = !ismissing to automatically skip missing values during propagation, eliminating the need for nested conditional logic.

The DAG structure provides:

  • Clear organization of the 3-stage MA pipeline (:ma1 → :ma2 → :ma3)
  • Automatic propagation through filtered edges
  • Named access to each stage for debugging and inspection
  • Clean separation of concerns (structure vs computation)
  • Support for any moving average type via MovingAverage factory (EMA, SMA, WMA, etc.)

Benefits over manual chaining:

  • No nested if statements for missing value handling
  • No manual fit! calls in calculatenew_value
  • Clear visualization of data flow
  • Easier to modify (add/remove stages, change filters)

Formula

TRIX = 10000 * (MA3current - MA3previous) / MA3_previous where MA1 is the MA of price, MA2 is the MA of MA1, and MA3 is the MA of MA2. The type of moving average (EMA, SMA, etc.) is specified by the ma parameter. The result is expressed as a percentage rate of change (* 10000 for basis points).

source
OnlineTechnicalIndicators.Indicators.TrueRangeType
TrueRange{Tohlcv}(; input_modifier_return_type = Tohlcv)

The TrueRange type implements a True Range indicator.

True Range measures the greatest of the following:

  • Current high minus current low
  • Absolute value of current high minus previous close
  • Absolute value of current low minus previous close

This captures the full range of price movement including any gaps from the previous close. True Range is the building block for the Average True Range (ATR) indicator.

Parameters

  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type (must have high, low, close fields)

Formula

TR = max(high - low, |high - close_prev|, |low - close_prev|)

For the first observation, TR = high - low (no previous close available).

Input

Requires OHLCV data with high, low, and close fields.

Returns

Union{Missing,T} - The true range value. Available from the first observation.

See also: ATR, NATR, IntradayRange, RelativeIntradayRange

source
OnlineTechnicalIndicators.Indicators.TSIType
TSI{T}(; fast_period = TSI_FAST_PERIOD, slow_period = TSI_SLOW_PERIOD, ma = EMA, input_modifier_return_type = T)

The TSI type implements a True Strength Index indicator using OnlineStatsChains with filtered edges.

Implementation Details

Uses OnlineStatsChains.StatDAG with filtered edges to organize two parallel 2-stage MA chains:

  1. Price momentum chain: slowma → fastma (for momentum)
  2. Absolute momentum chain: absslowma → absfastma (for normalization)

Each connection uses filter = !ismissing to automatically skip missing values during propagation.

The DAG structure provides:

  • Clear organization of parallel MA pipelines
  • Automatic propagation through filtered edges
  • Named access to each stage for debugging
  • Support for any moving average type via MovingAverage factory

Formula

TSI = 100 * (doublesmoothedmomentum / doublesmoothedabsolute_momentum) where momentum = price[t] - price[t-1]

source
OnlineTechnicalIndicators.Indicators.TTMType
TTM{Tohlcv}(; period = TTM_PERIOD, bb_std_dev_mult = TTM_BB_STD_DEV_MULT, kc_atr_mult = TTM_KC_ATR_MULT, ma = SMA, input_modifier_return_type = Tohlcv)

The TTM type implements a TTM Squeeze indicator.

The TTM Squeeze identifies periods of low volatility (squeeze) that often precede significant price moves. When Bollinger Bands move inside Keltner Channels, volatility is contracting (squeeze on). The histogram shows momentum direction for trade timing.

Parameters

  • period::Integer = 20: Period for BB, KC, and linear regression
  • bb_std_dev_mult::Number = 2.0: Standard deviation multiplier for Bollinger Bands
  • kc_atr_mult::Number = 2.0: ATR multiplier for Keltner Channels
  • ma::Type = SMA: Moving average type for calculations
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

Squeeze = BB.upper < KC.upper AND BB.lower > KC.lower
Delta = close - (Donchian.central + MA) / 2
Histogram = Linear regression of Delta over period

Input

Requires OHLCV data with high, low, and close fields.

Output

  • TTMVal: Contains squeeze (Bool) and histogram (momentum value)

Returns

Union{Missing,TTMVal} - The squeeze status and momentum, or missing during warm-up.

See also: BB, KeltnerChannels, DonchianChannels

source
OnlineTechnicalIndicators.Indicators.UOType
UO{Tohlcv}(; fast_period = UO_FAST_PERIOD, mid_period = UO_MID_PERIOD, slow_period = UO_SLOW_PERIOD, input_modifier_return_type = Tohlcv)

The UO type implements an Ultimate Oscillator.

The Ultimate Oscillator combines short, medium, and long-term price momentum into a single oscillator. By using three timeframes, it aims to reduce false signals and better capture momentum across market cycles. Values above 70 suggest overbought, below 30 oversold.

Parameters

  • fast_period::Integer = 3: The period for the fast average
  • mid_period::Integer = 5: The period for the medium average
  • slow_period::Integer = 7: The period for the slow average
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

BP = close - min(low, close_prev)           # Buying Pressure
TR = max(high, close_prev) - min(low, close_prev)  # True Range
Avg = sum(BP, period) / sum(TR, period)
UO = 100 × (4 × Avg_fast + 2 × Avg_mid + Avg_slow) / 7

Input

Requires OHLCV data with high, low, and close fields.

Returns

Union{Missing,T} - The ultimate oscillator value (0-100), or missing during warm-up (first slow_period observations).

See also: RSI, Stoch, CCI

source
OnlineTechnicalIndicators.Indicators.VTXType
VTX{Tohlcv}(; period = VTX_PERIOD, input_modifier_return_type = Tohlcv)

The VTX type implements a Vortex Indicator.

The Vortex Indicator identifies trend direction and trend reversals by analyzing the relationship between price movement and true range. +VI rising above -VI suggests an uptrend, while -VI rising above +VI suggests a downtrend.

Parameters

  • period::Integer = 14: The lookback period for the calculation
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

+VM = |high - low_prev|
-VM = |low - high_prev|
+VI = sum(+VM, period) / sum(TR, period)
-VI = sum(-VM, period) / sum(TR, period)

Where TR is the True Range.

Input

Requires OHLCV data with high, low, and close fields.

Output

  • VTXVal: Contains plus_vtx (+VI) and minus_vtx (-VI) values

Returns

Union{Missing,VTXVal} - The vortex indicator values, or missing during warm-up.

See also: TrueRange, ADX, Aroon

source
OnlineTechnicalIndicators.Indicators.VWAPType
VWAP{Tohlcv}(; input_modifier_return_type = Tohlcv)

The VWAP type implements a Volume Weighted Average Price indicator.

VWAP calculates the average price weighted by volume from the beginning of the trading session. It represents the average price a security has traded at throughout the day, and is commonly used as a trading benchmark by institutional investors.

Parameters

  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

Typical Price = (high + low + close) / 3
VWAP = cumsum(Typical Price × volume) / cumsum(volume)

Input

Requires OHLCV data with high, low, close, and volume fields.

Returns

Union{Missing,T} - The cumulative VWAP value. Available from the first observation. Returns missing if total volume is zero.

See also: VWMA, SMA

source
OnlineTechnicalIndicators.Indicators.VWMAType
VWMA{Tohlcv}(; period = VWMA_PERIOD, input_modifier_return_type = Tohlcv)

The VWMA type implements a Volume Weighted Moving Average indicator.

VWMA weights each price by its associated volume, giving more importance to prices that occurred during high-volume periods. This helps identify the "true" average price by considering trading activity.

Parameters

  • period::Integer = 3: The number of periods for the moving average
  • input_modifier_return_type::Type = Tohlcv: Input OHLCV type

Formula

VWMA = sum(close × volume) / sum(volume)

Calculated over the specified period.

Input

Requires OHLCV data with close and volume fields.

Returns

Union{Missing,T} - The volume-weighted moving average value, or missing during the warm-up period (first period - 1 observations).

See also: SMA, VWAP, EMA

source
OnlineTechnicalIndicators.Indicators.WMAType
WMA{T}(; period = WMA_PERIOD, input_modifier_return_type = T)

The WMA type implements a Weighted Moving Average indicator.

WMA assigns linearly increasing weights to more recent data points, giving them greater influence on the average. The most recent observation has weight period, the second most recent has weight period - 1, and so on.

Parameters

  • period::Integer = 3: The number of periods for the weighted average
  • input_modifier_return_type::Type = T: Output value type (defaults to input type)

Formula

WMA = Σ(weight_i * price_i) / Σ(weight_i)

where weight_i = period - i + 1 for i from 1 to period, and the denominator equals period * (period + 1) / 2.

Returns

Union{Missing,T} - The weighted moving average value. Returns values immediately as this indicator has no warm-up period.

See also: SMA, EMA, HMA

source
OnlineTechnicalIndicators.Indicators.ZLEMAType
ZLEMA{T}(; period = ZLEMA_PERIOD, input_modifier_return_type = T)

The ZLEMA type implements a Zero Lag Exponential Moving Average indicator.

ZLEMA reduces the lag inherent in traditional moving averages by adding a momentum term that compensates for the lag. This makes it more responsive to recent price changes while still providing smoothing.

Parameters

  • period::Integer = 20: The number of periods for the ZLEMA calculation
  • input_modifier_return_type::Type = T: Output value type (defaults to input type)

Formula

lag = (period - 1) / 2
adjusted_price = price + (price - price[lag])
ZLEMA = EMA(adjusted_price, period)

Returns

Union{Missing,T} - The zero lag exponential moving average value, or missing during the warm-up period (first lag observations).

See also: EMA, DEMA, TEMA

source

Indicator Value Types (alphabetically ordered)

OnlineTechnicalIndicators.Indicators.ADXValType
ADXVal{Tval}

Return value type for Average Directional Index indicator.

Fields

  • adx::Union{Missing,Tval}: Average Directional Index value (trend strength)
  • plus_di::Tval: Plus Directional Indicator (+DI)
  • minus_di::Tval: Minus Directional Indicator (-DI)

See also: ADX

source
OnlineTechnicalIndicators.Indicators.BBValType
BBVal{Tval}

Return value type for Bollinger Bands indicator containing three bands.

Fields

  • lower::Tval: Lower band (central - stddevmult * standard deviation)
  • central::Tval: Central band (moving average)
  • upper::Tval: Upper band (central + stddevmult * standard deviation)

See also: BB

source
OnlineTechnicalIndicators.Indicators.GannSwingChartValType
GannSwingChartVal{T}

A struct representing the result of the Gann Swing Chart calculation.

  • trend: Current trend state (:uptrend or :downtrend)
  • swing_high: Current swing high value or missing
  • swing_low: Current swing low value or missing
  • trend_changed: Boolean indicating if trend changed in this period
source
OnlineTechnicalIndicators.Indicators.KSTValType
KSTVal{Tval}

Return value type for Know Sure Thing (KST) indicator.

Fields

  • kst::Tval: KST line (weighted sum of smoothed ROC values)
  • signal::Union{Missing,Tval}: Signal line (moving average of KST)

See also: KST

source
OnlineTechnicalIndicators.Indicators.MACDValType
MACDVal{Tval}

Return value type for Moving Average Convergence Divergence indicator.

Fields

  • macd::Union{Missing,Tval}: MACD line (fast MA - slow MA)
  • signal::Union{Missing,Tval}: Signal line (MA of MACD line)
  • histogram::Union{Missing,Tval}: MACD histogram (MACD - signal)

See also: MACD

source
OnlineTechnicalIndicators.Indicators.ParabolicSARValType
ParabolicSARVal{Tval}

Return value type for Parabolic SAR indicator.

Fields

  • value::Tval: SAR value (stop and reverse price level)
  • trend::SARTrend.TrendEnum: Current trend direction (UP or DOWN)
  • ep::Tval: Extreme point (highest high or lowest low)
  • accel_factor::Tval: Current acceleration factor

See also: ParabolicSAR

source
OnlineTechnicalIndicators.Indicators.PeakValleyValType
PeakValleyVal{T}

A struct representing detected peaks and valleys.

  • peak: Current peak value or missing
  • valley: Current valley value or missing
  • peak_bar_index: Index of peak bar or missing
  • valley_bar_index: Index of valley bar or missing
  • is_new_peak: Boolean indicating if this is a newly detected peak
  • is_new_valley: Boolean indicating if this is a newly detected valley
source
OnlineTechnicalIndicators.Indicators.RetracementValType
RetracementVal{T}

A struct representing retracement calculation results.

  • retracement_38_long: 38% retracement level for long positions (B - (B-A) × 0.38)
  • retracement_38_short: 38% retracement level for short positions (B + (A-B) × 0.38)
  • swing_start: Point A of the swing
  • swing_end: Point B of the swing
  • current_retracement_pct: Current retracement percentage from swing_end
  • is_38_retracement_hit: Boolean indicating if 38% retracement was hit
source
OnlineTechnicalIndicators.Indicators.SFXValType
SFXVal{Tval}

Return value type for SFX indicator.

Fields

  • atr::Union{Missing,Tval}: Average True Range
  • std_dev::Tval: Standard deviation of price
  • ma_std_dev::Union{Missing,Tval}: Moving average of standard deviation

See also: SFX

source
OnlineTechnicalIndicators.Indicators.SupportResistanceLevelValType
SupportResistanceLevelVal{T}

A struct representing support and resistance levels.

  • support_level: Current support level (previous valley)
  • resistance_level: Current resistance level (previous peak)
  • support_active: Boolean indicating if support is holding
  • resistance_active: Boolean indicating if resistance is holding
  • support_broken: Boolean indicating if support was broken this period
  • resistance_broken: Boolean indicating if resistance was broken this period
source

Pattern Detectors

OnlineTechnicalIndicators.Patterns.DojiType
Doji{Tohlcv}(; body_tolerance = DOJI_BODY_TOLERANCE, input_modifier_return_type = Tohlcv)

The Doji type implements a Doji candlestick pattern detector.

A Doji is characterized by having an open and close that are virtually equal, indicating indecision in the market.

Parameters

  • body_tolerance: Maximum ratio of body size to full range to be considered a Doji (default: 0.1)

Output

source
OnlineTechnicalIndicators.Patterns.HammerType
Hammer{Tohlcv}(; body_ratio = HAMMER_BODY_RATIO, shadow_ratio = HAMMER_SHADOW_RATIO, upper_shadow_tolerance = HAMMER_UPPER_SHADOW_TOLERANCE, input_modifier_return_type = Tohlcv)

The Hammer type implements Hammer and Hanging Man candlestick pattern detectors.

A Hammer is a bullish reversal pattern with a small body at the top and a long lower shadow. A Hanging Man is the same pattern but appears at the end of an uptrend (bearish).

Parameters

  • body_ratio: Maximum ratio of body to total range (default: 0.33)
  • shadow_ratio: Minimum ratio of lower shadow to body (default: 2.0)
  • upper_shadow_tolerance: Maximum ratio of upper shadow to total range (default: 0.1)

Output

source
OnlineTechnicalIndicators.Patterns.ShootingStarType
ShootingStar{Tohlcv}(; body_ratio = SHOOTING_STAR_BODY_RATIO, shadow_ratio = SHOOTING_STAR_SHADOW_RATIO, lower_shadow_tolerance = SHOOTING_STAR_LOWER_SHADOW_TOLERANCE, input_modifier_return_type = Tohlcv)

The ShootingStar type implements Shooting Star and Inverted Hammer candlestick pattern detectors.

A Shooting Star is a bearish reversal pattern with a small body at the bottom and a long upper shadow. An Inverted Hammer is the same pattern but appears at the end of a downtrend (bullish).

Parameters

  • body_ratio: Maximum ratio of body to total range (default: 0.33)
  • shadow_ratio: Minimum ratio of upper shadow to body (default: 2.0)
  • lower_shadow_tolerance: Maximum ratio of lower shadow to total range (default: 0.1)

Output

source
OnlineTechnicalIndicators.Patterns.MarubozuType
Marubozu{Tohlcv}(; shadow_tolerance = MARUBOZU_SHADOW_TOLERANCE, input_modifier_return_type = Tohlcv)

The Marubozu type implements Marubozu candlestick pattern detector.

A Marubozu is characterized by having little to no shadows (wicks), indicating strong directional momentum. A bullish Marubozu closes at/near the high, a bearish one closes at/near the low.

Parameters

  • shadow_tolerance: Maximum ratio of shadow to total range (default: 0.05)

Output

source
OnlineTechnicalIndicators.Patterns.SpinningTopType
SpinningTop{Tohlcv}(; body_ratio = SPINNING_TOP_BODY_RATIO, min_shadow_ratio = SPINNING_TOP_MIN_SHADOW_RATIO, input_modifier_return_type = Tohlcv)

The SpinningTop type implements Spinning Top candlestick pattern detector.

A Spinning Top has a small body with relatively long shadows on both sides, indicating indecision with buying and selling pressure roughly equal.

Parameters

  • body_ratio: Maximum ratio of body to total range (default: 0.25)
  • min_shadow_ratio: Minimum ratio of each shadow to total range (default: 0.3)

Output

source
OnlineTechnicalIndicators.Patterns.EngulfingType
Engulfing{Tohlcv}(; min_body_ratio = ENGULFING_MIN_BODY_RATIO, input_modifier_return_type = Tohlcv)

The Engulfing type implements Bullish and Bearish Engulfing candlestick pattern detector.

An Engulfing pattern occurs when a candle's body completely engulfs the previous candle's body.

  • Bullish Engulfing: Down candle followed by up candle that engulfs it
  • Bearish Engulfing: Up candle followed by down candle that engulfs it

Parameters

  • min_body_ratio: Minimum ratio of current body to previous body (default: 1.1)

Output

source
OnlineTechnicalIndicators.Patterns.HaramiType
Harami{Tohlcv}(; max_body_ratio = HARAMI_MAX_BODY_RATIO, input_modifier_return_type = Tohlcv)

The Harami type implements Bullish and Bearish Harami candlestick pattern detector.

A Harami pattern occurs when a small candle's body is contained within the previous candle's body.

  • Bullish Harami: Down candle followed by small up candle contained within it
  • Bearish Harami: Up candle followed by small down candle contained within it

Parameters

  • max_body_ratio: Maximum ratio of current body to previous body (default: 0.5)

Output

source
OnlineTechnicalIndicators.Patterns.PiercingDarkCloudType
PiercingDarkCloud{Tohlcv}(; min_penetration = PIERCING_MIN_PENETRATION, input_modifier_return_type = Tohlcv)

The PiercingDarkCloud type implements Piercing Line and Dark Cloud Cover candlestick pattern detectors.

  • Piercing Line: Bullish reversal where a down candle is followed by an up candle that closes above the midpoint of the first candle's body
  • Dark Cloud Cover: Bearish reversal where an up candle is followed by a down candle that closes below the midpoint of the first candle's body

Parameters

  • min_penetration: Minimum penetration ratio into previous candle's body (default: 0.5 = 50%)

Output

source
OnlineTechnicalIndicators.Patterns.TweezerType
Tweezer{Tohlcv}(; tolerance = TWEEZER_TOLERANCE, input_modifier_return_type = Tohlcv)

The Tweezer type implements Tweezer Top and Tweezer Bottom candlestick pattern detectors.

  • Tweezer Top: Two consecutive candles with matching highs, indicating resistance
  • Tweezer Bottom: Two consecutive candles with matching lows, indicating support

Parameters

  • tolerance: Maximum relative difference between prices to be considered matching (default: 0.001 = 0.1%)

Output

source
OnlineTechnicalIndicators.Patterns.StarType
Star{Tohlcv}(; doji_tolerance = STAR_DOJI_TOLERANCE, min_gap_ratio = STAR_MIN_GAP_RATIO, input_modifier_return_type = Tohlcv)

The Star type implements Morning Star and Evening Star candlestick pattern detectors.

  • Morning Star: Bullish reversal with down candle, small-bodied star, then up candle
  • Evening Star: Bearish reversal with up candle, small-bodied star, then down candle

Parameters

  • doji_tolerance: Maximum body ratio for middle candle to be considered a star (default: 0.1)
  • min_gap_ratio: Minimum gap between star and adjacent candles (default: 0.1)

Output

source
OnlineTechnicalIndicators.Patterns.ThreeSoldiersCrowsType
ThreeSoldiersCrows{Tohlcv}(; min_progress = THREE_SOLDIERS_MIN_PROGRESS, input_modifier_return_type = Tohlcv)

The ThreeSoldiersCrows type implements Three White Soldiers and Three Black Crows candlestick pattern detectors.

  • Three White Soldiers: Three consecutive bullish candles with progressive closes
  • Three Black Crows: Three consecutive bearish candles with progressive closes

Parameters

  • min_progress: Minimum ratio of progression between consecutive candles (default: 0.2)

Output

source
OnlineTechnicalIndicators.Patterns.ThreeInsideType
ThreeInside{Tohlcv}(; max_harami_ratio = THREE_INSIDE_MAX_HARAMI_RATIO, input_modifier_return_type = Tohlcv)

The ThreeInside type implements Three Inside Up and Three Inside Down candlestick pattern detectors.

  • Three Inside Up: Bullish pattern - Harami followed by bullish confirmation
  • Three Inside Down: Bearish pattern - Harami followed by bearish confirmation

Parameters

  • max_harami_ratio: Maximum ratio of second candle body to first candle body for Harami (default: 0.5)

Output

source
OnlineTechnicalIndicators.Patterns.CandlestickPatternDetectorType
CandlestickPatternDetector{Tohlcv}(; enable_single = true, enable_two = true, enable_three = true, input_modifier_return_type = Tohlcv)

The CandlestickPatternDetector type implements a comprehensive candlestick pattern detector that aggregates all available pattern detection algorithms.

Parameters

  • enable_single: Enable single-candle pattern detection (default: true)
  • enable_two: Enable two-candle pattern detection (default: true)
  • enable_three: Enable three-candle pattern detection (default: true)

Output

source

Pattern Value Types

OnlineTechnicalIndicators.Patterns.SingleCandlePatternValType
SingleCandlePatternVal{T}

Return value type for single candlestick pattern indicators.

Fields

  • pattern::SingleCandlePatternType.SingleCandlePattern: The detected pattern
  • confidence::T: Confidence level (0.0 to 1.0)
  • direction::PatternDirection.Direction: Pattern direction (BULLISH, BEARISH, NEUTRAL)
source
OnlineTechnicalIndicators.Patterns.TwoCandlePatternValType
TwoCandlePatternVal{T}

Return value type for two-candle pattern indicators.

Fields

  • pattern::TwoCandlePatternType.TwoCandlePattern: The detected pattern
  • confidence::T: Confidence level (0.0 to 1.0)
  • direction::PatternDirection.Direction: Pattern direction (BULLISH, BEARISH, NEUTRAL)
source
OnlineTechnicalIndicators.Patterns.ThreeCandlePatternValType
ThreeCandlePatternVal{T}

Return value type for three-candle pattern indicators.

Fields

  • pattern::ThreeCandlePatternType.ThreeCandlePattern: The detected pattern
  • confidence::T: Confidence level (0.0 to 1.0)
  • direction::PatternDirection.Direction: Pattern direction (BULLISH, BEARISH, NEUTRAL)
source
OnlineTechnicalIndicators.Patterns.AllPatternsValType
AllPatternsVal{S}

Return value type containing all detected candlestick patterns.

Fields

  • single_patterns::Vector{SingleCandlePatternVal{S}}: All detected single-candle patterns
  • two_patterns::Vector{TwoCandlePatternVal{S}}: All detected two-candle patterns
  • three_patterns::Vector{ThreeCandlePatternVal{S}}: All detected three-candle patterns
source

Core Types

OnlineTechnicalIndicators.SampleData.TabOHLCVType
TabOHLCV

Sample OHLCV data table implementing the Tables.jl interface.

Contains template financial data with Date indices and Float64 price/volume values.

Fields

  • Index::Vector{Date}: Vector of dates
  • Open::Vector{Float64}: Opening prices
  • High::Vector{Float64}: High prices
  • Low::Vector{Float64}: Low prices
  • Close::Vector{Float64}: Closing prices
  • Volume::Vector{Float64}: Trading volumes
source
OnlineTechnicalIndicators.Indicators.TechnicalIndicatorWrapperType
TechnicalIndicatorWrapper{T}

Wraps a technical indicator type with its constructor arguments for deferred instantiation.

Fields

  • indicator_type::T: The type of technical indicator to construct
  • args::Tuple: Positional arguments for the indicator constructor
  • kwargs::Base.Pairs: Keyword arguments for the indicator constructor
source
OnlineTechnicalIndicators.Indicators.TechnicalIndicatorResultsType
TechnicalIndicatorResults{Ttime,Tout}

Container for technical indicator results implementing the Tables.jl interface.

Fields

  • name::Symbol: Name of the indicator
  • fieldnames::Tuple: Names of the output fields
  • fieldtypes::Tuple: Types of the output fields
  • index::Vector{Ttime}: Vector of timestamps/indices
  • output::Vector{Tout}: Vector of indicator output values
source
OnlineTechnicalIndicators.Resample.OHLCType
OHLC{Tprice}

Mutable OHLC (Open, High, Low, Close) data structure for resampling price data.

Fields

  • status::OHLCStatus.OHLCStatusEnum: Status of the OHLC data (INIT, NEW, USED)
  • open::Tprice: Opening price
  • high::Tprice: Highest price
  • low::Tprice: Lowest price
  • close::Tprice: Closing price
source
OnlineTechnicalIndicators.Resample.ResamplerByType
ResamplerBy <: OnlineStat{TimedEvent}

Online statistic that resamples timed events into aggregated periods.

Fields

  • agg::AgregatedStat: Current aggregated statistic
  • n::Int: Number of observations processed
  • sampling_period::SamplingPeriod: The sampling period to use
  • stat_builder::StatBuilder: Builder for creating new aggregation instances
  • input_modifier::Function: Function to modify input data before processing
  • input_filter::Function: Function to filter input data
source

Other

Removed Function

add_input_indicator! has been removed. Use OnlineStatsChains.StatDAG to chain indicators instead. See the Migration Guide for detailed examples and migration instructions.

OnlineTechnicalIndicators.StatLagType
StatLag(ind, b)

Track a moving window (previous b copies) of ind.

Example

ind = SMA{Float64}(period = 3)
prices = [10.81, 10.58, 10.07, 10.58, 10.56, 10.4, 10.74, 10.16, 10.29, 9.4, 9.62]
ind = StatLag(ind, 4)
fit!(ind, prices)
ind.lag[end-1]
source
OnlineTechnicalIndicators.TechnicalIndicatorIteratorType
TechnicalIndicatorIterator(indicator_type, iterable_input, args...; kwargs...)

Returns an iterator.

Example

using OnlineTechnicalIndicators
using OnlineTechnicalIndicators.SampleData: CLOSE_TMPL

SISO indicator

itr = TechnicalIndicatorIterator(SMA, CLOSE_TMPL; period = 3)

println("First iteration")
for val in itr
    println(val)
end

println("")

println("Second iteration")
Iterators.reset!(itr)
for val in itr
    println(val)
end

println("")

println("Third iteration with collect")
# itr = TechnicalIndicatorIterator(SMA, CLOSE_TMPL; period = 3)
# or
Iterators.reset!(itr)
println(eltype(itr))
println(collect(itr))

println("")

SIMO indicator

itr = TechnicalIndicatorIterator(BB, CLOSE_TMPL)
println(collect(itr))
source