Docs menu

Strategies & backtests

Write, change and test strategies on past prices. Nothing here trades.

Updated

list_strategies

Your strategies and the ready-made templates, with the market, timeframe and last test of each.

  • Reads only

Inputs

Takes no inputs.

What the AI app reads

List the user's strategies and the ready-made templates (id, name, market, timeframe, last test).

get_strategy

One strategy’s full rules: entry, exit, position sizing and risk management.

  • Reads only

Inputs

  • strategyIdtext (not empty, up to 100 characters)Required

    From list_strategies.

What the AI app reads

A strategy's full rules: entry, exit, position sizing and risk management.

create_strategy

Saves a new strategy from rules the AI app writes with you.

  • Makes changes

Inputs

  • nametext (not empty, up to 120 characters)Required
  • descriptiontext (up to 2,000 characters)
  • symboltext (2–40 characters)

    A market as the exchange names it, like BTC-PERP, HYPE-SPOT or xyz:AAPL-PERP. Default BTC-PERP.

  • timeframetext (a number then m, h, d or w, like 15m or 4h)

    Default 1h.

  • directionone of long, short, both

    Default long.

  • configobject, any keysRequired
What the AI app reads

Save a new strategy. config = { entry: {combinator: "and"|"or", rules: [{id, field, operator, value}]}, exit: {same}, indicators: {RSI_14: {function: "rsi", params: {length: 14}}, …}, positionSizing: {method: "percentEquity", riskPercent: 1, maxPositionPercent: 100}, riskManagement: {stopLoss: {type: "percent", percent: 2}, takeProfit: {type: "percent", percent: 4}, trailingStop: {enabled: false}, maxDrawdown: null} }. Example entry rule: {id: "r1", field: "RSI_14", operator: "crossesAbove", value: 30}. Copy the shape of an existing strategy (get_strategy) when unsure, and run edge_check_rules on the config before saving — it names anything missing (no stop, no size, an indicator used but not set up).

update_strategy

Changes a saved strategy: its name, rules, market, timeframe or direction.

  • Makes changes

Inputs

  • strategyIdtext (not empty, up to 100 characters)Required

    From list_strategies.

  • nametext (not empty, up to 120 characters)
  • symboltext (2–40 characters)

    A market as the exchange names it, like BTC-PERP, HYPE-SPOT or xyz:AAPL-PERP.

  • timeframetext (a number then m, h, d or w, like 15m or 4h)
  • directionone of long, short, both
  • configobject, any keys
What the AI app reads

Change a saved strategy (name, rules, market, timeframe, direction). config = { entry: {combinator: "and"|"or", rules: [{id, field, operator, value}]}, exit: {same}, indicators: {RSI_14: {function: "rsi", params: {length: 14}}, …}, positionSizing: {method: "percentEquity", riskPercent: 1, maxPositionPercent: 100}, riskManagement: {stopLoss: {type: "percent", percent: 2}, takeProfit: {type: "percent", percent: 4}, trailingStop: {enabled: false}, maxDrawdown: null} }. Example entry rule: {id: "r1", field: "RSI_14", operator: "crossesAbove", value: 30}. Copy the shape of an existing strategy (get_strategy) when unsure, and run edge_check_rules on the config before saving — it names anything missing (no stop, no size, an indicator used but not set up).

run_backtest

Tests a strategy on past prices between two dates; returns the results and the last few trades.

  • Saves the test with the strategy

Inputs

  • strategyIdtext (not empty, up to 100 characters)Required

    From list_strategies.

  • startDatedate (YYYY-MM-DD)Required

    ISO date, e.g. 2026-01-01.

  • endDatedate (YYYY-MM-DD)Required

    ISO date, e.g. 2026-06-01.

  • initialCapitalnumber (above 0, up to 1,000,000,000)

    Default 10000.

  • leveragenumber (above 0, up to 50)
  • tradesShownwhole number (0 to 50)

    Default 10.

What the AI app reads

Test a strategy on past prices between two dates (ISO, e.g. 2026-01-01). Returns the results (return, drawdown, win rate, profit factor, …), the trade count and the last few trades. A long range can take a minute.

list_backtests

A strategy’s past backtests, newest first.

  • Reads only

Inputs

  • strategyIdtext (not empty, up to 100 characters)Required

    From list_strategies.

  • limitwhole number (1 to 50)

    Default 10.

What the AI app reads

A strategy's past backtests, newest first (id, market, dates, results). Use an id with get_backtest or the edge tools.

get_backtest

One saved backtest’s results and its last few trades.

  • Reads only

Inputs

  • backtestIdtext (not empty, up to 100 characters)Required

    From list_backtests or run_backtest.

  • tradesShownwhole number (0 to 50)

    Default 10.

What the AI app reads

One saved backtest: its results, trade count and the last few trades.

↑↓ to move↵ to openEsc to closeAll help