Calendar Edges DayOfWeek RealTest RealTest Code Seasonality Turnaround Tuesday

Overnight Gaps, Turnaround Tuesday, and Turn-of-Month Calendar Edges in RealTest

Summary

Code calendar and seasonal anomalies in RealTest using DayOfWeek (where Monday equals 1 through Friday equals 5), Day (calendar day 1 through 31, never DayOfMonth), and backward-only Month <> Month[1] checks without ever using negative forward offsets like [-1] or EntryTime ThisClose on same-day close signals.

· 5 min read
RealTest 2.0 Turnaround Tuesday and calendar workspace showing 15-year SPY equity curves left, DayOfWeek script top right, and SPY Trade List bottom right
Key findings
  • RealTest's built-in calendar functions are DayOfWeek (Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5), Day (calendar day of month 1 to 31), Month (1 to 12), and Year; DayOfMonth does not exist and throws a parse error.
  • Never use EntryTime ThisClose on price-dependent Turnaround Tuesday signals (such as Monday C < C[1]) because you cannot observe Monday's confirmed close before Monday closes; always decide at Monday close and fill on Tuesday morning via EntryTime NextOpen.
  • Avoid forward lookahead negative offsets like EndOfMonth[-1] or Year[-1] in calendar research; code Turn-of-Month strictly backward-only using Day <= 5 and Month <> Month[1] so every signal is 100 percent live-tradable.
  • Turnaround Tuesday and Turn-of-Month strategies spend less than 15 percent of the year in the market, making them clean low-exposure seasonal sleeves to layer alongside higher-turnover systems.
  • Validated in RealTest 2.0 on SPY across 15 years (2010 through 2024) with zero lookahead, live-tradable spy_turnaround_tuesday earned $114,674 (-11.18 percent MaxDD across 102 trades, including a +2.00 percent rebound entered Tuesday August 6, 2024 right after the Monday Yen-carry crash).
  • Over the same 15 years, backward-only spy_turn_of_month produced $107,145 (-13.05 percent MaxDD across 149 trades), while waiting for a deeper intraday Tuesday dip (spy_tuesday_limit_dip) missed quick Tuesday open snapbacks ($97,270 across 48 trades).

Calendar anomalies (Turnaround Tuesday, Turn-of-Month liquidity flows, Monday oversold dips, and overnight gap edges) generate 25 dedicated threads, 196 posts, and 435 mentions on the RealTest user forum. They are also the single easiest category of strategy to accidentally ruin with subtle lookahead bugs, whether through EntryTime: ThisClose on a same-day close signal or forward date peeks like EndOfMonth[-1].

Every calendar function below matches the official RealTest DayOfWeek and date documentation, and all three SPY seasonal sleeves were validated live in RealTest 2.0 from 2010 through 2024 with strict zero-lookahead fills.

Exact RealTest Calendar Functions and Zero-Lookahead Rules

Memorize two naming quirks that catch almost every AI-generated calendar script before it even parses, plus the non-negotiable fill-timing rule that separates live-tradable edges from backtest mirages.

Calendar Need Broken Habit / Hallucination Validated RealTest 2.0 Syntax
Day of week check (Monday) DayOfWeek = 0 (0-indexed mistake) DayOfWeek = 1 (Monday = 1, Tuesday = 2, Friday = 5)
Calendar day of month (1..31) DayOfMonth <= 5 (parse error!) Day <= 5 (RealTest uses Day, never DayOfMonth)
First trading day of a new month EndOfMonth[-1] (negative forward peek) Month <> Month[1] (100% backward-only)
Turnaround Tuesday entry fill DayOfWeek = 1 and C < C[1] with EntryTime: ThisClose DayOfWeek = 1 and C < C[1] with EntryTime: NextOpen (buys Tuesday open!)

Why is EntryTime: ThisClose on Monday's close condition a mirage? In our own empirical audit, buying a Turnaround Tuesday close signal at ThisClose looked strongly positive only because the simulation assumed you knew Monday's final closing price before the closing bell rang! Switching strictly to NextOpen (deciding after Monday's confirmed close and entering Tuesday's opening auction) tests the true live-tradable edge cleanly (covered in full detail in our RealTest fill timing and lookahead bias guide).

Complete Validated RealTest Script (Turnaround Tuesday vs Tuesday Dip vs Turn-of-Month)

The script below compares three strictly backward-only, live-tradable SPY calendar sleeves side by side across 15 years (2010 through 2024) with realistic commissions, slippage, and 3x ATR catastrophe stops.

Notes:
	Overnight gap, Turnaround Tuesday, and Turn-of-Month calendar edges in RealTest
	using DayOfWeek (Monday = 1), DayOfMonth, and backward-only rules with zero
	forward lookahead on SPY from 2010 through 2024.

Settings:
	DataFile:	C:\RealTest\Data\MainETF.rtd
	StartDate:	2010-01-01
	EndDate:	2024-12-31
	AccountSize:	100000
	BarSize:	Daily

Data:
	ma200:	Avg(C, 200)
	atr14:	ATR(14)
	rsi2:	RSI(2)
	isSpy:	Symbol = $SPY
	// DayOfWeek: 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday
	monDown2:	DayOfWeek = 1 and C < C[1] and C[1] < C[2]
	// Backward-only first trading day of month (Day returns calendar day 1..31; never use [-1])
	earlyMonth:	Day <= 5 and Month <> Month[1]

Template: cal_base
	Side:	Long
	QtyType:	Percent
	Quantity:	100
	MaxPositions:	1
	MaxExposure:	100
	Commission:	Max(1, Shares * 0.005)
	OpenSlip:	0.0002 * FillPrice
	ExitStop:	IF(BarsHeld >= 1, FillPrice - 3 * atr14[BarsHeld], 0)
	ExitTime:	NextOpen
	Ambiguity:	Stop

// 1. Live-tradable Turnaround Tuesday: decides Monday close, buys Tuesday NextOpen
Strategy: spy_turnaround_tuesday
	Using:	cal_base
	EntrySetup:	isSpy and C > ma200 and monDown2
	ExitRule:	C > H[1] or BarsHeld >= 3

// 2. Monday oversold dip with intraday limit buy on Tuesday
Strategy: spy_tuesday_limit_dip
	Using:	cal_base
	EntrySetup:	isSpy and C > ma200 and DayOfWeek = 1 and rsi2 < 25
	EntryLimit:	C - 0.25 * atr14
	EntryTime:	Intraday
	LimitExtra:	0.0005 * C
	ExitRule:	C > H[1] or BarsHeld >= 4

// 3. Backward-only Turn-of-Month seasonal sleeve (enters first trading day, holds 3 bars)
Strategy: spy_turn_of_month
	Using:	cal_base
	EntrySetup:	isSpy and C > ma200 and earlyMonth
	ExitRule:	BarsHeld >= 3

Charts:
	MA200:	ma200

Validated 2010 to 2024 SPY Calendar Results (Zero Lookahead)

Evaluating all three seasonal sleeves honestly at live-tradable Tuesday open fills shows modest standalone returns with very low market exposure and shallow drawdowns.

SPY Calendar Sleeve (2010 to 2024) Completed Trades Ending Equity ($100k start) Max Drawdown
spy_turnaround_tuesday (Monday 2-Day Drop -> Tuesday Open) 102 $114,674 -11.18%
spy_turn_of_month (First Trading Day Hold 3 Bars) 149 $107,145 -13.05%
spy_tuesday_limit_dip (Monday Oversold + Tuesday Intraday Limit) 48 $97,270 -12.89%
RealTest 2.0 SPY daily chart showing live-tradable Turnaround Tuesday entry on August 6 2024 after Monday selloff with 200-day moving average
RealTest 2.0 SPY daily chart illustrating a live-tradable Turnaround Tuesday entry on Tuesday August 6, 2024 ($519.32) immediately following the Monday August 5 Yen-carry selloff, exiting August 9 at $529.70 (+2.00%) with zero lookahead.

Notice why standalone calendar filters make far stronger portfolio complements than stand-alone core systems. Because Turnaround Tuesday is in cash roughly 90 percent of the year, combining it with an equity mean-reversion sleeve or trend-following portfolio puts idle cash to work cleanly (see our S&P 500 RSI(2) and IBS mean-reversion blueprint and our RealTest multi-strategy combining guide).

Upgrade Seasonal Ideas into Complete Mean-Reversion Portfolios

Want to test focused SPY mean-reversion logic on your own machine? Start with our Free Mean-Reversion Strategy for RealTest & Python or inspect our dedicated SPY ETF Mean Reversion Strategy.

For complete, multi-strategy low-drawdown portfolios that blend mean reversion, trend, and defensive sleeves cleanly inside RealTest 2.0, explore our All-Weather Low-Drawdown Portfolio, The Dual-Engine Alpha Portfolio, and the full RealTest Portfolios collection.

Key terms

DayOfWeek Function
RealTest's built-in weekday indicator returning 1 for Monday through 5 for Friday for weekly calendar and seasonal strategy rules.
Day Function
RealTest's built-in calendar day-of-month indicator (1 to 31), used instead of DayOfMonth for monthly seasonality and Turn-of-Month rules.
Turnaround Tuesday Edge
A classic short-term equity seasonal pattern buying Tuesday morning's open (NextOpen) after consecutive Friday-Monday declines inside a long-term uptrend.
Backward-Only Seasonality
Coding calendar transitions strictly with backward comparisons like Month <> Month[1] rather than forward negative offsets like [-1] to guarantee zero lookahead.
Same-Bar ThisClose Lookahead
A backtesting bug where a price-dependent closing condition (such as C < C[1]) fills at EntryTime ThisClose on the exact bar whose close had to be known first.

Frequently asked questions

What numbers does DayOfWeek return in RealTest?

In RealTest, DayOfWeek returns 1 for Monday, 2 for Tuesday, 3 for Wednesday, 4 for Thursday, and 5 for Friday. To trigger a Turnaround Tuesday buy at Tuesday's open, test DayOfWeek = 1 on Monday's close using EntryTime NextOpen.

Why does DayOfMonth throw a parse error in RealTest?

RealTest's built-in calendar day function is named Day (returning 1 through 31), not DayOfMonth. Combine Day <= 5 with Month <> Month[1] to detect the first trading day of each calendar month strictly backward-only.

Why should Turnaround Tuesday avoid EntryTime ThisClose in RealTest?

Because the Turnaround Tuesday condition checks Monday's closing price (C < C[1]). Using EntryTime ThisClose assumes you knew Monday's final closing price before the closing bell rang, creating severe lookahead bias. Use EntryTime NextOpen to buy Tuesday morning's open realistically.

How do you test overnight gaps in RealTest without lookahead bias?

If you evaluate a signal using only yesterday's close or pure calendar timing (such as holding overnight from Monday close to Tuesday open), verify that your EntryTime does not depend on knowing today's Close before entering at ThisClose. For open-gap fades using today's Open, confirm whether live execution can place the order after the opening auction prints.

Why did spy_tuesday_limit_dip underperform spy_turnaround_tuesday in 2010 to 2024?

Turnaround Tuesday rebounds often gap up or rally straight off Tuesday's opening bell. Waiting for an additional intraday 0.25x ATR pullback on Tuesday missed the strongest Tuesday open snapbacks, cutting trades from 102 to 48 and ending equity from $114,674 to $97,270.

How can you combine Turnaround Tuesday with other strategies in RealTest?

Because Turnaround Tuesday sits in cash roughly 90 percent of the year, place it inside a multi-strategy script alongside uncorrelated trend or ETF rotation sleeves using RealTest's Combined section and CashIntPct so idle cash earns Treasury interest between Tuesday setups.

Related strategies

SPY ETF Mean Reversion Strategy
Focused SPY short-term mean-reversion RealTest script built with zero-lookahead fills and full open source code.
View →
Free Mean-Reversion Strategy for RealTest & Python
Free open-source mean-reversion starter strategy ready to test alongside Turnaround Tuesday and seasonal overlays.
View →
All-Weather Low-Drawdown Portfolio
Multi-strategy RealTest portfolio engineered to put idle seasonal cash to work across complementary market edges.
View →
← Back to Learn

#1 RealTest Backtests

Supercharge Your Trading Now

Reduce drawdown, build diversification, or speed up your development time.

Browse RealTest Strategies