Turn of the month strategy
On ES futures from January 2016 to July 2026, the turn of the month trade made $38,915 after costs and made money in 6 of 11 years.
SeasonalSwingDaily barsBacktested Nov 6, 2026
Turn of the month backtest, the result
Contract
E-mini S&P 500
-
+$38.9K
Net after costs
After $3,597 in fees and slippage
-
6 of 11
Years that made money
January 2016 to July 2026
-
−$32.2K
Largest drawdown
Peak to trough, 1 contract
-
$309
Average trade
126 trades
Net after costs by month, January 2016 to July 2026.
Turn of the month rules
Buy at the close of the month's last trading day and sell at the close of the third trading day of the next month.
A drawing of the rules on a made-up day, not a result.
- When the next CME trading day falls in a new month, the day that just closed was the month's last: the strategy buys at its close.
- It sells at the close of the new month's third trading day.
- Decides on
- Daily bars
- Holds
- Overnight and across days
- Parameters
- hold days 3, session minute 1,020
Results by year
It made money in 6 of 11 years on ES. Its best year was 2020, +$32,358, and its worst 2024, −$10,695.
| Year | Net | Trades | Win rate | Drawdown | Buy and hold |
|---|---|---|---|---|---|
| 2016 | −$1,862 | 11 | 36% | −$6,052 | +$11,497 |
| 2017 | +$3,360 | 12 | 75% | −$2,275 | +$21,936 |
| 2018 | −$8,528 | 12 | 58% | −$14,932 | −$8,589 |
| 2019 | −$2,091 | 12 | 67% | −$14,169 | +$35,436 |
| 2020 | +$32,358 | 12 | 75% | −$10,119 | +$27,761 |
| 2021 | +$14,846 | 12 | 50% | −$7,925 | +$51,361 |
| 2022 | +$2,457 | 12 | 42% | −$15,504 | −$45,939 |
| 2023 | +$1,356 | 12 | 42% | −$15,260 | +$38,435 |
| 2024 | −$10,695 | 12 | 50% | −$28,008 | +$42,947 |
| 2025 | −$571 | 12 | 58% | −$19,670 | +$37,010 |
| 2026, Jan to Jul | +$8,286 | 7 | 71% | −$10,329 | +$24,355 |
Turn of the month backtest results
On ES it made $42,513 before costs. Fees and slippage took $3,597 of that.
- Net = before costs − fees − slippage
- ES: $42,513 − $447 − $3,150 = $38,915
The interval holds zero: this test cannot tell the average trade from no edge.
Turn of the month code and Pine Script
The strategy as the backtest ran it, and the Pine Script our compiler wrote from it for TradingView.
1from atlantive import BUY, NEW_YORK, SELL, Bars, Session, Strategy2 3 4class TurnOfTheMonth(Strategy):5 """Turn of the month: long from the last trading day's close to the third trading day's close.6 7 A day is the CME trading day, 18:00 to 17:00 New York (the run's daily bars); its date is the8 trade date, the day after the 18:00 open it starts on. When the next trading day falls in a new9 month, the day that just closed was the month's last: the strategy buys, and it sells at the10 close of the new month's third trading day. Each decision is taken at a daily close and fills at11 the next session's first one-second bar, at the 18:00 New York reopen.12 """13 14 data = "bars"15 16 class Params:17 hold_days: int = 318 session_minute: int = 102019 clip: int = 120 21 class State:22 clock: Session(zone=NEW_YORK)23 bars: Bars(interval_ns=86_400_000_000_000)24 held_month: int25 held_days: int26 seen: int27 28 def on_event(self, view, ev, orders):29 self.clock.update(ev)30 if not self.bars.update(ev):31 return32 closed_day = self.clock.prev_day33 if self.clock.prev_minute >= self.p.session_minute:34 closed_day = closed_day + 135 next_day = self.clock.day36 if self.clock.minute >= self.p.session_minute:37 next_day = next_day + 138 # The civil month of each trade date (Hinnant's days-to-civil, every divisor a literal).39 z = closed_day + 71946840 era = z // 14609741 doe = z - era * 14609742 yoe = (doe - doe // 1460 + doe // 36524 - doe // 146096) // 36543 year = yoe + era * 40044 doy = doe - (365 * yoe + yoe // 4 - yoe // 100)45 mp = (5 * doy + 2) // 15346 month = mp + 347 if mp >= 10:48 month = mp - 949 if month <= 2:50 year = year + 151 closed_month = year * 12 + month52 z = next_day + 71946853 era = z // 14609754 doe = z - era * 14609755 yoe = (doe - doe // 1460 + doe // 36524 - doe // 146096) // 36556 year = yoe + era * 40057 doy = doe - (365 * yoe + yoe // 4 - yoe // 100)58 mp = (5 * doy + 2) // 15359 month = mp + 360 if mp >= 10:61 month = mp - 962 if month <= 2:63 year = year + 164 next_month = year * 12 + month65 if view.position > 0:66 if closed_month == self.held_month:67 self.held_days += 168 if self.held_days >= self.p.hold_days:69 orders.ioc(side=SELL, qty=abs(view.position))70 elif view.position == 0 and self.seen > 0 and next_month != closed_month:71 orders.ioc(side=BUY, qty=self.p.clip)72 self.held_month = next_month73 self.held_days = 074 self.seen += 1 1//@version=62// TurnOfTheMonth, 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("TurnOfTheMonth", 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("TurnOfTheMonth was exported for the 1 day timeframe; set the chart to 1D.")12 13hold_days = input.int(3, "hold_days", 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 33var int held_month = 034var int held_days = 035var int seen = 036// clock: completed chart bar's opening timestamp (America/New_York).37_q_clock_prev_minute = hour(time, "America/New_York") * 60 + minute(time, "America/New_York")38_q_clock_prev_second = _q_clock_prev_minute * 60 + second(time, "America/New_York")39_q_clock_prev_weekday = (dayofweek(time, "America/New_York") + 5) % 740_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)41// Current clock: this chart bar's scheduled close, known without a future bar.42// A native next event after a data gap can carry a later time.43_q_clock_minute = hour(time_close, "America/New_York") * 60 + minute(time_close, "America/New_York")44_q_clock_second = _q_clock_minute * 60 + second(time_close, "America/New_York")45_q_clock_weekday = (dayofweek(time_close, "America/New_York") + 5) % 746_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)47_q_clock_seen = 148int closed_day = na49int next_day = na50int z = na51int era = na52int doe = na53int yoe = na54int year_l = na55int doy = na56int mp = na57int month_l = na58int closed_month = na59int next_month = na60 61closed_day := _q_int(_q_clock_prev_day)62if _q_clock_prev_minute >= session_minute63 closed_day := _q_int(_q_iadd(closed_day, 1))64next_day := _q_int(_q_clock_day)65if _q_clock_minute >= session_minute66 next_day := _q_int(_q_iadd(next_day, 1))67z := _q_int(_q_iadd(closed_day, 719468))68era := _q_int(_q_ifloordiv(z, 146097))69doe := _q_int(_q_isub(z, _q_imul(era, 146097)))70yoe := _q_int(_q_ifloordiv(_q_isub(_q_iadd(_q_isub(doe, _q_ifloordiv(doe, 1460)), _q_ifloordiv(doe, 36524)), _q_ifloordiv(doe, 146096)), 365))71year_l := _q_int(_q_iadd(yoe, _q_imul(era, 400)))72doy := _q_int(_q_isub(doe, _q_isub(_q_iadd(_q_imul(365, yoe), _q_ifloordiv(yoe, 4)), _q_ifloordiv(yoe, 100))))73mp := _q_int(_q_ifloordiv(_q_iadd(_q_imul(5, doy), 2), 153))74month_l := _q_int(_q_iadd(mp, 3))75if mp >= 1076 month_l := _q_int(_q_isub(mp, 9))77if month_l <= 278 year_l := _q_int(_q_iadd(year_l, 1))79closed_month := _q_int(_q_iadd(_q_imul(year_l, 12), month_l))80z := _q_int(_q_iadd(next_day, 719468))81era := _q_int(_q_ifloordiv(z, 146097))82doe := _q_int(_q_isub(z, _q_imul(era, 146097)))83yoe := _q_int(_q_ifloordiv(_q_isub(_q_iadd(_q_isub(doe, _q_ifloordiv(doe, 1460)), _q_ifloordiv(doe, 36524)), _q_ifloordiv(doe, 146096)), 365))84year_l := _q_int(_q_iadd(yoe, _q_imul(era, 400)))85doy := _q_int(_q_isub(doe, _q_isub(_q_iadd(_q_imul(365, yoe), _q_ifloordiv(yoe, 4)), _q_ifloordiv(yoe, 100))))86mp := _q_int(_q_ifloordiv(_q_iadd(_q_imul(5, doy), 2), 153))87month_l := _q_int(_q_iadd(mp, 3))88if mp >= 1089 month_l := _q_int(_q_isub(mp, 9))90if month_l <= 291 year_l := _q_int(_q_iadd(year_l, 1))92next_month := _q_int(_q_iadd(_q_imul(year_l, 12), month_l))93if _q_int(strategy.position_size) > 094 if closed_month == held_month95 held_days := _q_int(_q_iadd(held_days, 1))96 if held_days >= hold_days97 _q_qty1 = _q_int(math.abs(_q_int(strategy.position_size)))98 if _q_qty1 <= 099 runtime.error("market order quantity must be a positive whole unit")100 _q_pos1 = _q_int(strategy.position_size)101 if _q_pos1 < 0 or _q_pos1 > 0 and _q_qty1 < _q_pos1102 runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")103 strategy.order("q1", strategy.short, _q_qty1)104else if _q_int(strategy.position_size) == 0 and seen > 0 and next_month != closed_month105 _q_qty2 = _q_int(clip)106 if _q_qty2 <= 0107 runtime.error("market order quantity must be a positive whole unit")108 _q_pos2 = _q_int(strategy.position_size)109 if _q_pos2 > 0 or _q_pos2 < 0 and _q_qty2 < -_q_pos2110 runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")111 strategy.order("q2", strategy.long, _q_qty2)112 held_month := _q_int(next_month)113 held_days := _q_int(0)114seen := _q_int(_q_iadd(seen, 1)) 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 ZNU6
- Costs paid
- ES: $447 in fees, $3,150 in slippageZN: $158 in fees, $1,906 in slippage
- Warm-up
- None: each contract reads only its own bars
- Flagged days
- ES: NoneZN: None Days the data holds too few bars for. Flagged, not removed.
Could you pass
a prop firm challenge
with the turn of the month trade?
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
$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
Questions about the turn of the month trade
What is the turn of the month trade?
Buy at the close of the month's last trading day and sell at the close of the third trading day of the next month. The rules follow Josef Lakonishok and Seymour Smidt, Are Seasonal Anomalies Real? A Ninety-Year Perspective, Review of Financial Studies 1(4), 403-425 (1988). Atlantive backtested it on CME futures from January 2016 to July 2026 after costs.
Is the turn of the month trade profitable on ES futures?
In this backtest it made money: on ES futures from January 2016 to July 2026 it made $38,915 after costs, over 126 trades, positive in 6 of 11 years; on ZN it lost $1,643. Buying and holding one ES contract over the same window made $236,212. The average trade was $309, its 95% interval −$389 to $960. These are hypothetical results of a backtest, not of trading.
What are the turn of the month trade's rules?
When the next CME trading day falls in a new month, the day that just closed was the month's last: the strategy buys at its close. It sells at the close of the new month's third trading day. The rules follow Josef Lakonishok and Seymour Smidt, Are Seasonal Anomalies Real? A Ninety-Year Perspective, Review of Financial Studies 1(4), 403-425 (1988). Its parameters are the published ones, never tuned on the data it was tested on.
How was the turn of the month trade 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 turn of the month trade 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 turn of the month trade 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.