Expand description
Warmup-exact batch port of TA-Lib technical indicators for Rust.
See crate README for module layout (lib.rs vs candles.rs) and parity policy.
§Example
use ta_indicators::{bollinger_bands, macd, rsi};
let closes = [100.0, 101.0, 102.0, 101.5, 103.0, 104.0, 103.5, 105.0];
let rsi_3 = rsi(&closes, 3);
let macd_out = macd(&closes, 3, 6, 3);
let bands = bollinger_bands(&closes, 3, 2.0);
assert_eq!(rsi_3.len(), closes.len());
assert_eq!(macd_out.macd.len(), closes.len());
assert_eq!(bands.middle.len(), closes.len());Outputs use Option<f64> for numeric indicators. Warmup bars are None;
emitted bars are matched against committed TA-Lib reference fixtures.
Structs§
- AdxFamily
- Aroon
- Bollinger
Bands - Directional
Movement - Linear
Regression - Macd
- Price
Context - Price
Transforms - Stoch
Rsi
Functions§
- ad
- adosc
- adx_
family - apo
- aroon
- beta
- Rolling BETA of
real0againstreal1(TA-LibBETA). Usesperiodtrailing simple returns;beta = (n·Σxy − Σx·Σy) / (n·Σxx − (Σx)²)wherexarereal0returns andyarereal1returns. First value at indexperiod. - bollinger_
bands - bop
- cdl_
2crows - Two crows: long white, then a black gapping up, then a black opening within the second body and closing within the first body. Always bearish.
- cdl_
3blackcrows - Three black crows: three long black candles with very short lower shadows, each opening within the prior body and closing progressively lower.
- cdl_
3inside - Three inside up/down: a long candle, a harami body engulfed by it, then a confirming candle of the opposite color to the first.
- cdl_
3linestrike - Three-line strike: three candles of one color, then a fourth of the opposite color that engulfs the prior run.
- cdl_
3outside - Three outside up/down: an engulfing pair confirmed by a third candle that continues in the engulfing direction.
- cdl_
3starsinsouth - Three stars in the south: a faltering downtrend of three black candles.
- cdl_
3whitesoldiers - Three white soldiers: three rising white candles with very short upper shadows and only modest body shrinkage.
- cdl_
abandonedbaby - Abandoned baby: a doji isolated by gaps from a long candle and a confirming candle of the opposite color.
- cdl_
advanceblock - Advance block: three rising white candles whose advance falters via shrinking bodies and lengthening upper shadows.
- cdl_
belthold - Belt hold: a long candle that opens at its extreme (no shadow on the open end).
- cdl_
breakaway - Breakaway: a five-candle gap-and-run that closes back through the gap.
- cdl_
closing_ marubozu - Closing marubozu: long body with no shadow on the closing end.
- cdl_
concealbabyswall - Concealing baby swallow: four black candles where the third’s upper shadow pierces the second body and the fourth engulfs the third.
- cdl_
counterattack - Counterattack: two long opposite-colored candles that close at the same level.
- cdl_
darkcloudcover - Dark cloud cover: a black candle opening above a prior long white candle and closing well into its body.
- cdl_
doji - Doji: real body no larger than the doji-body average.
- cdl_
dojistar - Doji star: a long candle followed by a gapping doji.
- cdl_
dragonfly_ doji - Dragonfly doji: doji body with a negligible upper shadow and a long lower shadow.
- cdl_
engulfing - Engulfing: a candle whose real body fully engulfs the prior opposite-colored body (±80 when one end exactly matches).
- cdl_
eveningdojistar - Evening doji star: long white, gapping doji, then a black candle closing well into the first body.
- cdl_
eveningstar - Evening star: long white, a short-bodied star gapping up, then a black candle closing well into the first body.
- cdl_
gapsidesidewhite - Up/down-gap side-by-side white lines: a gap followed by two similar white candles.
- cdl_
gravestone_ doji - Gravestone doji: doji body with a negligible lower shadow and a long upper shadow.
- cdl_
hammer - Hammer: a small-bodied candle with a long lower shadow near the prior lows.
- cdl_
hangingman - Hanging man: a small-bodied candle with a long lower shadow near the prior highs.
- cdl_
harami - Harami: a small real body engulfed by the prior long body (±80 when one end matches).
- cdl_
haramicross - Harami cross: a harami whose inside candle is a doji.
- cdl_
high_ wave - High-wave: small body with very long shadows on both sides.
- cdl_
hikkake - Hikkake: an inside bar followed by a false breakout, optionally confirmed within three bars (±200 on confirmation). Stateful across bars.
- cdl_
hikkakemod - Modified hikkake: a three-bar inside formation with a close near the second candle’s extreme, optionally confirmed within three bars. Stateful.
- cdl_
homingpigeon - Homing pigeon: a small black body engulfed by a prior long black body.
- cdl_
identical3crows - Identical three crows: three black candles whose opens match the prior closes.
- cdl_
inneck - In-neck: a black candle followed by a white one closing just into the prior body.
- cdl_
invertedhammer - Inverted hammer: a small-bodied candle with a long upper shadow gapping down.
- cdl_
kicking - Kicking: two opposite marubozu separated by a gap.
- cdl_
kickingbylength - Kicking by length: like kicking, but the result follows the longer marubozu.
- cdl_
ladderbottom - Ladder bottom: three declining black candles, a black candle with an upper shadow, then a white candle breaking out.
- cdl_
long_ legged_ doji - Long-legged doji: doji body with at least one long shadow.
- cdl_
long_ line - Long white/black line: long body with short shadows.
- cdl_
marubozu - Marubozu: long body with negligible shadows on both ends.
- cdl_
matchinglow - Matching low: two black candles closing at the same level.
- cdl_
mathold - Mat hold: a long white candle, an upside gap, three holding candles, then a white candle breaking out.
- cdl_
morningdojistar - Morning doji star: long black, gapping doji, then a white candle closing well into the first body.
- cdl_
morningstar - Morning star: long black, a short-bodied star gapping down, then a white candle closing well into the first body.
- cdl_
onneck - On-neck: a black candle followed by a white one closing at the prior low.
- cdl_
piercing - Piercing: a black candle followed by a white candle opening below the prior low and closing above the prior midpoint.
- cdl_
rickshawman - Rickshaw man: a long-legged doji whose body sits near the high-low midpoint.
- cdl_
risefall3methods - Rising/falling three methods: a long candle, three small counter-trend candles held within its range, then a long continuation candle.
- cdl_
separatinglines - Separating lines: a candle that opens at the prior open but reverses into a long belt-hold of the opposite color.
- cdl_
shootingstar - Shooting star: a small-bodied candle with a long upper shadow gapping up.
- cdl_
short_ line - Short line: short body with short shadows.
- cdl_
spinning_ top - Spinning top: small body with both shadows longer than the body.
- cdl_
stalledpattern - Stalled pattern: two long white candles then a small white candle riding the second’s shoulder.
- cdl_
sticksandwich - Stick sandwich: a black candle, a white candle trading above it, then a black candle closing at the first close.
- cdl_
takuri - Takuri: a doji-bodied candle with a very long lower shadow and negligible upper shadow.
- cdl_
tasukigap - Tasuki gap: a gap followed by an opposite-colored candle of similar size that fails to close the gap.
- cdl_
thrusting - Thrusting: a black candle followed by a white candle closing into, but under the midpoint of, the prior body.
- cdl_
tristar - Tristar: three doji where the middle one gaps away from the others.
- cdl_
unique3river - Unique three river bottom: a long black candle, a black harami making a new low, then a small white candle.
- cdl_
upsidegap2crows - Upside gap two crows: a long white candle, a short black gapping up, then a black candle engulfing it but still closing above the first.
- cdl_
xsidegap3methods - Up/down-gap three methods: a gap between two same-colored candles filled by a third opposite candle.
- cmo
- correl
- Rolling Pearson correlation of
real0andreal1(TA-LibCORREL) over a trailing window of raw values. First value at indexperiod - 1; when the variance product is non-positive TA-Lib emits0.0. - dema
- directional_
movement - ema
- ht_
dcperiod - HT_DCPERIOD — dominant cycle period.
- ht_
dcphase - HT_DCPHASE — dominant cycle phase.
- ht_
phasor - HT_PHASOR — (in-phase, quadrature) components.
- ht_sine
- HT_SINE — (sine, lead sine) wave.
- ht_
trendline - HT_TRENDLINE — instantaneous trendline.
- ht_
trendmode - HT_TRENDMODE — trend vs cycle mode (1 = trend, 0 = cycle; warmup zero-filled).
- kama
- linear_
regression - macd
- macdext_
sma - MACDEXT with all three moving averages set to SMA (TA-Lib
matype = 0). fast SMA − slow SMA forms the MACD line; an SMA over the MACD line forms the signal. Matchestalib.MACDEXT(.., fastmatype=0, slowmatype=0, signalmatype=0). - macdfix
- mama
- MAMA — (MAMA, FAMA) adaptive moving averages.
- mavp
- Variable-period simple moving average (TA-Lib
MAVP,matype = 0). Each bar usesperiods[idx]truncated to an integer and clamped to[min_period, max_period]; the global warmup ismax_period - 1so every emitted bar has a full window. - ppo
- price_
context - price_
transforms - rolling_
sum - rsi
- sar
- sarext
- Parabolic SAR Extended (TA-Lib
SAREXT). Mirrors the provensarcore but adds: explicit start value / initial direction, per-side acceleration (init/step/max for long and short), an offset-on-reverse, and TA-Lib’s sign convention where short bars are emitted as the negated SAR. First value at index 1. - stochrsi
- t3
- tema
- trix
- ultosc