Usage

Quick Start

# Import indicators from the Indicators submodule (fit! and value are re-exported)
using OnlineTechnicalIndicators.Indicators: SMA, EMA, RSI, fit!, value

# Create an indicator
ind = SMA{Float64}(period=10)

# Feed data
prices = [100.0, 101.0, 102.0, 101.5, 103.0, 102.5, 104.0, 103.5, 105.0, 104.5]
for price in prices
    fit!(ind, price)
end

# Get the current value
println(value(ind))  # 102.6

Working with OHLCV Data

using OnlineTechnicalIndicators.Candlesticks: OHLCV
using OnlineTechnicalIndicators.Indicators: ATR, fit!, value

# Create OHLCV candle
candle = OHLCV(100.0, 105.0, 95.0, 102.0, volume=1000.0)

# Create indicator for OHLCV input
ind = ATR{OHLCV{Missing,Float64,Float64}}(period=14)
fit!(ind, candle)

Module Structure

OnlineTechnicalIndicators.jl exports only submodule names. Import types and functions from the appropriate submodule:

  • Candlesticks: OHLCV types (OHLCV, OHLCVFactory, ValueExtractor)
  • Indicators: All technical indicators (SMA, EMA, RSI, MACD, etc.) plus fit! and value
  • Patterns: Candlestick pattern recognition (Doji, Hammer, Engulfing, etc.) plus fit! and value
  • Internals: Utility functions for custom indicator implementation
  • Wrappers: Indicator composition utilities (Smoother, DAGWrapper)
  • Factories: Factory functions for creating indicators (MovingAverage)
  • SampleData: Sample data for testing

Note: fit! and value are re-exported from Indicators and Patterns for convenience. You can also import them directly from OnlineStatsBase.

See the Migration Guide for details on the new import patterns.

Resources

See examples and tests

OnlineTechnicalIndicators.jl - installing and using it

OnlineTechnicalIndicators.jl - installing and using it

OnlineTechnicalIndicators.jl - dealing with TSFrames

OnlineTechnicalIndicators.jl - dealing with TSFrames