@reincharts/indicators
Indicator calculators, bar transforms and indicator components.
npm install @reincharts/indicatorsEverything here is also re-exported by the umbrella package reincharts.
Components
| Name | Description |
|---|---|
| ATR | Average True Range. |
| BollingerBands | Bollinger Bands with a filled band. |
| ElderRay | Elder ray bull / bear power histograms. |
| ForceIndex | Elder force index. |
| Indicator | Renders any indicator definition: lines, histograms, areas, dots, step lines, levels and fills. |
| MACD | MACD line, signal line and 4-color histogram. |
| MovingAverage | A moving average line (SMA, EMA, WMA, TMA, HMA or VWMA) on the price pane. |
| RSI | Relative Strength Index with 30 / 50 / 70 levels and a filled 30–70 band. |
| SAR | Parabolic SAR dots on the price pane. |
| Stochastic | Stochastic oscillator (%K, %D) with 20 / 80 levels. |
Functions
| Name | Description |
|---|---|
| adx | ADX only (see dmi). |
| aroon | Aroon up / down over period + 1 bars (default period 14). |
| atr | Average true range (Wilder). |
| bollinger | Bollinger Bands: basis MA ± multiplier × population standard deviation. |
| cci | Commodity Channel Index: (src − SMA) / (0.015 × mean deviation). |
| change | Bar-to-bar change, absolute and in percent. |
| compare | Percent change of a series relative to its first defined value at or after baseIndex (e.g. |
| defaultInputs | Default input values of a definition. |
| defineIndicator | Identity helper that types a custom indicator definition. |
| dmi | Directional Movement Index (+DI, −DI) and ADX (Wilder smoothing). |
| donchian | Donchian Channels: highest high, lowest low and their average over period bars. |
| elderImpulse | Elder impulse system: 1 (green) when both the EMA and the MACD histogram rise, −1 (red) when both fall, 0 (neutral / blue) otherwise; undefined until both are available. |
| elderRay | Elder-ray bull and bear power ("Bull Bear Power" is their sum). |
| ema | Exponential moving average (alpha = 2 / (period + 1)), seeded with the SMA of the first period values. |
| envelope | Moving average envelope: basis × (1 ± percent / 100). |
| fastStochastic | Fast stochastic (%K unsmoothed). |
| forceIndex | Raw force index: (src − src[1]) × volume. |
| heikinAshi | Heikin Ashi bars: close = (O+H+L+C)/4, open = (prev open + prev close)/2 (first bar: (O+C)/2), high = max(H, open, close), low = min(L, open, close). |
| hma | Hull moving average: WMA(2·WMA(n/2) − WMA(n), √n). |
| ichimoku | Ichimoku Kinko Hyo (defaults 9 / 26 / 52 / 26). |
| indicatorName | Legend name: short name followed by number and source inputs, plus select inputs that differ from their default ("RSI 14 close", "BB 20 close 2", "MA 9 close ema"). |
| kagi | Kagi lines: the line extends while price keeps its direction and reverses after moving reversal against it. |
| keltner | Keltner Channels: MA ± multiplier × ATR (defaults: EMA 20, ×2, ATR 10). |
| lineBreak | Line break (three line break by default): a new line in the trend direction for every new close beyond the last line; a reversal line only when the close breaks the extreme of the last lines lines. |
| macd | Moving Average Convergence Divergence. |
| mfi | Money Flow Index (volume weighted RSI) on hlc3 by default. |
| momentum | Momentum: src − src[n]. |
| movingAverage | Any moving average by type ("sma" | "ema" | "wma" | "rma" | "hma" | "tma"). |
| obv | On-balance volume: cumulative volume signed by the direction of the source. |
| pointAndFigure | Point & figure columns. |
| renko | Traditional renko: a new brick each time the price moves one box beyond the last brick's top (up) or bottom (down) — reversals therefore need two boxes from the last close. |
| resolveInputs | Defaults merged with partial inputs (undefined values fall back to defaults). |
| rma | Wilder's moving average (RMA / SMMA, alpha = 1 / period) as used by RSI and ATR. |
| roc | Rate of change in percent: 100·(src − src[n]) / src[n]. |
| rsi | Relative Strength Index (Wilder smoothing). |
| sar | Parabolic SAR (Wilder), with the standard start / increment / max parameters. |
| slowStochastic | Slow stochastic (%K smoothed by 3). |
| sma | Simple moving average. |
| smoothedForceIndex | Elder's force index smoothed by a moving average ("Elder Force Index"). |
| stddev | Rolling population standard deviation. |
| stochastic | Full stochastic oscillator: %K = 100·(C − LL)/(HH − LL) smoothed by kSmoothing, %D = SMA(%K). |
| supertrend | Supertrend: hl2 ± factor × ATR with trailing bands. |
| tma | Triangular moving average (double smoothed SMA, weights 1, 2, ..., 2, 1). |
| trueRange | True range per bar: max(H − L, |H − prevC|, |L − prevC|). |
| volume | Volume, its moving average and the bar direction used to color volume bars. |
| vwap | Anchored volume weighted average price with standard deviation bands. |
| vwma | Volume weighted moving average: Σ(price·volume) / Σ(volume) over period bars (default 20). |
| williamsR | Williams %R in [−100, 0]: 100·(C − HH)/(HH − LL). |
| wma | Linearly weighted moving average (weights 1..period, newest heaviest). |
Constants
| Name | Description |
|---|---|
| adxIndicator | Average Directional Index indicator definition (indicators.adx). |
| aroonIndicator | Aroon indicator definition (indicators.aroon). |
| atrIndicator | Average True Range indicator definition (indicators.atr). |
| bollingerIndicator | Bollinger Bands indicator definition (indicators.bollinger). |
| cciIndicator | Commodity Channel Index indicator definition (indicators.cci). |
| dmiIndicator | Directional Movement Index indicator definition (indicators.dmi). |
| donchianIndicator | Donchian Channels indicator definition (indicators.donchian). |
| elderImpulseIndicator | Elder Impulse System indicator definition (indicators.elderImpulse). |
| elderRayIndicator | Elder Ray (Bull / Bear Power) indicator definition (indicators.elderRay). |
| emaIndicator | Moving Average Exponential indicator definition (indicators.ema). |
| envelopeIndicator | Envelope indicator definition (indicators.envelope). |
| forceIndexIndicator | Elder Force Index indicator definition (indicators.forceIndex). |
| hmaIndicator | Hull Moving Average indicator definition (indicators.hma). |
| ichimokuIndicator | Ichimoku Cloud indicator definition (indicators.ichimoku). |
| indicators | Every built-in indicator definition keyed by id. |
| keltnerIndicator | Keltner Channels indicator definition (indicators.keltner). |
| macdIndicator | MACD indicator definition (indicators.macd). |
| mfiIndicator | Money Flow Index indicator definition (indicators.mfi). |
| momentumIndicator | Momentum indicator definition (indicators.momentum). |
| movingAverageTypes | Every moving average type, e.g. |
| obvIndicator | On Balance Volume indicator definition (indicators.obv). |
| priceSources | Every built-in price source, e.g. |
| rocIndicator | Rate Of Change indicator definition (indicators.roc). |
| rsiIndicator | Relative Strength Index indicator definition (indicators.rsi). |
| sarIndicator | Parabolic SAR indicator definition (indicators.sar). |
| smaIndicator | Moving Average indicator definition (indicators.sma). |
| stddevIndicator | Standard Deviation indicator definition (indicators.stddev). |
| stochasticIndicator | Stochastic indicator definition (indicators.stochastic). |
| supertrendIndicator | Supertrend indicator definition (indicators.supertrend). |
| tmaIndicator | Triangular Moving Average indicator definition (indicators.tma). |
| volumeIndicator | Volume indicator definition (indicators.volume). |
| vwapIndicator | VWAP indicator definition (indicators.vwap). |
| vwmaIndicator | Volume Weighted Moving Average indicator definition (indicators.vwma). |
| williamsRIndicator | Williams %R indicator definition (indicators.williamsR). |
| wmaIndicator | Moving Average Weighted indicator definition (indicators.wma). |
Types
| Name | Description |
|---|---|
| AnyMovingAverageOptions | |
| AroonResult | |
| ATROptions | |
| ATRProps | Props of the ATR component. |
| Bands | Upper / middle / lower band values. |
| BollingerBandsProps | Props of the BollingerBands component. |
| BollingerOptions | |
| BoxSize | Box / reversal size: a fixed price amount or "atr" (ATR at the last bar). |
| CCIOptions | |
| ChangeOverOptions | |
| ChangeResult | |
| CompareOptions | |
| DMIOptions | |
| DMIResult | |
| DonchianOptions | |
| ElderImpulseOptions | |
| ElderRayOptions | |
| ElderRayProps | Props of the ElderRay component. |
| ElderRayResult | |
| EnvelopeOptions | |
| ForceIndexProps | Props of the ForceIndex component. |
| HeikinAshiBar | A source bar with its OHLC replaced by Heikin Ashi values (every other field, e.g. |
| IchimokuOptions | |
| IchimokuResult | Ichimoku values computed at each bar, NOT shifted. |
| IndicatorColorContext | Extra context passed to IndicatorOutput.colorFn. |
| IndicatorComponentProps | Props shared by the convenience indicator components (everything of <Indicator> except definition / inputs). |
| IndicatorDefinition | Everything needed to compute, draw, name and configure an indicator. |
| IndicatorFill | A filled area between two outputs (by key) or an output and a constant / two constants. |
| IndicatorInput | One user-editable setting of an indicator (rendered by settings dialogs). |
| IndicatorLevel | A horizontal reference line, e.g. |
| IndicatorOutput | One plotted output of an indicator. |
| IndicatorOutputStyle | Style overrides for one output. |
| IndicatorProps | Props of the Indicator component. |
| KagiLine | A kagi line segment between two reversals. |
| KagiOptions | |
| KeltnerOptions | |
| LineBreakBar | A line break bar (draw like a candle body from open to close). |
| LineBreakOptions | |
| LookbackOptions | |
| MACDOptions | |
| MACDProps | Props of the MACD component. |
| MACDResult | |
| MAInputs | Inputs of the moving average definitions. |
| MFIOptions | |
| MovingAverageOptions | |
| MovingAverageProps | Props of the MovingAverage component. |
| MovingAverageType | Moving average types accepted by the maType option of calculators. |
| OHLCVOptions | Field accessors for calculators that read several bar fields (ATR, Stochastic, VWAP...). |
| PointAndFigureBox | One box of a column. |
| PointAndFigureColumn | A column of X (direction 1) or O (direction −1) boxes. |
| PointAndFigureOptions | |
| PriceSource | Built-in price sources. |
| RenkoBrick | A renko brick. |
| RenkoOptions | |
| RSIOptions | |
| RSIProps | Props of the RSI component. |
| SAROptions | |
| SARProps | Props of the SAR component. |
| SmoothedForceIndexOptions | |
| Source | What a calculator reads: a built-in price source, a field name or a function of the datum. |
| SourceOptions | |
| StdDevOptions | |
| StochasticOptions | |
| StochasticProps | Props of the Stochastic component. |
| StochasticResult | |
| SupertrendOptions | |
| SupertrendResult | |
| TransformOptions | Options shared by the bar transforms (renko, kagi, point & figure, line break). |
| Values | Values aligned 1:1 with the input data; undefined during warm-up or where inputs are missing. |
| VolumeOptions | |
| VolumeResult | |
| VWAPAnchor | When a VWAP period starts: every day ("session"), week (Monday), month, year, never, or a custom predicate. |
| VWAPOptions | |
| VWAPResult | |
| VWMAOptions |