Skip to content

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

License

Notifications You must be signed in to change notification settings

ixjb94/indicators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CodeFactor npm version npm size npm downloads last commit

logo

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
Tests

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/indicators@1.2.3/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

types browser

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published