How to develop a trading strategy: 6 steps from hypothesis to test
Develop a trading strategy in a fixed order: write a hypothesis, turn it into rules a computer can run, collect enough completed trades, backtest with costs, check it on unseen data and judge it against limits you wrote down before looking. An idea that fails goes back to step one, not to a tweak.
By Soren Huang · Published · updated · Editorial policy
Contents
- How do you develop a trading strategy that can be tested objectively?
- How do you turn a market idea into exact rules?
- How much data is needed to develop a strategy?
- How do you backtest with realistic costs?
- How do you validate out of sample and avoid overfitting?
- How do you tell if a strategy is usable?
- Frequently asked questions
- References
How do you develop a trading strategy that can be tested objectively?
How to develop a trading strategy that can be tested: follow six steps in a fixed order. Write a hypothesis, turn it into exact rules, collect enough completed trades, backtest with realistic costs, check the frozen rules on data the search never saw, then judge pass or fail against limits you wrote before looking.
A hypothesis is one sentence that says what the market does and why, for example "after a strong close, the next day more often continues than reverses". The order matters because each step protects the next one. Skipping ahead is how most traders end up with a result they cannot trust. The background on what algo trading is and why most rules lose is in algo trading explained: what it is and what it costs; the wider research routine, from data to live trading, is in how to build a quantitative trading process step by step.
How do you turn a market idea into exact rules?
A rule is testable only when a computer can act on it without a human choice, so every entry, exit and setting becomes a number or a condition that is true or false on each bar. "Buy strength" is an idea. "Buy at the next open when the close is above the close 20 bars ago" is a rule, and it uses the momentum indicator in its simplest form. Write the exit the same way, and write the one you take when the idea is wrong, not only the one you take when it works.
- Write the entry as a comparison between two numbers the bar data gives you.
- Write the exit as a comparison too, and decide whether it fires on the same bar or the next one.
- Give every setting a range you would accept, not one value. A lookback of 15 to 30 bars is a hypothesis; exactly 23 bars is a coincidence waiting to happen.
How much data is needed to develop a strategy?
Enough data is measured in completed trades across more than one kind of market, not in calendar years. Six years of daily bars hold about 30 trades for a rule that trades every few months and several hundred for a rule that trades several times a week. The first sample is a hint; the second can be judged. The reason is simple: an average built from 30 trades moves a long way when two or three of them change, and you need four times as many trades to make that average twice as steady.
Check the years as well as the count. If every trade came from one long uptrend, a rule that is simply long most of the time will pass for the wrong reason. Look for a trending stretch, a sideways stretch and a sharp sell-off inside the history before you trust anything.
How do you backtest with realistic costs?
Commission, slippage and next-bar execution go into the very first run, because a rule that trades often looks best before costs and worst after them. Slippage is the gap between the price the backtest assumed and the price you would actually have received. Next-bar execution means a decision made on the close of one bar is filled on the next bar, since you cannot trade a price that has already printed. The number to watch is the average trade after costs, compared with the round-trip cost of one entry and one exit; the free win rate and expectancy calculator gives that figure from win rate, average win and average loss.
Hypothetical example
A rule shows a gross average trade of $14. Commission is $4 per round trip and slippage one tick each side is $6, so the round-trip cost is $10 and the net average trade is $4. Double the slippage and the net average trade becomes −$2. This rule depends on cheap fills, so it goes back to the hypothesis step.
How do you validate out of sample and avoid overfitting?
The best result among many tried candidates is inflated by selection, so the rule is frozen, run on data the search never saw, and judged against a drop limit written in advance. Overfitting is tuning a rule so closely to one stretch of history that it describes the noise of that stretch instead of a repeatable pattern. Bailey, Borwein, López de Prado and Zhu (2014) show that the more variants you try, the more the winner's backtest overstates what follows. How to split the history and how much out-of-sample is enough is covered in in-sample vs out-of-sample: how to split the data.
The box below shows what selection looks like in practice. The run by AlphaPrime (Valynox) tested NQ daily bars from 2019-01-02 to 2025-06-30, long and short, one contract, with commission and slippage charged on every trade. It uses a Momentum rule as its only entry and exit, a stand-in for whatever idea you test, not the subject of this article. The result is the one candidate the search kept out of roughly a thousand it tried, chosen for its return against its drawdown. Picking the kept one after the fact flatters it: this is what the best of many looks like, not what the rule earned or what a reader can expect.
Source: AlphaPrime product engine (CPU), run 2026-10-31. NQ daily bars, 2019-01-02 to 2025-06-30, long and short, 1 contract, $20 commission and $10 slippage per trade.
| Number | Result |
|---|---|
| Net profit (closed trades) | $249,575 |
| Max drawdown | $93,215 |
| Trades | 60 |
| Win rate | 60% |
| Profit factor | 1.828 |
| Average trade | $4,159.58 |
| Time in market | 92.48% |
Two lines in the box are the ones step three and step five care about. Sixty trades is a thin sample, so the average trade could move far if a few trades changed. And 92.48% time in market on an index future over a period that was mostly rising means part of the result is the market, not the rule. Only the stretch after the out-of-sample boundary in the figure can tell how much.

How do you tell if a strategy is usable?
A strategy is usable when its after-cost average trade, its drawdown relative to the account and its out-of-sample behaviour each clear a limit you wrote down before the test, and it is not usable when any one of them fails. Harvey and Liu (2015) make the same point from the research side: a result has to be discounted for the number of tests behind it, which is easiest when the limits exist before the tests. In the AlphaPrime run above, the drawdown is more than a third of the net profit, which a trader with a small account would have written down as a fail before seeing the curve. That kind of pre-written limit is what strategy validation in AlphaPrime holds: the thresholds are typed in before the search runs, and a candidate that fails an early check never reaches the later ones.
| Check | Usable | Not usable |
|---|---|---|
| Average trade after costs vs round-trip cost | Several times the cost | Near or below the cost |
| Max drawdown vs account size | Well under the cushion you can hold | Close to the account size |
| Out-of-sample share of in-sample average trade | Above your written drop limit | Sign flips |
| Trades counted | Hundreds | Under about 30 |
| Profit spread over quarters | Most quarters positive | One quarter made the result |
The checks that follow once a strategy has cleared this table, including how it behaves across different market conditions, are in five checks before you trust an algo strategy that works consistently. If you are choosing software to run this process, the settings that matter, such as cost inputs and out-of-sample support, are listed in the algo trading software features that actually matter. Your next step: take one idea you already trade by feel, write its hypothesis and its five limits on one page, and only then open the backtester.
Frequently asked questions
How do you develop a trading strategy from scratch?
Start with one written sentence about what the market does and why. Turn it into entry and exit conditions a computer can check on every bar, collect enough completed trades across different market conditions, and backtest with commission, slippage and next-bar execution from the first run. Then freeze the rules, test them on data the search never saw, and compare the result with limits you wrote down before looking.
How much data is needed to develop a trading strategy?
Count completed trades, not years. Fewer than about 30 trades is a hint; a few hundred trades across a trending, a sideways and a falling stretch is a sample you can judge. A rule that trades rarely needs more years, or a walk-forward design that produces more out-of-sample trades from the same history.
How do you avoid overfitting a trading strategy?
Test settings as ranges rather than single values, keep the number of tuned settings small relative to the trade count, and never change a rule after seeing its out-of-sample result. The best candidate from a large search is always inflated by selection, so judge it against a drop limit written before the test, and reserve a final block of data that is tested exactly once.
How do you tell if a trading strategy is usable?
It clears every limit you wrote in advance: an after-cost average trade several times the round-trip cost, a maximum drawdown well inside the account you can hold, an out-of-sample result above your drop limit, hundreds of trades and profit spread across most quarters. One failed row means the idea goes back to the hypothesis step.
References
- Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471.
- Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2017). The Probability of Backtest Overfitting. Journal of Computational Finance, 20(4), 39–69.
- Harvey, C. R., & Liu, Y. (2015). Backtesting. The Journal of Portfolio Management, 42(1), 13–28.

