How to backtest a trading strategy without coding
A backtest replays a rule over past prices. Here are the six steps to run one without writing code, and the checks that separate a real edge from a lucky stretch.
What a backtest is
A backtest takes a rule you can state exactly, applies it to past candles one at a time, and records what would have happened: every entry, every exit, the fees. It answers one question only. Would this rule have made money on this market in this period?
It cannot tell you what will happen next. What it can do is stop you risking money on an idea that never worked even in the past.
Step 1 to 3: the rule, the market, the history
Write the rule so that two people would place the same trades from it. "Buy when it looks strong" cannot be tested; "buy when the close is above the highest high of the last 20 candles" can.
Choose the market and timeframe you would actually trade. Then use as much history as you can, covering rising, falling and sideways periods. A rule tested only on a bull run has only learned to buy.
Step 4: exits and costs
Every trade needs a stop and a way out with a profit, defined in advance. Then add the costs: fees on both sides and slippage, the difference between the price you wanted and the price you got.
Costs look small on one trade and decide the outcome over hundreds. A strategy that trades often on a short timeframe can be profitable before fees and clearly losing after them.
Step 5: read the result properly
Look at the number of trades first. Under thirty, the result is mostly chance. Then compare the final figure with simply holding the market over the same period: a strategy that made 20% while the market made 60% did not add anything.
Look at the worst fall from a peak and the longest run of losses, and ask honestly whether you would have kept following the rule through them.
Step 6: try to break it
Now attack your own result. Double the fees. Skip one trade in five at random, because nobody takes every signal. Start the test on a different day. Run the same rule on twenty other markets. Compare it with random entries using the same exits.
If the edge survives all of that, it is worth testing on fresh data it has never seen. If it only survives the exact settings you found, you have fitted the past.
To take away
- State the rule exactly, include stops and costs, and use history that covers different kinds of market.
- Judge by trade count, by comparison with holding and by the worst fall, not by the total alone.
- Try to break the result before you trust it: higher fees, missed trades, other markets, random entries.
Try it
Lessons on this topic
Related posts
Fees left out, a higher timeframe that peeks into the future, and too few trades: three mistakes behind most beautiful backtests, with the arithmetic to catch each one.
23 November 2026Testing ideas · 4 minCompare every backtest with simply holdingA backtest that made 18% sounds good until you learn the market rose 30% over the same months. The comparison with holding is the first check, not the last.
21 November 2026Testing ideas · 5 minEight matches is not evidenceA scan matched 8 times and price rose after 6 of them. That feels like 75%. Here is why it says almost nothing, and what to compare it with before believing it.
20 November 2026Education only. Nothing here is financial advice or a recommendation to buy or sell anything; examples are arithmetic, not results. Trading involves a high risk of losing money.