VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Strategy generation

Quantitative trading: build your own process step by step

A quantitative trading process is a fixed sequence of stages with written rules and pass thresholds set before testing. Record every test you run, and let a strategy move on only when it passes each stage.

By · Published · updated · Editorial policy

Contents
  1. What are the stages of a quantitative trading process?
  2. What rules should you fix before the first test?
  3. Which data choices do you fix first?
  4. Which costs and fill rule do you set?
  5. Which sessions does the strategy trade?
  6. How do you turn an idea into a testable strategy?
  7. Why must you record every test, even the failures?
  8. How do you choose validation thresholds in advance?
  9. What should paper trading prove before you go live?
  10. What limits should you plan for?
  11. Frequently asked questions
  12. References

What are the stages of a quantitative trading process?

To build your own quantitative trading process, move every idea through the same seven stages: idea, data, strategy search, backtest, validation, paper trading and live trading. Write your rules for data, costs, sessions and pass thresholds before you test. Record every test you run. Only strategies that pass a stage move to the next one.

Quantitative trading is trading where entries, exits and position size come from written rules that a computer can test on historical data. A process works like a pilot's checklist. The pilot follows the same steps in the same order on every flight, so a tired day or a good mood does not change what gets checked. Many traders who want to build their own algorithmic trading system start with a strategy. A process comes first, because it decides which strategies you can trust.

Each stage ends with a gate. A gate is a written condition that a strategy must meet before it moves on.

StageWhat you doGate: what must be written down before moving on
1. IdeaState a market behaviour you think repeats, and why.A one-sentence hypothesis with a market, a timeframe and a reason.
2. DataChoose and clean the historical bars.Data source, roll method, time zone, session and cleaning rules.
3. Strategy searchTry rule and parameter combinations inside limits you set.Search limits and the number of variants tested.
4. BacktestRun the candidates with costs and realistic execution.Cost settings, execution rule and the full result list.
5. ValidationTest survivors on data and conditions they were not built on.Pass or fail against thresholds fixed in advance.
6. Paper tradingRun the strategy forward without real money.Signal and fill comparison against the backtest.
7. LiveTrade at the smallest size first.Size, review dates and a retirement rule.
Seven numbered stages from idea to live trading in one row, separated by six gold gates; an arrow from every gate leads down to one research log that keeps both passes and fails Seven stages, seven gates Each gold bar is a written gate Idea Live 123 456 7 Research log passes and fails Each stage ends in a written gate. So: log every result, even fails.
Seven stages, each ending in a written gate. Every result is written to the research log, including the strategies that fail.

What rules should you fix before the first test?

Fix your data, cost and session rules before the first backtest, because any rule you choose after seeing results becomes a hidden parameter. If you switch from day-session bars to full-session bars because the result looked better, you have optimized the session. Your log will not show it.

Which data choices do you fix first?

Decide where the bars come from, which bar size you use and how you join futures contracts into one continuous series. Also decide which time zone the timestamps use and what you do with gaps and bad ticks. Write these choices as a short list and keep the same data version for the whole research round. The guide to backtest data quality: gaps, bad ticks, time zones and rolls covers each check in detail.

Which costs and fill rule do you set?

Slippage is the shortfall between the assumed fill price and the price the market actually gives you. Set commission, exchange fees and slippage per round trip before you test, in the same units as your results. For liquid futures traded with market or stop orders, a common starting point is at least one tick of slippage per side. Also decide that a signal at a bar's close fills on the next bar, not on the same close. The article on trading costs in backtests and the average trade shows how to compare costs with the edge per trade. In AlphaPrime (Valynox), these cost settings go into backtesting before the first run and signals always fill on the next bar, so a per-side slippage such as one tick applies to every test in the round.

Which sessions does the strategy trade?

Decide whether the strategy trades the day session only or the full session including the night session. Decide also how holidays and early closes are handled. Check the hours for your market with the free futures market hours tool, which shows each exchange's sessions in your time zone. Exchanges can change trading hours, tick values and fees, and the exchange's own contract page is the final word, so confirm current values there before each research round.

How do you turn an idea into a testable strategy?

An idea becomes testable when you can write it as a hypothesis with a market, a timeframe, a reason and clear entry and exit conditions. "Index futures trend" cannot be tested. "On an index future, a breakout of the first hour's range in the direction of the prior day's close tends to continue until the session ends" can be tested. It names the market, the time window, the trigger and the exit.

Strategy search is the step where software tries many combinations of rules and parameter ranges inside limits you set. Software can test far more combinations than you could by hand, but you still decide where it searches. Set the limits before the search starts:

  1. Which rule types and indicators may be combined.
  2. The parameter range for each rule, for example a lookback between 10 and 50 bars.
  3. How many conditions one strategy may use. Fewer conditions leave less room to fit noise.
  4. A minimum number of trades, so that one lucky trade cannot carry a result.

In AlphaPrime, strategy generation turns research ideas into testable trading rules. You set the rules and indicators, parameter ranges, entry and exit conditions and search constraints. The wider the search, the more important the next stage becomes.

Why must you record every test, even the failures?

Record every test, including the failures, because the number of variants you tried changes how much the best result means. Think of 200 people who each flip a coin ten times. One of them will probably get eight or nine heads. That person is not a skilled coin flipper. They are simply the best of 200 tries. Strategy search works the same way: the best backtest out of many is partly the best luck out of many.

Research on data snooping makes this precise. White (2000) proposed a test that asks whether the best rule from a search still beats a benchmark once the whole search is taken into account. Bailey and López de Prado (2014) showed how to deflate a Sharpe ratio for the number of trials. A Sharpe ratio is the average return divided by how much returns vary. Both methods need one input that most traders never write down: how many variants were tested.

For each test, log the date, the hypothesis, the market and data version, the cost and session settings, the number of variants, the result, and your decision with its reason.

Hypothetical example

Over three months you test 12 ideas and about 50,000 variants in total. The best one shows a Sharpe ratio of 1.8 in its backtest. Without a log, you remember one strategy with a Sharpe ratio of 1.8. With a log, you know it is the best of about 50,000 variants. That number is the one the deflated Sharpe ratio needs.

Hypothetical example: without a log you remember one winner with a Sharpe ratio of 1.8; with a log you see it is the single best of about fifty thousand variants tested Best of fifty thousand Hypothetical three-month search Without a log One winner, Sharpe 1.8 With a log Fifty thousand variants best Your winner is one of thousands. So: log the count with the result.
Hypothetical example: the strategy you keep is the survivor of a large search. The log keeps that count visible.

AlphaPrime's strategy databank keeps the strategies that passed your filters for review, with search and sort, batch actions and revalidation. Rejected candidates are not stored, so keep your log of failed tests separately.

How do you choose validation thresholds in advance?

Write your pass and fail thresholds before you run validation, so the result decides the strategy instead of the strategy deciding the threshold. Validation is the stage where a strategy is tested on data and conditions it was not built on. In-sample data is history that the search and the parameter choice used. Out-of-sample data is history that the search and the parameter choice never used.

Decide each of these checks and its limit before you look at any validation result:

CheckQuestion it answersWhat you decide in advance
Number of tradesIs the result based on enough trades?A minimum trade count.
Average trade after costsDoes the edge survive fees and slippage?A minimum ratio of gross average trade to round-trip cost.
Cost stress testDoes it survive worse fills?The slippage multiple to test, and that it must stay positive.
Maximum drawdownCould you sit through the worst loss?A drawdown limit in money, tied to your account.
Out-of-sample resultDoes it hold on unseen data?How much of the in-sample performance must remain.
Walk-forward consistencyDoes the tuning method work forward in time?The share of windows that must be positive.
Neighbouring parametersIs it a broad region or a lucky spike?How far settings may move before results collapse.

Hypothetical example

One trader writes: at least 200 trades; gross average trade at least three times the round-trip cost; still positive with double slippage; maximum drawdown under 20% of the account; out-of-sample keeps at least half of the in-sample result per year; at least 6 of 10 walk-forward windows positive. These values are one trader's choices, not recommended settings.

Walk-forward analysis is a test that repeatedly tunes a strategy on one period and then trades it on the next, unseen period. The article on walk-forward analysis and why one backtest is not enough explains how to choose the windows. Bailey and colleagues (2017) describe how to estimate the probability that a strategy chosen as best in-sample will do worse than the median out of sample. That is the risk your thresholds are meant to catch.

One timeline of price history: a long in-sample block where the strategy is tuned, then a shorter out-of-sample block where it is judged; below, three walk-forward rows each shift forward by one out-of-sample length, and only their out-of-sample blocks are filled as the validation result Judge only on unseen data One split, then walk-forward Tuned here Judged here Only the unseen periods count. So: judge only out-of-sample results.
In-sample, out-of-sample and walk-forward windows on one timeline: the strategy is tuned on one period and judged only on the unseen period that follows.

If a strategy fails and you want to loosen a threshold, write the new threshold down and log the change. Then treat every strategy tested under it as part of a new round.

What should paper trading prove before you go live?

Paper trading should prove that the strategy runs as tested, not that it earns money in a few weeks. Paper trading is running a strategy forward on live prices in a simulated account, without real money. A few weeks of paper results say almost nothing about the edge. They say a lot about mechanics.

  1. Signals match. On the same bars, the live strategy gives the same entries and exits as the backtest.
  2. Fills are within your cost assumption. Compare each simulated or real fill with the signal price. If slippage is larger than your setting, rerun the backtest with the measured value.
  3. Sessions and holidays behave. The strategy does not trade outside the sessions you tested, and it handles reopenings after holidays.
  4. Orders work. Stop, limit and market orders are placed and cancelled the way the backtest assumed.

When you go live, start at the smallest size the market offers, such as a micro contract where the exchange lists one. Before the first trade, write two things down: the dates when you will review results, and a retirement rule. One example of a retirement rule is a live drawdown larger than a set multiple of the backtest's worst drawdown. Live results go back into the log like every other test.

What limits should you plan for?

Plan around three limits: your time, your capital, and the fact that no test makes future results certain.

  • Time. One idea can take weeks to move from hypothesis to paper trading, and most ideas stop at a gate. Plan research in rounds with a fixed end date. Computing time also depends on your processor or graphics card, the data length and how wide the search is.
  • Capital. Margin and drawdown decide how many contracts you can hold, and whether a strategy fits your account at all. Size positions from the worst drawdown you are willing to live through, not from the backtest's return.
  • Certainty. A backtest describes how rules behaved on past data. It is not a forecast. Passing every gate lowers the chance that you are trading noise, but it does not make any result certain.

What this means if you use AlphaPrime: you can set the search constraints, costs, sessions and validation thresholds before a run. The candidates that pass your filters then stay in one place for review. Keep your written gates and your log of failed tests alongside them.

Frequently asked questions

How do I start quant trading as an individual?

Start with one market and one timeframe you understand, and write your data, cost and session rules before testing anything. Then move one idea at a time through the stages of idea, data, search, backtest, validation, paper trading and live. Keep a log of every test from the first day.

Do I need to code to build my own algorithmic trading system?

You need precise rules, but you do not always need to write code. Strategy generation software can turn rules and parameter ranges into testable strategies, and AlphaPrime exports their source code to the platforms listed on the platform export page. Knowing how to read the exported code still helps you check that the live strategy matches the backtest.

How many strategies should I test before picking one?

There is no correct number. Every extra variant raises the chance that the best result is luck. Test as many as your idea needs, record the count, and judge the winner against that count, for example with a deflated Sharpe ratio. A strategy that passes validation after a small, focused search is easier to trust than the best of a huge one.

How long should I paper trade a strategy?

Paper trade until you have checked the mechanics: matching signals, fills within your slippage setting, and correct behaviour across sessions and holidays. For a strategy that trades several times a week, that often takes a few weeks. A short paper period cannot confirm the edge, so do not use it for that purpose.

Can a good backtest tell me what a strategy will earn?

No. A backtest shows how fixed rules behaved on past data with your cost and execution assumptions. Validation on unseen data and forward testing make it less likely that the result is noise. Future results still depend on markets that can change.

References

  • White, H. (2000). A Reality Check for Data Snooping. Econometrica, 68(5), 1097–1126.
  • Bailey, D. H., & López de Prado, M. (2014). The Deflated Sharpe Ratio: Correcting for Selection Bias, Backtest Overfitting and Non-Normality. The Journal of Portfolio Management, 40(5), 94–107.
  • 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.