Skip to main content

Crate ferrochart_indicators

Crate ferrochart_indicators 

Source
Expand description

Incremental technical indicators for FerroChart.

Every function returns a Builtin that implements ferrochart_core::plugin::Indicator; attach it with Chart::add_indicator. The formulas, seeds and warmups are specified in docs/book/src/indicators.md; all indicators are tested against a numpy reference implementation, and those TA-Lib has against TA-Lib.

use ferrochart_core::chart::SeriesOptions;
use ferrochart_core::frame::SeriesKind;
use ferrochart_core::plugin::Placement;
use ferrochart_core::testing::random_walk;
use ferrochart_core::chart::SeriesData;
use ferrochart_core::{Chart, ChartOptions};
use ferrochart_indicators::{Source, macd, sma};

let mut chart = Chart::new(ChartOptions::default());
let candles = chart.add_series(chart.main_pane(), SeriesKind::Candlestick, SeriesOptions::default())?;
chart.set_data(candles, SeriesData::Ohlc(random_walk(7, 500, 0, 60_000)?))?;
chart.add_indicator(candles, Box::new(sma(20, Source::Close)?), Placement::Overlay)?;
chart.add_indicator(candles, Box::new(macd(12, 26, 9, Source::Close)?), Placement::NewPane)?;

Modules§

named
Indicators by name, with parameters by name (docs/book/src/indicators.md): the one mapping the JS, Python and C bindings and the Rust API share, so "ema" with n = 20 means the same everywhere.

Structs§

Builtin
A built-in indicator, ready for Chart::add_indicator.

Enums§

Source
Price an indicator reads (docs/book/src/indicators.md).
VwapAnchor
Where VWAP restarts (docs/book/src/indicators.md, VWAP).

Functions§

adx
ADX with the directional indicators: adx, plus_di, minus_di (docs/book/src/indicators.md, ADX / DMI).
aroon
Aroon: up, down (docs/book/src/indicators.md, Aroon).
atr
Average true range (docs/book/src/indicators.md, ATR).
boll
Bollinger bands: upper, mid, lower (docs/book/src/indicators.md, BOLL).
cci
Commodity channel index (docs/book/src/indicators.md, CCI).
cmf
Chaikin money flow (docs/book/src/indicators.md, CMF).
dema
Double exponential moving average (docs/book/src/indicators.md, DEMA).
donchian
Donchian channel: upper, mid, lower (docs/book/src/indicators.md, Donchian).
ema
Exponential moving average with an SMA seed (docs/book/src/indicators.md, EMA).
hma
Hull moving average (docs/book/src/indicators.md, HMA).
ichimoku
Ichimoku cloud: tenkan, kijun, span_a, span_b (drawn shift bars later), chikou (drawn shift bars earlier) (docs/book/src/indicators.md, Ichimoku).
keltner
Keltner channel: upper, mid, lower (docs/book/src/indicators.md, Keltner).
macd
MACD: macd, signal, hist (docs/book/src/indicators.md, MACD).
mfi
Money flow index (docs/book/src/indicators.md, MFI).
momentum
Momentum (docs/book/src/indicators.md, Momentum).
obv
On-balance volume (docs/book/src/indicators.md, OBV).
roc
Rate of change in percent (docs/book/src/indicators.md, ROC).
rsi
Relative strength index (docs/book/src/indicators.md, RSI).
sar
Parabolic SAR, as TA-Lib computes it (docs/book/src/indicators.md, SAR).
sma
Simple moving average (docs/book/src/indicators.md, SMA).
stoch
Stochastic oscillator: %K, %D (docs/book/src/indicators.md, Stoch).
stochrsi
Stochastic RSI: %K, %D (docs/book/src/indicators.md, StochRSI).
supertrend
SuperTrend: the lower band in up trends (long), the upper band in down trends (short) (docs/book/src/indicators.md, SuperTrend).
tema
Triple exponential moving average (docs/book/src/indicators.md, TEMA).
trix
TRIX (docs/book/src/indicators.md, TRIX).
volume_ma
Moving average of the volume, on the volume’s pane and scale (docs/book/src/indicators.md, Volume MA).
vwap
Volume-weighted average price from anchor on (docs/book/src/indicators.md, VWAP). utc_offset_ms moves the session boundaries.
vwma
Volume-weighted moving average (docs/book/src/indicators.md, VWMA).
willr
Williams %R (docs/book/src/indicators.md, Williams %R).
wma
Linearly weighted moving average (docs/book/src/indicators.md, WMA).