Awesome Open Source
Awesome Open Source

Trading Signals

Language Details Code Coverage License Package Version Dependency Updates

Technical indicators and overlays to run technical analysis with JavaScript / TypeScript.


The "trading-signals" library provides a TypeScript implementation for common technical indicators with arbitrary-precision decimal arithmetic. This library puts more emphasis on the correctness of the calculation than on performance.


  • Accurate. Don't rely on type number and its precision limits. Use Big.
  • Typed. Source code is 100% TypeScript. No need to install external typings.
  • Tested. Code coverage is 100%. No surprises when using it.

Technical Indicator Types

  • Trend indicators: Measure the direction of a trend
  • Volume indicators: Measure the strength of a trend (based on volume)
  • Volatility indicators: Measure the strength of a trend (based on price)
  • Momentum indicators: Measure the speed of price movement

Supported Technical Indicators

  1. Acceleration Bands (ABANDS)
  2. Accelerator Oscillator (AC)
  3. Average Directional Index (ADX)
  4. Average True Range (ATR)
  5. Awesome Oscillator (AO)
  6. Bollinger Bands (BBANDS)
  7. Center of Gravity (CG)
  8. Double Exponential Moving Average (DEMA)
  9. Dual Moving Average (DMA)
  10. Exponential Moving Average (EMA)
  11. Momentum (MOM)
  12. Moving Average Convergence Divergence (MACD)
  13. Rate-of-Change (ROC)
  14. Relative Strength Index (RSI)
  15. Simple Moving Average (SMA)
  16. Smoothed Moving Average (SMMA)
  17. Stochastic Oscillator (STOCH)
  18. Wilder's Smoothed Moving Average (WSMA)


import {SMA} from 'trading-signals';

const sma = new SMA(3);

// You can add numbers:

// You can add strings:

// You can add arbitrary-precision decimals:
import Big from 'big.js';
sma.update(new Big(30));

// You can get the result in various formats:
console.log(sma.getResult().valueOf()); // "20"
console.log(sma.getResult().toFixed(2)); // "20.00"

When to use update(...)?

You have to call an indicator's update method to enter input data. The update method may or may not return a result from the indicator depending on whether the minimum amount of input data has been reached.

When to use getResult()?

You can call getResult() at any point in time, but it throws errors unless an indicator has received the minimum amount of data. If you call getResult(), before an indicator has received the required amount of input values, a NotEnoughDataError will be thrown.


import {SMA} from 'trading-signals';

// Our interval is 3, so we need 3 input values
const sma = new SMA(3);

// We supply 2 input values

try {
  // We will get an error, because the minimum amount of inputs is 3
} catch (error) {
  console.log(; // "NotEnoughDataError"

// We will supply the 3rd input value

// Now, we will receive a proper result
console.log(sma.getResult().valueOf()); // "40"

Most of the time, the minimum amount of data depends on the interval / time period used.


You can run yarn start:benchmark to see the runtime performance of each technical indicator on your machine. This will give you an understanding of which indicators can be calculated faster than others.


The information and publications of trading-signals do not constitute financial advice, investment advice, trading advice or any other form of advice. All results from trading-signals are intended for information purposes only.

It is very important to do your own analysis before making any investment based on your own personal circumstances. If you need financial advice or further advice in general, it is recommended that you identify a relevantly qualified individual in your jurisdiction who can advise you accordingly.



Benny Neugebauer on Stack Exchange


Contributions, issues and feature requests are welcome!

Feel free to check the issues page.


This project is MIT licensed.

Show your support

Please leave a star if you find this project useful.

If you like this project, you might also like these related projects:

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
Typescript (253,470
Hacktoberfest (35,366
Analysis (2,046
Trading (1,463
Indicator (318
Financial Analysis (238
Technical Analysis (227
Financial (220
Related Projects