Time-series momentum strategy

On ES futures from January 2016 to July 2026, the time-series momentum rule made $158,958 after costs and made money in 8 of 11 years.

TrendSwingDaily barsBacktested Nov 6, 2026

Time-series momentum backtest, the result

Contract

E-mini S&P 500

  • +$159K

    Net after costs

    After $767 in fees and slippage

  • 8 of 11

    Years that made money

    January 2016 to July 2026

  • −$75.9K

    Largest drawdown

    Peak to trough, 1 contract

  • $3.8K

    Average trade

    43 trades

Time-series momentum on ES, net after costs by month, from January 2016 to July 2026: +$158,958; buying and holding one ES contract: +$236,212

Net after costs by month, January 2016 to July 2026.

Time-series momentum rules

At each month's end, go long if the price is up over the last 12 months, and short if it is down.

A drawing of the rules on a made-up day, not a result.

  1. At the close of each month's last trading day, the strategy reads the change in price over the last 252 trading days.
  2. If it is up, it holds one contract long for the month ahead. If it is down, one contract short.
  3. A roll closes the position, and the first daily close on the new contract takes the same side back.
Decides on
Daily bars
Holds
Overnight and across days
Parameters
lookback 252, session minute 1,020

Results by year

It made money in 8 of 11 years on ES. Its best year was 2021, +$51,911, and its worst 2022, −$16,693.

Net after costs by year on ES, with trades, win rate, largest drawdown and buying and holding the same contract
YearNetTradesWin rateDrawdownBuy and hold
2016−$1,2270−$1,962+$11,497
2017+$21,9244100%−$3,991+$21,936
2018+$874475%−$18,478−$8,589
2019+$517650%−$25,001+$35,436
2020−$11,755560%−$71,282+$27,761
2021+$51,9114100%−$13,941+$51,361
2022−$16,693520%−$44,661−$45,939
2023+$9,344580%−$28,029+$38,435
2024+$42,7724100%−$30,062+$42,947
2025+$36,860475%−$69,341+$37,010
2026, Jan to Jul+$24,430250%−$36,954+$24,355

Time-series momentum backtest results

On ES it made $159,725 before costs. Fees and slippage took $767 of that.

Net = before costs − fees − slippage
ES: $159,725 − $155 − $613 = $158,958
Every figure of the Time-series momentum backtest, by contract
FigureESZNGC6E
Net after costs+$158,958+$8,923+$95,566−$17,668
Before costs+$159,725+$9,578+$96,570−$17,094
Fees$155$77$254$206
Slippage$613$578$750$369
Trades43296148
Trades a year4465
Win rate70%41%49%54%
Profit factor1.991.351.540.78
Average trade$3,791$254$2,420−$395
Average trade, 95% interval−$465 to $7,875−$552 to $1,139−$2,597 to $8,421−$1,497 to $697
Sharpe ratio0.430.210.19-0.17
Largest drawdown−$75,868−$18,667−$173,303−$47,218
Time in the market91%85%91%91%
Buying and holding the contract+$236,212−$27,254+$221,560−$21,949

The interval holds zero: this test cannot tell the average trade from no edge.

Time-series momentum code and Pine Script

The strategy as the backtest ran it, and the Pine Script our compiler wrote from it for TradingView.

Time-series momentum
time_series_momentum.py
1from atlantive import BUY, NEW_YORK, SELL, Bars, Rolling, Session, Strategy2 3 4class TimeSeriesMomentum(Strategy):5    """Time-series momentum: long or short for the month ahead on the sign of the last twelve months.6 7    A day is the CME trading day, 18:00 to 17:00 New York (the run's daily bars). At the close of each8    month's last trading day the strategy reads the change in price over the last 252 trading days:9    the mean of the daily changes over that window has the same sign. Up, it holds one contract long10    for the month ahead; down, one contract short. A roll closes the position, and the first daily11    close on the new contract takes the same side back, from the sign the 252 days show there if no12    month has ended yet on that contract's replay. Each decision is taken at a daily close and fills13    at the next session's first one-second bar, at the 18:00 New York reopen.14    """15 16    data = "bars"17 18    class Params:19        lookback: int = 25220        session_minute: int = 102021        clip: int = 122 23    class State:24        clock: Session(zone=NEW_YORK)25        bars: Bars(interval_ns=86_400_000_000_000)26        changes: Rolling(window=252)27        last_close: float28        seen: int29        target: int30 31    def on_event(self, view, ev, orders):32        self.clock.update(ev)33        if not self.bars.update(ev):34            return35        close = float(self.bars.prev_close)36        if self.seen > 0:37            self.changes.update(close - self.last_close)38        self.last_close = close39        self.seen += 140        closed_day = self.clock.prev_day41        if self.clock.prev_minute >= self.p.session_minute:42            closed_day = closed_day + 143        next_day = self.clock.day44        if self.clock.minute >= self.p.session_minute:45            next_day = next_day + 146        # The civil month of each trade date (Hinnant's days-to-civil, every divisor a literal).47        z = closed_day + 71946848        era = z // 14609749        doe = z - era * 14609750        yoe = (doe - doe // 1460 + doe // 36524 - doe // 146096) // 36551        year = yoe + era * 40052        doy = doe - (365 * yoe + yoe // 4 - yoe // 100)53        mp = (5 * doy + 2) // 15354        month = mp + 355        if mp >= 10:56            month = mp - 957        if month <= 2:58            year = year + 159        closed_month = year * 12 + month60        z = next_day + 71946861        era = z // 14609762        doe = z - era * 14609763        yoe = (doe - doe // 1460 + doe // 36524 - doe // 146096) // 36564        year = yoe + era * 40065        doy = doe - (365 * yoe + yoe // 4 - yoe // 100)66        mp = (5 * doy + 2) // 15367        month = mp + 368        if mp >= 10:69            month = mp - 970        if month <= 2:71            year = year + 172        next_month = year * 12 + month73        if self.changes.count < self.p.lookback:74            return75        if next_month != closed_month or self.target == 0:76            self.target = 177            if self.changes.mean() < 0.0:78                self.target = -179        if self.target > 0:80            if view.position < 0:81                orders.ioc(side=BUY, qty=abs(view.position) + self.p.clip)82            elif view.position == 0:83                orders.ioc(side=BUY, qty=self.p.clip)84        else:85            if view.position > 0:86                orders.ioc(side=SELL, qty=abs(view.position) + self.p.clip)87            elif view.position == 0:88                orders.ioc(side=SELL, qty=self.p.clip)
1//@version=62// TimeSeriesMomentum, exported from Atlantive.3// Chart simulation: decisions use completed bars; market orders fill at the next bar open.4// Native fills, fees, data gaps and session boundaries can differ. Re-test on the target symbol.5// Use standard time-based candles and the strategy's timeframe, not synthetic chart prices.6// Pine v6 trims old trade records at its order limit; the strategy keeps calculating.7// Margin is explicitly disabled to retain the native signal simulation's sizing.8strategy("TimeSeriesMomentum", overlay=true, initial_capital=100000.0, commission_type=strategy.commission.cash_per_contract, commission_value=1.68, default_qty_type=strategy.fixed, default_qty_value=1, calc_on_every_tick=false, process_orders_on_close=false, slippage=0, margin_long=0, margin_short=0)9 10if timeframe.in_seconds() != 8640011    runtime.error("TimeSeriesMomentum was exported for the 1 day timeframe; set the chart to 1D.")12 13lookback = input.int(252, "lookback", minval=-9007199254740991, maxval=9007199254740991)14session_minute = input.int(1020, "session_minute", minval=-9007199254740991, maxval=9007199254740991)15clip = input.int(1, "clip", minval=-9007199254740991, maxval=9007199254740991)16 17_q_safe_int(x) =>18    if math.abs(x) > 900719925474099119        runtime.error("an integer left the exact chart range; this run cannot be compared faithfully")20    int(x)21_q_int(x) => _q_safe_int(x < 0 ? math.ceil(x) : math.floor(x))22_q_iadd(a, b) => _q_safe_int(a + b)23_q_isub(a, b) => _q_safe_int(a - b)24_q_imul(a, b) =>25    if a != 0 and math.abs(b) > 9007199254740991 / math.abs(a)26        runtime.error("an integer multiplication left the exact chart range; this run cannot be compared faithfully")27    _q_safe_int(a * b)28_q_ifloordiv(a, b) =>29    _q_r = a % b30    _q_q = (a - _q_r) / b31    _q_safe_int(_q_r != 0 and ((_q_r < 0) != (b < 0)) ? _q_q - 1 : _q_q)32 33_q_close = _q_int(math.round(close * 1000000000.0))34 35var float last_close = 0.036var int seen = 037var int target = 038// clock: completed chart bar's opening timestamp (America/New_York).39_q_clock_prev_minute = hour(time, "America/New_York") * 60 + minute(time, "America/New_York")40_q_clock_prev_second = _q_clock_prev_minute * 60 + second(time, "America/New_York")41_q_clock_prev_weekday = (dayofweek(time, "America/New_York") + 5) % 742_q_clock_prev_day = int(timestamp("UTC", year(time, "America/New_York"), month(time, "America/New_York"), dayofmonth(time, "America/New_York"), 0, 0) / 86400000)43// Current clock: this chart bar's scheduled close, known without a future bar.44// A native next event after a data gap can carry a later time.45_q_clock_minute = hour(time_close, "America/New_York") * 60 + minute(time_close, "America/New_York")46_q_clock_second = _q_clock_minute * 60 + second(time_close, "America/New_York")47_q_clock_weekday = (dayofweek(time_close, "America/New_York") + 5) % 748_q_clock_day = int(timestamp("UTC", year(time_close, "America/New_York"), month(time_close, "America/New_York"), dayofmonth(time_close, "America/New_York"), 0, 0) / 86400000)49_q_clock_seen = 150var _q_changes_buf = array.new_float(252, 0.0)51var int _q_changes_idx = 052var int _q_changes_count = 053var float _q_changes_off = 0.054var float _q_changes_sum = 0.055var float _q_changes_sumsq = 0.056var int _q_changes_skipped = 057float close_l = na58int closed_day = na59int next_day = na60int z = na61int era = na62int doe = na63int yoe = na64int year_l = na65int doy = na66int mp = na67int month_l = na68int closed_month = na69int next_month = na70 71bool _q_running = true72close_l := _q_close * 1.073if seen > 074    _q_sample1 = close_l - last_close75    if na(_q_sample1) or math.abs(_q_sample1) > 1.7976931348623157e30876        _q_changes_skipped := _q_changes_skipped + 177    else78        if _q_changes_count == 079            _q_changes_off := _q_sample180        if _q_changes_count >= 25281            _q_old2 = array.get(_q_changes_buf, _q_changes_idx) - _q_changes_off82            _q_changes_sum := _q_changes_sum - _q_old283            _q_changes_sumsq := _q_changes_sumsq - _q_old2 * _q_old284        else85            _q_changes_count := _q_changes_count + 186        _q_dev2 = _q_sample1 - _q_changes_off87        array.set(_q_changes_buf, _q_changes_idx, _q_sample1)88        _q_changes_sum := _q_changes_sum + _q_dev289        _q_changes_sumsq := _q_changes_sumsq + _q_dev2 * _q_dev290        _q_changes_idx := (_q_changes_idx + 1) % 25291        if _q_changes_idx == 0 and _q_changes_count >= 25292            _q_origin2 = _q_changes_off + _q_changes_sum / _q_changes_count93            _q_total2 = 0.094            _q_totalsq2 = 0.095            for _q_j2 = 0 to 25196                _q_e2 = array.get(_q_changes_buf, _q_j2) - _q_origin297                _q_total2 := _q_total2 + _q_e298                _q_totalsq2 := _q_totalsq2 + _q_e2 * _q_e299            _q_changes_off := _q_origin2100            _q_changes_sum := _q_total2101            _q_changes_sumsq := _q_totalsq2102last_close := close_l103seen := _q_int(_q_iadd(seen, 1))104closed_day := _q_int(_q_clock_prev_day)105if _q_clock_prev_minute >= session_minute106    closed_day := _q_int(_q_iadd(closed_day, 1))107next_day := _q_int(_q_clock_day)108if _q_clock_minute >= session_minute109    next_day := _q_int(_q_iadd(next_day, 1))110z := _q_int(_q_iadd(closed_day, 719468))111era := _q_int(_q_ifloordiv(z, 146097))112doe := _q_int(_q_isub(z, _q_imul(era, 146097)))113yoe := _q_int(_q_ifloordiv(_q_isub(_q_iadd(_q_isub(doe, _q_ifloordiv(doe, 1460)), _q_ifloordiv(doe, 36524)), _q_ifloordiv(doe, 146096)), 365))114year_l := _q_int(_q_iadd(yoe, _q_imul(era, 400)))115doy := _q_int(_q_isub(doe, _q_isub(_q_iadd(_q_imul(365, yoe), _q_ifloordiv(yoe, 4)), _q_ifloordiv(yoe, 100))))116mp := _q_int(_q_ifloordiv(_q_iadd(_q_imul(5, doy), 2), 153))117month_l := _q_int(_q_iadd(mp, 3))118if mp >= 10119    month_l := _q_int(_q_isub(mp, 9))120if month_l <= 2121    year_l := _q_int(_q_iadd(year_l, 1))122closed_month := _q_int(_q_iadd(_q_imul(year_l, 12), month_l))123z := _q_int(_q_iadd(next_day, 719468))124era := _q_int(_q_ifloordiv(z, 146097))125doe := _q_int(_q_isub(z, _q_imul(era, 146097)))126yoe := _q_int(_q_ifloordiv(_q_isub(_q_iadd(_q_isub(doe, _q_ifloordiv(doe, 1460)), _q_ifloordiv(doe, 36524)), _q_ifloordiv(doe, 146096)), 365))127year_l := _q_int(_q_iadd(yoe, _q_imul(era, 400)))128doy := _q_int(_q_isub(doe, _q_isub(_q_iadd(_q_imul(365, yoe), _q_ifloordiv(yoe, 4)), _q_ifloordiv(yoe, 100))))129mp := _q_int(_q_ifloordiv(_q_iadd(_q_imul(5, doy), 2), 153))130month_l := _q_int(_q_iadd(mp, 3))131if mp >= 10132    month_l := _q_int(_q_isub(mp, 9))133if month_l <= 2134    year_l := _q_int(_q_iadd(year_l, 1))135next_month := _q_int(_q_iadd(_q_imul(year_l, 12), month_l))136if _q_changes_count < lookback137    _q_running := false138if _q_running139    if next_month != closed_month or target == 0140        target := _q_int(1)141        if (_q_changes_count == 0 ? 0.0 : _q_changes_off + _q_changes_sum / _q_changes_count) < 0.0142            target := _q_int(-1)143if _q_running144    if target > 0145        if _q_int(strategy.position_size) < 0146            _q_qty3 = _q_int(_q_iadd(math.abs(_q_int(strategy.position_size)), clip))147            if _q_qty3 <= 0148                runtime.error("market order quantity must be a positive whole unit")149            _q_pos3 = _q_int(strategy.position_size)150            if _q_pos3 > 0 or _q_pos3 < 0 and _q_qty3 < -_q_pos3151                runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")152            strategy.order("q1", strategy.long, _q_qty3)153        else if _q_int(strategy.position_size) == 0154            _q_qty4 = _q_int(clip)155            if _q_qty4 <= 0156                runtime.error("market order quantity must be a positive whole unit")157            _q_pos4 = _q_int(strategy.position_size)158            if _q_pos4 > 0 or _q_pos4 < 0 and _q_qty4 < -_q_pos4159                runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")160            strategy.order("q2", strategy.long, _q_qty4)161    else162        if _q_int(strategy.position_size) > 0163            _q_qty5 = _q_int(_q_iadd(math.abs(_q_int(strategy.position_size)), clip))164            if _q_qty5 <= 0165                runtime.error("market order quantity must be a positive whole unit")166            _q_pos5 = _q_int(strategy.position_size)167            if _q_pos5 < 0 or _q_pos5 > 0 and _q_qty5 < _q_pos5168                runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")169            strategy.order("q3", strategy.short, _q_qty5)170        else if _q_int(strategy.position_size) == 0171            _q_qty6 = _q_int(clip)172            if _q_qty6 <= 0173                runtime.error("market order quantity must be a positive whole unit")174            _q_pos6 = _q_int(strategy.position_size)175            if _q_pos6 < 0 or _q_pos6 > 0 and _q_qty6 < _q_pos6176                runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")177            strategy.order("q4", strategy.short, _q_qty6)

How it was tested

The published rules, never tuned on the data, with real costs on every fill. Every strategy here is tested the same way.

Market data
CME Globex daily bars, Jan 2, 2016 to Jul 31, 2026 ZN from March 2020
Rules
As published, with the published parameters, never tuned on this data
Size
1 contract on every trade
Contract
The most traded one, rolled as the market moved
Fees
The broker's $0.50 a side, plus CME's and the NFA's fees when the window opens
Slippage
1 tick a side on ES, 2 in NQ's regular session and 3 outside it, 1 on other markets, where it was not measured
Stops and entries
Tested on 1-second closes and filled at the next bar
Contracts traded
ES: 43 contracts, ESH6 to ESU6ZN: 26 contracts, ZNM0 to ZNU6GC: 54 contracts, GCG6 to GCQ66E: 43 contracts, 6EH6 to 6EU6
Costs paid
ES: $155 in fees, $613 in slippageZN: $77 in fees, $578 in slippageGC: $254 in fees, $750 in slippage6E: $206 in fees, $369 in slippage
Warm-up
Each new contract first reads the last 253 trading days, moved onto its prices
Flagged days
ES: NoneZN: NoneGC: None6E: None Days the data holds too few bars for. Flagged, not removed.

Could you pass
a prop firm challenge
with the time-series momentum rule?

A backtest says whether a strategy makes money. Our AI runs its trades through the rules of every prop firm account, then tells you which one it would pass and at what size.

No card needed. Free credits every month.

  • Most money: Blue Guardian Futures Direct 50K, $5,084
  • Best payout odds: Funded Futures Family Straight to Funded 50K, 98%
  • Fastest pass: Phidias Express to Live 50K, 11 days
Blue Guardian Futures Direct 50K
Most money

$5,084

Median net across 2,000 simulated runs

Evaluation
None
First payout
97%
Fees paid
$1,521

Median net across 2,000 simulated runs

Best 5%$13,143Worst 5%−$412
Day 060120180
Example: ES opening range breakout

Questions about the time-series momentum rule

What is the time-series momentum rule?

At each month's end, go long if the price is up over the last 12 months, and short if it is down. The rules follow Tobias Moskowitz, Yao Hua Ooi and Lasse Heje Pedersen, Time Series Momentum, Journal of Financial Economics (2012). Atlantive backtested it on CME futures from January 2016 to July 2026 after costs.

Is the time-series momentum rule profitable on ES futures?

In this backtest it made money: on ES futures from January 2016 to July 2026 it made $158,958 after costs, over 43 trades, positive in 8 of 11 years; on ZN it made $8,923, on GC it made $95,566 and on 6E it lost $17,668. Buying and holding one ES contract over the same window made $236,212. The average trade was $3,791, its 95% interval −$465 to $7,875. These are hypothetical results of a backtest, not of trading.

What are the time-series momentum rule's rules?

At the close of each month's last trading day, the strategy reads the change in price over the last 252 trading days. If it is up, it holds one contract long for the month ahead. If it is down, one contract short. A roll closes the position, and the first daily close on the new contract takes the same side back. The rules follow Tobias Moskowitz, Yao Hua Ooi and Lasse Heje Pedersen, Time Series Momentum, Journal of Financial Economics (2012). Its parameters are the published ones, never tuned on the data it was tested on.

How was the time-series momentum rule backtested?

On CME Globex data from January 2016 to July 2026, one contract, on daily bars, rolled to the most traded contract as the market moved, with the broker's and CME's fees and the slippage measured on each market. Stops and entries were tested on 1-second closes and filled at the next bar. Nothing was fitted to the data.

Can I run the time-series momentum rule in TradingView?

Yes. The page carries its Pine Script, written by Atlantive's compiler from the same code the backtest ran, for TradingView's strategy tester. A chart's fills and fees can differ from the backtest's, so test it again on the symbol you trade.

Can I change the time-series momentum rule and test it again?

Yes. Rerun it in Atlantive: a new chat opens with the strategy's rules in the box, for you to read, change and send. The agent writes the code, backtests it on the market and window you name, and reports the result with its costs.

Rerun it in Atlantive. Change the market, the dates or a rule, then send it.

A new chat opens with this in the box

Backtest time-series momentum on ES, 2016-01-02 to 2026-07-31, one contract on a $100,000 account with default costs and warm_up 253: on daily bars, at each month's last close go long if the price is up over the last 252 trading days, short if it is down, and hold for the month.

Never sent for you

May we measure this visit?

With your consent, Google Analytics and PostHog count visits to these pages. You can separately allow Google Ads to measure visits from our ads. Visit measurement starts only after you choose. Cookie policy