What backtesting actually is
A backtest replays a trading rule against historical market data and records what would have happened. You define the rule - say, "buy bitcoin whenever it drops 3% in a day, sell when it's up 3% from the buy" - and the backtest walks through years of past prices, placing those trades exactly as the rule says, and tallies the result.
The output is concrete: every trade it would have taken, the running account balance, and summary numbers like total return. It turns a vague hunch ("buying dips feels smart") into something you can actually inspect.
Why it matters
A plausible trading idea can perform poorly once its rules and costs are made explicit. Backtesting lets you examine that behavior on historical data before committing capital to a live strategy.
It also forces precision. To backtest a rule you have to state it exactly: which asset, what counts as a "dip," when exactly you sell. That act of pinning the idea down often exposes that you didn't really have a rule, just a feeling.
How a backtest is built
Under the hood every backtest does the same four things:
- Load historical price data (for example, daily Bitcoin candles from an exchange).
- Step through it one period at a time, so the rule only ever sees data it would have had in the moment - never the future.
- Apply the entry and exit rules, recording each simulated trade.
- Total up the results: final balance, return, number of trades, and so on.
Where backtests mislead
A backtest is only as honest as its assumptions. The classic ways one flatters a bad idea:
- Lookahead bias: the rule accidentally uses information it couldn't have known yet (like today's closing price to decide a trade earlier in the day).
- Overfitting: you tweak the rule until it fits the past perfectly - and it then fails on anything new, because you fit noise, not signal.
- Ignoring costs: real trading has fees and slippage; a backtest that skips them overstates returns.
- Survivorship and a kind market: a rule tested only on a bull run can look brilliant and fall apart the moment conditions change.
From idea to backtest, faster
Building a backtest can involve sourcing data, writing the trading logic, and accounting for costs and execution timing. Tools can handle parts of that work while leaving the assumptions available for review.
In Premiss, you describe the idea and review the generated Python, historical trades, and performance metrics. Check that the implementation matches your intended rule before using the result to compare strategies.