VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Strategy generation

Momentum trading strategy on futures: rules, lookback, NQ backtest

A momentum trading strategy buys when today's close is above the close N bars ago and sells short when it is below. Write the comparison, the lookback and the exit before the test, pick the lookback from a region where neighbours agree, and read the drawdown before the net profit.

By · Published · updated · Editorial policy

Contents
  1. What is a momentum trading strategy in rules?
  2. How do you set momentum entry rules with rate of change?
  3. How long should the momentum lookback be?
  4. How do you backtest the momentum rule step by step?
  5. What does an NQ daily-bar backtest of a rate-of-change rule show?
  6. Does momentum still work across futures markets?
  7. Where do momentum strategies fail?
  8. Frequently asked questions
  9. References

What is a momentum trading strategy in rules?

A momentum trading strategy on futures buys when today's close is above the close N bars ago and sells short when it is below. The whole idea reduces to one comparison, one lookback N and one exit rule, all written down before the test. Rate of change turns the comparison into a percent so you can add a threshold.

Momentum is the observation that a price which has moved in one direction over the last N bars tends to keep moving that way for a while before it turns. Think of a heavy cart on a slope: once it rolls, it does not stop on the next step. The momentum indicator measures this as the difference between today's close and the close N bars ago. The lookback is the number of bars you count back to find that earlier close. A positive difference means price is higher than it was; a negative difference means it is lower. That sign is the entire signal.

To make the idea testable, write three parts and fix them before you load any data:

  1. The comparison. Today's close against the close N bars ago. Nothing else enters the entry decision.
  2. The lookback N. One number, for example 20 daily bars. The third section explains how to choose it.
  3. The exit. Reverse on the opposite signal, go flat when the difference returns to zero, or leave after a fixed number of bars. Each choice gives a different strategy, so name one.

A rule this exact can be run by a program without a person watching the chart, which is the point of algo trading and what it costs to run. Momentum is also one of the oldest quant trading strategies, because it needs nothing but price history and a counter.

Momentum is one comparison: if today's close is higher than the close 20 bars ago the rule goes long, and if it is lower the rule goes short Momentum is one comparison Close today vs close 20 bars ago Higher: long Lower: short 20 bars ago Today 20 bars ago Today Higher means long, lower short. So: write N and the exit first.
Momentum is one comparison: today's close against the close N bars ago. Higher means long, lower means short.

How do you set momentum entry rules with rate of change?

Rate of change turns the momentum comparison into a percent number, and the entry rule reads either its sign (above zero long, below zero short) or a threshold band that keeps you flat when the move is too small to matter after costs. Rate of change is the momentum difference divided by the earlier close and multiplied by 100, so a move of the same size means the same percent whether NQ trades at a high or a low price level. One formula carries this article:

rate of change = (close today − close N bars ago) ÷ close N bars ago × 100

Here close today is the last completed bar's close, close N bars ago is the close N bars earlier, and the result is a percent that swings above and below zero. Two entry styles follow from it:

Entry styleLong whenShort whenFlat whenEffect
Sign ruleRate of change above 0Rate of change below 0Never (always in)Most trades, most small flips near zero
Threshold bandRate of change above +TRate of change below −TBetween −T and +TFewer trades, skips moves too small to pay costs

The band exists because a reading of +0.3 percent and a reading of −0.3 percent are, in practice, the same thing: noise around zero. A sign rule trades every one of those crossings and pays commission and slippage each time. A band with a threshold T of, say, 2 percent waits until the move is large enough to mean something. The price of the band is a later entry and a stretch of flat time in slow trends.

Hypothetical example

Suppose the close 20 bars ago was 18,000 and today's close is 18,540. The difference is 540 points, and the rate of change is 540 ÷ 18,000 × 100 = 3 percent. A sign rule is long because 3 is above zero. A band rule with T = 2 percent is also long because 3 is above 2. If today's close had been 18,180 instead, the rate of change would be 1 percent: the sign rule is still long, the band rule stays flat.

A rate-of-change line swings around zero; a band from minus 2 percent to plus 2 percent means no position, the area above means long and below means short, and markers show where the line leaves the band Trade only outside the band Rate of change, band from −2% to +2% Illustration Long No position Short Inside the band, stay flat. So: set the band above your costs.
Rate of change swings around zero. A sign rule trades every crossing; a band rule waits until the line leaves the shaded zone.

Write the exit next to the entry. The simplest is the reverse signal: a long position is closed when the short condition appears, so the rule is in the market almost all the time. The NQ run in the fifth section used exactly that structure, and its time in market shows what it means.

How long should the momentum lookback be?

Short lookbacks trade often and pay more in commission and slippage, long lookbacks enter late and hold through reversals, so pick a lookback in a region where the neighbouring values behave alike rather than the single best one. There is no correct N. There is a trade-off between three things: how many signals you get, how much each signal costs, and how far behind the turn you enter.

PropertyShort (about 10 bars)Medium (about 50 bars)Long (about 200 bars)
Signals per yearManyModerateFew
Cost loadHighModerateLow
Entry lagSmallModerateLarge
Whipsaws in sideways marketsManyFewerFewest
Illustrative trade-off of momentum lookbacks on daily bars: 10 bars gives many trades, high cost and small lag; 50 bars gives some trades, medium cost and medium lag; 200 bars gives few trades, low cost and large lag No lookback is free Illustrative trade-off, daily bars 10 bars 50 bars 200 bars Trades Cost Lag Many Some Few High Mid Low Small Mid Large Fewer trades cost less, enter late. So: choose which cost to pay.
The lookback trades signal count, cost load and lag against each other. No column is free of a cost; you choose which one to pay.

Cost load is the share of the gross result that commission and slippage take, and it rises with the trade count. A whipsaw is a trade that reverses shortly after entry because the sign flipped back. Short lookbacks suffer both at once, which is why intraday momentum rules need the cost discipline described in how to build and test a day trading algorithm before anything else.

Hypothetical example

Two rules on daily bars, each with a gross result of $7,200 a year and a round-trip cost of $30 per trade. The 10-bar rule takes 60 trades a year, so costs are 60 × $30 = $1,800 and the net result is $5,400: costs took a quarter of the gross. The 200-bar rule takes 4 trades a year, so costs are $120 and the net result is $7,080: costs took under 2 percent. If slippage doubles, the short rule loses another $900 and the long rule another $60.

Once you have a candidate N, run the values on each side of it, for example 15, 18, 20, 22 and 25 for a 20-bar rule. If 20 is good and 18 and 22 are poor, the 20 was chosen by the noise of that history. If all five land in the same area, the region is real. Pardo (2008) makes this the central test of an optimized parameter: the quality of the neighbourhood, not the height of the peak. How much the trade count changes the cost side is covered in trading costs in backtests and the average trade.

How do you backtest the momentum rule step by step?

Write the rule with fixed costs and next-bar execution, run it on one market and bar size, read trades and drawdown before net profit, then repeat on markets you did not use to choose the settings. The order matters because each step closes a way of fooling yourself.

  1. Write the rule and the lookback. Comparison, N, threshold if any, and exit, in one sentence each. Keep the sentence; you will compare the exported code against it later.
  2. Set commission, slippage and next-bar fills. Next-bar execution means a signal read at a bar's close is filled at the next bar, which is the earliest price you could have traded. A test that fills on the same close uses a price nobody had.
  3. Run on one market and one bar size. Pick the market and bar size you intend to trade, and no other, so that the first result is not already the best of several.
  4. Read trades, drawdown and time in market. Trade count tells you how much evidence there is. Drawdown tells you whether you could have held it. Time in market tells you whether the rule is a trend follower or an always-in bet on the market's direction. Net profit comes last.
  5. Test the neighbouring lookbacks. The region test from the previous section.
  6. Repeat on other markets. Markets the search never saw are the only place where a result is new information.
Six backtest steps in order: write the rule, set costs and next-bar fills, run on one market, read trades and drawdown, test neighbouring lookbacks, repeat on new markets; a dashed loop back to the start means a new candidate, not re-tuning Six steps, in this order From written rule to readable result Write rule Set costs One market Read risk Neighbours New market A loop back means a new candidate. So: never re-tune the old one quietly.
Six steps from a written rule to a result you can read. Going back to step one means a new candidate, not a quiet change to the old one.

Step two is where most hand-built tests go wrong, because costs are added at the end, after a short lookback has already been chosen for its smooth curve. In AlphaPrime (Valynox) the commission, slippage and next-bar fill you set are charged inside every candidate during backtesting, so a 10-bar rule competes with a 50-bar rule on net figures from the first run and cannot win on gross ones. If you have never run a test like this, the 30-day route to a first algo trading strategy walks through the setup, and the wider sequence of research, validation and review is laid out in how to build a quantitative trading process step by step.

What does an NQ daily-bar backtest of a rate-of-change rule show?

The one candidate kept out of 1,024 tried shows a positive net result with a drawdown of roughly two thirds of it and 91 percent time in market, which means the rule is almost always in a position, and picking the kept one after the fact flatters it. The run used NQ daily bars from 2019-01-02 to 2025-06-30, long and short, one contract, with a Rate Of Change rule as its only entry and exit: no stop, no target, no filters. The search tried 1,024 variants and kept this one for its return against its drawdown.

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.

NumberResult
Net profit (closed trades)$172,380
Max drawdown$114,570
Trades77
Win rate66.23%
Profit factor1.556
Average trade$2,238.7
Time in market91.21%
Look at the shape, not the end point: the curve climbs in long steady stretches and gives back in sharper turns. The drawdown band below shows how deep each give-back went and how long it lasted.
Look at the shape, not the end point: the curve climbs in long steady stretches and gives back in sharper turns. The drawdown band below shows how deep each give-back went and how long it lasted. NQ · daily · 2019-01-02 to 2025-06-30 · CPU engine backtest

Read the numbers in the order from the previous section. Time in market of 91.21% means the rule held a position on more than nine days out of ten, so its equity is largely the path of NQ itself, long in the rises and short in the falls, with the flat time being the gaps between an exit and the next entry. The period holds long rises and a year of falling prices in 2022, and the curve records how the rule handled each. Seventy-seven trades in six and a half years is about one trade a month, a small sample for a per-trade figure like the $2,238.7 average trade. The max drawdown of $114,570 against a net profit of $172,380 is the number to sit with: for one contract, that is the hole an account would have been in at the worst point before the result at the end existed.

Read net profit and max drawdown as a pair, then check the trade count against the period before you trust the average trade.
Read net profit and max drawdown as a pair, then check the trade count against the period before you trust the average trade. NQ · daily · 2019-01-02 to 2025-06-30 · CPU engine backtest

Two facts about the selection shape how much weight this carries. First, the kept candidate is the best of 1,024 on the same history, and Bailey, Borwein, López de Prado and Zhu (2014) show that the best result among many tries is inflated by selection even when none of the rules has an edge. Second, the table is a record of one history on one market with one contract; it says what that rule did there, not what the rule earns or what a reader can expect. The useful reading is the structure: an always-in momentum rule with no stop lives and dies with the length of the trends it rides.

Does momentum still work across futures markets?

Research on time series momentum finds the effect across many futures markets over decades, but it arrives in long trending stretches and gives much of it back in sharp reversals, so a trader should test it on every market they intend to trade and read the result year by year. Moskowitz, Ooi and Pedersen (2012) studied dozens of futures and forward contracts across equity indexes, currencies, commodities and bonds and found that returns over the past months tended to continue over the next months, with part of the move reversing over longer horizons. That is the published basis for the lookback region of a few months to a year that many systematic traders start from.

A finding across many markets and decades does not tell you what one lookback on one market did in one year. Momentum rules are famous for long flat or losing stretches in sideways markets, followed by a trending year that produces most of the result. The right way to read a momentum backtest is therefore by year or by quarter: count how many periods were positive and how much of the total came from the best one. A result where one year made the whole period is a bet on that year repeating.

The same momentum rule in two illustrative markets: in a trend it enters once and holds through the rise, in a sideways range it flips long and short six times, buying near tops and selling near bottoms, losing on each flip Trends pay, ranges cost Same rule, two markets (illustration) Trend 1 trade Range 6 flips In a range, every flip pays costs. So: read the result year by year.
The same rule, two markets. In a trend it holds one position and exits once; in a range it flips six times and pays costs on every flip.

Repeat the test on the other markets you trade, with the lookback fixed in advance. A rule that behaves alike on an equity index, a bond future and a commodity with the same N is telling you something about momentum; a rule that needs a different N for each market is telling you something about the data it was tuned on. Keep the exact settings and the costs the same across markets so that the only thing changing is the market.

Where do momentum strategies fail?

Momentum rules fail in sideways markets that flip the sign every few bars, at sharp turns after long trends, when the lookback was fitted to one history, and when short lookbacks meet real costs, and each failure has a check you can run before trading. Every one of these leaves a mark in the report, so the checks are a matter of looking in the right place.

Failure pointWhat the report showsCheck to run
Sideways chopMany small losses in a rowCount consecutive losses and the months they fall in
Sharp reversal after a long trendOne large loss that erases monthsLook at the largest losing trade and how many bars it ran against you
Lookback fitted to one historyNeighbouring lookbacks much worseRun the neighbouring lookbacks and compare the region
Short lookback meets costsAverage trade near the round-trip costDouble slippage and rerun
No stop or exit besides the reverse signalDrawdown close to net profitAdd a time or ATR exit as a new candidate and compare
Five ways a momentum rule breaks and the check that exposes each: sideways chop, count loss streaks; sharp turn, check the largest loss; fitted lookback, run the neighbours; real costs, double slippage; no stop, add a time exit Five ways momentum breaks Each one has a check to run Sideways Sharp turn Fitted N Real costs No stop Count loss streaks Check largest loss Run the neighbours Double slippage Add a time exit Every failure leaves a trace. So: run each check before live.
Five ways a momentum rule breaks, the symptom each leaves in the report, and the check that exposes it before live trading.

The last row is the one the NQ run above points at. With the reverse signal as the only exit, a position opened late in a long trend stays open through the whole turn until the rate of change changes sign, and on daily bars that can take weeks. An exit by time (leave after a fixed number of bars) or by volatility (leave when price moves against you by a multiple of its recent range) changes the strategy, so test it as a new candidate on the same data and the same costs, and compare the two drawdowns side by side rather than the two net profits.

The next thing to do takes one afternoon: take the lookback you would like to trade, run it and its four nearest neighbours on one market with your real commission and slippage and next-bar fills, and write down the max drawdown of each. If the five drawdowns sit close together, you have a region worth testing on a second market. If one stands apart from the rest, change the region before you change anything else.

Frequently asked questions

What is the difference between momentum and rate of change?

Momentum is the difference in points between today's close and the close N bars ago. Rate of change is that same difference divided by the earlier close and multiplied by 100, so it is a percent. The sign is identical in both, so a sign rule gives the same trades either way. Rate of change is easier to compare across price levels and across markets, which is why thresholds are usually set on it.

Is a momentum strategy a quant trading strategy?

Yes. Quant strategies are rules defined in numbers and tested on historical data before they are traded, and a momentum rule is one of the simplest examples: one comparison, one lookback, one exit. What makes it quantitative is not the idea but the process around it: fixed costs, next-bar fills, a lookback chosen from a region rather than a peak, and a test on markets that did not help choose the settings.

Does a momentum strategy need a stop loss?

Not by definition. Many momentum rules exit only on the reverse signal, which keeps them in the market almost all the time. The cost of that choice is a drawdown that can approach the net profit, because a position opened late in a trend is held through the whole turn. A time exit or a volatility exit changes the strategy, so test it as a separate candidate and compare the drawdowns, not only the net results.

Why do momentum backtests look good in some years and bad in others?

Because the rule only earns in trends and pays in ranges. In a trending year it holds one position for months; in a sideways year it flips long and short every few bars and pays commission and slippage on each flip. Reading the result by year or by quarter shows how much of the total came from one period. A result that depends on a single year is a bet on that year repeating.

References

  • Moskowitz, T. J., Ooi, Y. H., & Pedersen, L. H. (2012). Time Series Momentum. Journal of Financial Economics, 104(2), 228–250.
  • 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.
  • Pardo, R. (2008). The Evaluation and Optimization of Trading Strategies (2nd ed.). John Wiley & Sons.