indicators

Indicators

Fastest Technical Indicators written in typescript, Supports: Browser, NodeJS, ES6, CommonJS, Bun, Svelte, React, Angular, etc. More than +100 indicators(SMA, EMA, RSI, MACD, ...)

Version Info

A JavaScript Version

There is also a newer version written in JavaScript.

Supports

Browser, ES6, CommonJS, NodeJS, Bun, Svelte, React, Angular, etc.

About

Fastest Technical Indicators written in TypeScript

  • Zero Dependencies: @ixjb94/Indicators is built from the ground up to be self-contained, with no external dependencies.
  • No Internal Function Calls: Each Method in the library operates independently.

Tests (Jest)

All of the indicators data have been tested with TradingView data and other Libraries.
You can find few in ./tests folder.
(Or you can run: npm test)
Note: All data have been tested with at least last 3 (tail) of TradingView's data.
Data Window: DOGEUSDT-4h-2023-10 (October)
Data Source: Binance Futures ::: Binance Vision

Comparison with TradingView (EMA 10)

Indicators Data Test

Benchmark

See full Benchmark info

Installation

npm install @ixjb94/indicators

Usage NodeJS

import { Indicators } from "@ixjb94/indicators"

// OR
const { Indicators } = require("@ixjb94/indicators")

Usage Browser

index.html example:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>My Indicators</title>
</head>
<body>

    <!--
        PLEASE NOTE: you probably just need one of these
        - browser.js
        - browser-indicators.js
        - browser-indicators-sync.js
        - browser-indicators-extract.js

        or extracted versions like this:
        - ./ema.js | ./sma.js | ./rsi.js
    -->

    <!-- all versions -->
    <script src="./node_modules/@ixjb94/indicators/dist/browser.js"></script>

    <!-- indicators -->
    <script src="./node_modules/@ixjb94/indicators/dist/browser-indicators.js"></script>

    <!-- extracted (not in a class) -->
    <script src="./node_modules/@ixjb94/indicators/dist/browser-indicators-extract.js"></script>
    
    <!-- sync indicators -->
    <script src="./node_modules/@ixjb94/indicators/dist/browser-indicators-sync.js"></script>

    <!-- extracted indicators -->
    <script src="./node_modules/@ixjb94/indicators/dist/core/extract/ema.js"></script>
    <script src="./node_modules/@ixjb94/indicators/dist/core/extract/sma.js"></script>
    <script src="./node_modules/@ixjb94/indicators/dist/core/extract/rsi.js"></script>
    <!-- ... -->

    <!-- how to use class based -->
    <script>
        const library = indicators
        const ta = new library.Indicators()

        ta.ema(close, 20).then(data => console.log(data))
    </script>

    <!-- how to use extracted versions -->
    <script>
        const close = [1, 2, 3, 4, 5, 6]
        ema(close, 3).then(result => {
            console.log(result)
            // output: [1, 1.5, 2.25, 3.125, 4.0625, 5.03125]
        })
    </script>

    <!-- how to use extracted version (browser-indicators-extract.js) -->
    <script src="./node_modules/@ixjb94/indicators/dist/browser-indicators-extract.js"></script>
    <script>
        const { ema, sma } = indicators
        ema([1,2,3,4,5,6], 3).then(d => console.log(d))
    </script>
</body>
</html>

Note: you can move files from node_modules to somewhere else you want to like dist, public, etc.

OR you can use unpkg:

https://unpkg.com/@ixjb94/indicators@latest/dist/browser.js
https://unpkg.com/@ixjb94/indicators@latest/dist/browser-indicators.js
https://unpkg.com/@ixjb94/indicators@latest/dist/browser-indicators-sync.js
https://unpkg.com/@ixjb94/indicators@latest/dist/browser-indicators-extract.js

OR
https://unpkg.com/@ixjb94/indicators@latest/dist/core/extract/ema.js
https://unpkg.com/@ixjb94/indicators@latest/dist/core/extract/sma.js
https://unpkg.com/@ixjb94/indicators@latest/dist/core/extract/rsi.js
// ... and others

see the full list:
https://unpkg.com/browse/@ixjb94/[email protected]/dist/core/extract/

Indicators Consists Of

Indicators consists of these classes:
1- Indicators: new Indicators()
2- IndicatorsSync: new IndicatorsSync()
3- Or you can use then directly without using classes

Examples

Note: Everything isPromised so you need to do .then or await
unless you use Sync versions.

let ta = new Indicators()

ta.sma(close, 20)
ta.rsi(close, 14)

Types & Intellisense & Browser Support

Indicators

āœ… = Available and fastest
āŒ = Indicator is not available
šŸ”„ = Developing...
Compared to:
node-talib, tulipnode, technicalindicators, pandas_ta

Identifier Indicator Name @ixjb94/indicators
ad Accumulation/Distribution Line āœ…
adosc Accumulation/Distribution Oscillator āœ…
adx Average Directional Movement Index āœ…
adxr Average Directional Movement Rating āœ…
ao Awesome Oscillator āœ…
apo Absolute Price Oscillator āœ…
aroon Aroon āœ…
aroonosc Aroon Oscillator āœ…
atr Average True Range āœ…
avgprice Average Price āœ…
bbands Bollinger Bands āœ…
bop Balance of Power āœ…
cci Commodity Channel Index āœ…
cmo Chande Momentum Oscillator āœ…
crossany Crossany āœ…
crossover Crossover āœ…
crossunder Crossunder āœ…
crossOverNumber Crossover a number āœ…
crossUnderNumber Crossunder a number āœ…
cvi Chaikins Volatility āœ…
decay Linear Decay āœ…
dema Double Exponential Moving Average āœ…
di Directional Indicator āœ…
dm Directional Movement āœ…
dpo Detrended Price Oscillator āœ…
dx Directional Movement Index āœ…
edecay Exponential Decay āœ…
ema Exponential Moving Average āœ…
emv Ease of Movement āœ…
fisher Fisher Transform āœ…
fosc Forecast Oscillator āœ…
hma Hull Moving Average āœ…
kama Kaufman Adaptive Moving Average āœ…
kvo Klinger Volume Oscillator āœ…
lag Lag āœ…
linreg Linear Regression āœ…
linregintercept Linear Regression Intercept āœ…
linregslope Linear Regression Slope āœ…
macd Moving Average Convergence/Divergence āœ…
marketfi Market Facilitation Index āœ…
mass Mass Index āœ…
max Maximum In Period āœ…
md Mean Deviation Over Period āœ…
medprice Median Price āœ…
mfi Money Flow Index āœ…
min Minimum In Period āœ…
mom Momentum āœ…
natr Normalized Average True Range āœ…
nvi Negative Volume Index āœ…
obv On Balance Volume āœ…
ppo Percentage Price Oscillator āœ…
psar Parabolic SAR āœ…
pvi Positive Volume Index āœ…
qstick Qstick āœ…
roc Rate of Change āœ…
rocr Rate of Change Ratio āœ…
rsi Relative Strength Index āœ…
sma Simple Moving Average āœ…
stddev Standard Deviation Over Period āœ…
stderr Standard Error Over Period āœ…
stoch Stochastic Oscillator āœ…
stochrsi Stochastic RSI āœ…
sum Sum Over Period āœ…
tema Triple Exponential Moving Average āœ…
tr True Range āœ…
trima Triangular Moving Average āœ…
trix Trix āœ…
tsf Time Series Forecast āœ…
typprice Typical Price āœ…
ultosc Ultimate Oscillator āœ…
var Variance Over Period āœ…
vhf Vertical Horizontal Filter āœ…
vidya Variable Index Dynamic Average āœ…
volatility Annualized Historical Volatility āœ…
vosc Volume Oscillator āœ…
vwma Volume Weighted Moving Average āœ…
wad Williams Accumulation/Distribution āœ…
wcprice Weighted Close Price āœ…
wilders Wilders Smoothing āœ…
willr Williams %R āœ…
wma Weighted Moving Average āœ…
zlema Zero-Lag Exponential Moving Average āœ…
abands āœ…
alma Arnaud Legoux Moving Average āœ…
ce Chandelier Exit āœ…
cmf Chaikin money flow āœ…
copp Coppock Curve āŒ
dc Donchian Channels āœ…šŸ”„
fi Force index āœ…
ikhts āŒ
kc Keltner Channels āœ…
kst Know Sure Thing āœ…
mama MESA Adaptive Moving Average āŒ
pbands āœ…
pc āŒ
pfe Polarized Fractal Efficiency āœ…
posc āœ…
rmi Relative Momentum Index āœ…
rmta Recursive Moving Trend Average āœ…
rvi Relative Vigor Index āœ…
smi Stochastic Momentum Index āœ…
tsi True Strength Index āœ…
vwap Volume-Weighted Average Price āœ…

Icon by

https://www.flaticon.com/free-icon/bar-graph_3501061
Author: Freepik
Website: https://www.freepik.com
https://www.flaticon.com/authors/freepik

Top categories

Loading Svelte Themes