Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/theonetrade/backtest-kit/llms.txt

Use this file to discover all available pages before exploring further.

The @backtest-kit/signals package is a technical analysis and signal generation library built specifically for AI-powered trading systems. It computes more than 50 indicators across four timeframes and formats the results as Markdown reports that slot directly into LLM context messages. Instead of manually calculating RSI, MACD, Fibonacci levels, and order book depth before each getSignal call, a single function invocation adds a comprehensive market snapshot to your message array — ready for the LLM to reason over.

Key Features

Multi-Timeframe Analysis

Compute all indicators across 1m, 15m, 30m, and 1h candles simultaneously. Timeframes are synchronized automatically using backtest-kit’s temporal context.

50+ Technical Indicators

RSI, MACD, Bollinger Bands, Stochastic, ADX, ATR, CCI, Fibonacci retracements, and dynamic Support/Resistance levels — all computed in a single call.

Order Book Analysis

Bid/ask depth, spread, liquidity imbalance, and top 20 price levels are included in the report alongside the candlestick indicators.

AI-Ready Output

Output is Markdown formatted for LLM context injection. Paste directly into a system or user message and the model has full market awareness.

Performance Optimized

Intelligent caching with configurable TTL per timeframe. Repeated calls within the same candle interval return the cached report with no recomputation.
@backtest-kit/signals works seamlessly with backtest-kit’s AsyncLocalStorage temporal context. All candle fetches use the current backtest timestamp automatically — look-ahead bias is structurally impossible.

Getting Started

1

Install the package

npm install @backtest-kit/signals backtest-kit
2

Import and call in getSignal

import { signals } from '@backtest-kit/signals';
import { addStrategySchema } from 'backtest-kit';

addStrategySchema({
  strategyName: 'llm-signals-strategy',
  interval: '5m',
  riskName: 'demo',
  getSignal: async (symbol) => {
    // Start with your base system prompt
    const messages: Array<{ role: string; content: string }> = [
      {
        role: 'system',
        content: 'You are a crypto trading assistant. Analyze the market data and return a trading signal.',
      },
    ];

    // signals() appends a detailed Markdown technical analysis report
    // to the messages array — one call covers all timeframes and indicators
    await signals(symbol, messages);

    // Pass the enriched messages array to your LLM
    const signal = await yourLLMCall(messages);

    return signal;
  },
});

Included Indicators

The Markdown report covers the following indicators across all four timeframes:
CategoryIndicators
MomentumRSI (14), Stochastic %K/%D, CCI (20), MACD line/signal/histogram
TrendADX, +DI, -DI, EMA (9, 21, 50, 200), SMA (20, 50)
VolatilityBollinger Bands (upper/middle/lower), ATR (14), Band Width
StructureFibonacci retracement levels (0.236, 0.382, 0.5, 0.618, 0.786)
LevelsDynamic support and resistance zones derived from recent swing highs/lows
Order BookBid/ask spread, depth imbalance, top 20 bid and ask price levels

Why Markdown Output?

LLMs perform better when market context is structured as readable prose and tables rather than raw JSON arrays. @backtest-kit/signals formats every indicator value with its label, current reading, and a brief interpretation (e.g., “RSI 67.4 — approaching overbought”) so the model can reason about relative strength, confluence, and divergence without needing numeric post-processing.
Inject the signals report as a user message rather than appending to the system prompt. This keeps the system prompt stable across calls and makes the market data clearly distinct from the model’s operating instructions, which improves structured output reliability.

Build docs developers (and LLMs) love