Bots & Automation

Documenting a Trading Bot: Strategy Spec, Parameters and Change Log

What to write down for every trading bot so that you can still trust, debug and improve it a year later: the strategy specification, parameter sheet, test record, runbook and change log.

By AlgoXP3 min readUpdated

Three documents for a trading bot: README with the strategy, runbook and change log

Six months after a bot goes live, you will face questions that the code cannot answer. Why is the stop 1.7 × ATR and not 2? Which version produced last quarter’s results? Was the news filter tested? What should happen when the broker changes the symbol’s trading hours? A small amount of documentation answers them in minutes instead of days.

1. Strategy specification

One page describing the strategy in plain language:

  • Hypothesis - why it should work. (“Breakouts of the Asian range on gold tend to continue during the London session.”)
  • Market and timeframe.
  • Entry rules, exactly as implemented.
  • Exit rules - stop, target, time exit, trailing.
  • Risk - size per trade, maximum positions, account limits.
  • Filters - sessions, volatility, news.
  • What it is not designed for - market conditions where you expect it to struggle.

Write it before coding and update it whenever the logic changes.

2. Parameter sheet

A table of every input:

Parameter Value Tested range Stable region Notes
Range start (server time) 00:00 fixed - Broker uses UTC+2/+3
Range end 06:00 05:00-07:00 05:30-06:30
Stop (× range) 1.0 0.6-1.4 0.9-1.2
Target (× range) 1.5 1.0-2.5 1.3-1.8
Risk per trade 0.5% - - Live account limit 2%/day

The stable region column is the most valuable: it tells you later whether a small adjustment is safe. See parameter stability analysis.

3. Test record

For the version you trade:

  • data source, period and resolution;
  • costs used (spread, commission, swap);
  • in-sample and out-of-sample results;
  • walk-forward or Monte Carlo results;
  • forward test period and results;
  • number of variants tested before choosing this one.

This record is what you compare live results against.

4. Runbook

What to do when things happen, written while you are calm:

Situation Action
Daily loss limit hit Bot pauses automatically; review next day
Drawdown beyond Monte Carlo 95th percentile Pause, compare with backtest, decide
Order rejections Check symbol specs and volume steps; restart after fix
Broker changes trading hours Update session parameters, re-run backtest
Bot stopped unexpectedly Check log, positions and stops; restart with review

See when to stop a trading bot.

5. Change log

Every change, however small, with a version number:

v1.3 - 2026-11-20
- Changed: target 1.6 → 1.5 × range (centre of stable region after re-test)
- Fixed: duplicate order after restart (state now rebuilt from labels)

v1.2 - 2026-09-02
- Added: skip trading on days with range > 2 × ATR(14, D1)

Tie live results to versions. When performance changes, the first question is always “did we change something?”

6. Research log

Separate from the change log: every idea you tested, including failures, with the result and decision. It keeps your research honest and stops you from repeating experiments - see building a reliable backtesting workflow.

Where to keep it

  • In the same folder or repository as the bot’s code.
  • In plain text or Markdown, so it is easy to search and compare versions.
  • With a copy of the exact compiled bot for each live version.

Never put account passwords or tokens in documentation.

A minimal template

# Bot name - version
## Hypothesis
## Rules (entry, exit, risk, filters)
## Parameters (value, tested range, stable region)
## Tests (data, costs, IS/OOS, walk-forward, Monte Carlo, forward)
## Runbook
## Change log

Key takeaways

  • Document why the bot exists, not only what it does.
  • Record tested ranges and stable regions for every parameter.
  • Keep a runbook for predictable problems and a change log tied to live results.
  • One hour of documentation saves days of guesswork during the next drawdown.

FAQ

Isn't the code enough documentation?

Code tells you what the bot does, not why, which alternatives were tested, what results were expected, or what to do when it misbehaves. Those are exactly the questions you face during a drawdown.

How much documentation is enough?

For a personal bot, one page of strategy specification, a parameter table, a short test record and a change log. It takes an hour and saves days later.

Why record failed tests?

Because the number of variants you tried affects how much you should trust the winner. A record of failed ideas also stops you from testing them again.

Sources and further reading

  1. Bailey et al.: The Probability of Backtest Overfitting - papers.ssrn.com
  2. Keep a Changelog - keepachangelog.com