Skip to content
プロジェクト

概要

TypeScript製の高性能なテクニカル分析指標とバックテスト用フレームワークです。依存関係はゼロ。✨ 詳しくはこちら!👀

開発ツール

この数値の測り方

計測したスター増加

24時間
0
7日間
0
15日間
履歴を収集中
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

npm version License Build Status codecov CodeQL Analysis GitHub Stars

Indicator TS

Indicator TS is a TypeScript module providing pure technical analysis mathematics, statistical calculations, and generic backtesting utilities for browser and server environments.

This is a TypeScript implementation of the Indicator Go Golang module.

Maintenance status: This project is no longer actively developed, and new features are not planned. I will do my best to review issues and pull requests. It is provided as is under the MIT License.

⚠️ Legal Disclaimers & Risk Disclosures

1. Educational and Research Purpose Only

The software, algorithms, technical indicators, mathematical formulas, demonstrative strategy examples, and backtesting utilities provided in this project are strictly for educational, research, and informational purposes. Nothing contained in this codebase, documentation, or associated examples constitutes financial, investment, legal, tax, or trading advice, nor a solicitation, recommendation, endorsement, or offer to buy or sell any security, commodity, futures contract, option, cryptocurrency, or other financial instrument.

2. Non-Advisory and Non-Fiduciary Status

The authors, maintainers, and contributors of this library are NOT registered investment advisors (RIAs), commodity trading advisors (CTAs), broker-dealers, or certified financial analysts under the jurisdiction of the U.S. Securities and Exchange Commission (SEC), Commodity Futures Trading Commission (CFTC), Financial Industry Regulatory Authority (FINRA), or any other regulatory authority worldwide. No fiduciary, advisory, or professional relationship is created through your access, use, or implementation of this software.

3. Risk of Substantial Financial Loss and Leverage

Trading in financial markets—including stocks, options, futures, foreign exchange (Forex), and cryptocurrencies—involves substantial risk of loss and is not suitable for every investor. Market values fluctuate rapidly, and the use of leverage, margin, or derivative instruments can multiply losses, potentially resulting in the total loss of capital or liabilities exceeding the initial investment. You should independently assess your risk tolerance and financial situation before engaging in any trading activity.

4. CFTC Rule 4.41: Hypothetical Performance Disclosure

HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN INHERENT LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT ACTUALLY BEEN EXECUTED, THE RESULTS MAY HAVE UNDER- OR OVER-COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY, SPREADS, COMMISSIONS, OR MARKET SLIPPAGE. SIMULATED TRADING PROGRAMS IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFITS OR LOSSES SIMILAR TO THOSE SHOWN. PAST PERFORMANCE IS NO GUARANTEE OF FUTURE RESULTS.

5. "AS IS" Warranty & Limitation of Liability

THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, ACCURACY, AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS, OR COPYRIGHT HOLDERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, FINANCIAL LOSSES, TRADING LOSSES, LOSS OF PROFITS, DATA LOSS OR CORRUPTION, SYSTEM DOWNTIME, OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY ARISING IN ANY WAY OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


Indicators Provided

The following technical analysis indicators are supported by this package:

Trend Indicators

Momentum Indicators

Volatility Indicators

Volume Indicators

Valuation Functions

Strategy Primitives & Execution Abstractions

The core engine provides lightweight, generic abstractions for price bar series and trading signals:

Educational Strategy Examples

Pre-baked illustrative strategies are organized in the examples/ directory as pedagogical demonstrations showing how developers can consume indicator mathematics:

Note: The example strategies are not part of the indicatorts npm package, so import { macdStrategy } from 'indicatorts' does not work. Copy the example you need into your own project, and import the indicators it uses from indicatorts. For example:

import { Action, Asset, macd } from 'indicatorts';

export function macdStrategy(asset: Asset): Action[] {
  const { macdLine, signalLine } = macd(asset.closings);
  // ... see examples/trend/macdStrategy.ts
}

Backtest Framework

A lightweight, generic backtest utility is provided for evaluating custom strategy functions against historical data:

Chart

Chart provides utilities to plot indicator values and simulated strategies:

Build

The project can be built from source:

npm run build

Contributing

Bug reports and pull requests are welcome. Please see CONTRIBUTING.md for the development setup, coding standards and the reference data testing approach.

Usage

Install the package:

npm install indicatorts

Import and calculate technical indicators:

import { ao } from 'indicatorts';

const highs = [10, 20, 30, 40];
const lows = [1, 2, 3, 4];

// Calculate Awesome Oscillator (AO)
const result = ao(highs, lows);

Warm-up and seeding

Indicators that smooth values recursively need a starting value. This library returns an output for every input index, so it starts at the first bar, while TA-Lib and several other libraries start from a simple average of the first period values and leave the earlier outputs empty. The formulas are otherwise the same, so the outputs converge, but the first values differ.

Building block This library TA-Lib
EMA Starts from the first value: ema[0] = values[0] Starts from the SMA of the first period values, at index period - 1
RMA (Wilder) Average of the values so far until period values are available Same
RSI Counts the first bar as a gain and loss of 0 Starts from the second bar (the first price change)
ATR Includes the first bar's true range (high minus low) Starts from the second bar

The difference fades over time. For a 12-period EMA on the test data, it is 0.21 at the 12th bar, 0.03 at the 24th, and below 0.004 after the 36th. Indicators built on these blocks inherit the difference: DEMA, TEMA, TRIX, MACD, APO, PPO, PVO, Chaikin Oscillator, Mass Index, Bollinger Bands Width, Keltner Channel, Chandelier Exit, Projection Oscillator and Force Index. Both conventions are supported. The building blocks and the indicators that TA-Lib also provides take a seed option: 'first' (the default) is the behavior described above, and 'sma' starts from a simple moving average and leaves the warm-up results NaN, as TA-Lib does. With seed: 'sma', these match TA-Lib's output, which the tests check against reference data generated with TA-Lib:

Indicator TA-Lib function
ema, dema, tema EMA, DEMA, TEMA
trix TRIX (TA-Lib returns a percentage, this library a ratio)
macd, apo, ppo, pvo MACD, APO, PPO (with an EMA)
rsi, atr RSI, ATR
rma Wilder smoothing, as used by RSI and ATR
import { macd, rsi } from 'indicatorts';

const { macdLine, signalLine } = macd(closings, { seed: 'sma' });
const result = rsi(closings, { period: 14, seed: 'sma' });

The other indicators built on these blocks use the default. To compare them with other libraries, skip the first few multiples of period values.

Indicators without recursive smoothing, such as SMA, Bollinger Bands, Stochastic Oscillator, Williams %R, CCI and MFI, match TA-Lib from the first full window.

The indicators ported from the Go version of this library, such as WMA, HMA, T3 and KST, follow its conventions instead: their exponential and Wilder averages start from a simple moving average, and the results that are not available yet are NaN. Each one documents its warm-up period, and the tests check them against reference data generated with the Go library.

License

The source code is provided under the MIT License.

Copyright © 2022-2026 The Indicator Authors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Trademarks

  • Bollinger Bands® is a registered trademark of John Bollinger.
  • All other product names, logos, and brands mentioned herein are trademarks or registered trademarks of their respective owners. Mention of third-party products, services, or trademarks is for nominative identification and educational purposes only and does not imply affiliation or endorsement.

関連プロジェクトを探す

読み込み中…