Skip to content

Latest commit

 

History

History

examples

Folders and files

README.md

Educational Strategy Examples

This directory contains illustrative strategy implementations demonstrating how developers can consume core indicator mathematics, combine signals, and evaluate strategies using the generic backtesting framework.

Disclaimer: All strategies provided in this directory are strictly educational, illustrative demonstrations. They are not intended for live trading, and do not constitute financial, investment, or trading advice. Past or hypothetical performance is no guarantee of future results.

Overview

The examples demonstrate how to construct functions adhering to the StrategyFunction type signature:

type StrategyFunction = (asset: Asset) => Action[];

Each strategy maps historical price bar data (Asset) into generic signal actions (Action.BUY, Action.SELL, Action.HOLD).

Strategy Categories

Usage Example

import { backtest } from 'indicatorts';
import { STRATEGY_INFOS } from './strategyInfo';

const asset = {
  dates: [new Date(2023, 0, 1), new Date(2023, 0, 2)],
  openings: [100, 102],
  closings: [101, 105],
  highs: [103, 106],
  lows: [99, 101],
  volumes: [1000, 1500],
};

const results = backtest(asset, STRATEGY_INFOS);
console.log(results);

License

Copyright (c) 2022-2026 The Indicator Authors. All rights reserved.

The source code is provided under MIT License.