Golden cross strategy
On ES futures from January 2016 to July 2026, the golden cross made $130,653 after costs and made money in 8 of 11 years.
TrendSwingDaily barsBacktested Nov 6, 2026
Golden cross backtest, the result
Contract
E-mini S&P 500
-
+$131K
Net after costs
After $672 in fees and slippage
-
8 of 11
Years that made money
January 2016 to July 2026
-
−$66.9K
Largest drawdown
Peak to trough, 1 contract
-
$3.6K
Average trade
37 trades
Net after costs by month, January 2016 to July 2026.
Golden cross rules
Buy when the 50-day average closes above the 200-day average, and sell when it closes back below.
A drawing of the rules on a made-up day, not a result.
- The averages are simple means of the daily closes of the CME trading day, over 50 and 200 days.
- When the 50-day average closes above the 200-day, the strategy buys one contract.
- When it closes below the 200-day, the death cross, the strategy sells and stays flat.
- Decides on
- Daily bars
- Holds
- Overnight and across days
- Parameters
- fast 50, slow 200
Results by year
It made money in 8 of 11 years on ES. Its best year was 2021, +$51,911, and its worst 2022, −$27,789.
| Year | Net | Trades | Win rate | Drawdown | Buy and hold |
|---|---|---|---|---|---|
| 2016 | +$3,907 | 1 | 100% | −$6,612 | +$11,497 |
| 2017 | +$21,924 | 4 | 100% | −$3,991 | +$21,936 |
| 2018 | +$6,188 | 4 | 75% | −$17,450 | −$8,589 |
| 2019 | +$17,576 | 3 | 100% | −$12,650 | +$35,436 |
| 2020 | −$8,139 | 4 | 50% | −$60,278 | +$27,761 |
| 2021 | +$51,911 | 4 | 100% | −$13,941 | +$51,361 |
| 2022 | −$27,789 | 1 | 0% | −$35,325 | −$45,939 |
| 2023 | +$25,558 | 4 | 75% | −$28,029 | +$38,435 |
| 2024 | +$42,772 | 4 | 100% | −$30,062 | +$42,947 |
| 2025 | −$24,965 | 4 | 50% | −$63,220 | +$37,010 |
| 2026, Jan to Jul | +$21,710 | 4 | 75% | −$36,954 | +$24,355 |
Golden cross backtest results
On ES it made $131,325 before costs. Fees and slippage took $672 of that.
- Net = before costs − fees − slippage
- ES: $131,325 − $134 − $538 = $130,653
The interval holds zero: this test cannot tell the average trade from no edge.
Golden cross 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, SELL, Bars, Rolling, Strategy2 3 4class GoldenCross(Strategy):5 """Golden cross: long while the 50-day average is above the 200-day, flat after the death cross.6 7 A day is the CME trading day, 18:00 to 17:00 New York (the run's daily bars). The averages are8 simple means of the daily closes. When the 50-day mean closes above the 200-day mean the strategy9 buys one contract, and when it closes below it sells. Each decision is taken at a daily close and10 fills at the next session's first one-second bar, at the 18:00 New York reopen.11 """12 13 data = "bars"14 15 class Params:16 fast: int = 5017 slow: int = 20018 clip: int = 119 20 class State:21 bars: Bars(interval_ns=86_400_000_000_000)22 short: Rolling(window=50)23 long: Rolling(window=200)24 25 def on_event(self, view, ev, orders):26 if not self.bars.update(ev):27 return28 close = float(self.bars.prev_close)29 self.short.update(close)30 self.long.update(close)31 if self.long.count < self.p.slow:32 return33 if view.position == 0 and self.short.mean() > self.long.mean():34 orders.ioc(side=BUY, qty=self.p.clip)35 elif view.position > 0 and self.short.mean() < self.long.mean():36 orders.ioc(side=SELL, qty=abs(view.position)) 1//@version=62// GoldenCross, 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("GoldenCross", 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("GoldenCross was exported for the 1 day timeframe; set the chart to 1D.")12 13fast = input.int(50, "fast", minval=-9007199254740991, maxval=9007199254740991)14slow = input.int(200, "slow", 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 23_q_close = _q_int(math.round(close * 1000000000.0))24 25var _q_short_buf = array.new_float(50, 0.0)26var int _q_short_idx = 027var int _q_short_count = 028var float _q_short_off = 0.029var float _q_short_sum = 0.030var float _q_short_sumsq = 0.031var int _q_short_skipped = 032var _q_long_buf = array.new_float(200, 0.0)33var int _q_long_idx = 034var int _q_long_count = 035var float _q_long_off = 0.036var float _q_long_sum = 0.037var float _q_long_sumsq = 0.038var int _q_long_skipped = 039float close_l = na40 41bool _q_running = true42close_l := _q_close * 1.043_q_sample1 = close_l44if na(_q_sample1) or math.abs(_q_sample1) > 1.7976931348623157e30845 _q_short_skipped := _q_short_skipped + 146else47 if _q_short_count == 048 _q_short_off := _q_sample149 if _q_short_count >= 5050 _q_old2 = array.get(_q_short_buf, _q_short_idx) - _q_short_off51 _q_short_sum := _q_short_sum - _q_old252 _q_short_sumsq := _q_short_sumsq - _q_old2 * _q_old253 else54 _q_short_count := _q_short_count + 155 _q_dev2 = _q_sample1 - _q_short_off56 array.set(_q_short_buf, _q_short_idx, _q_sample1)57 _q_short_sum := _q_short_sum + _q_dev258 _q_short_sumsq := _q_short_sumsq + _q_dev2 * _q_dev259 _q_short_idx := (_q_short_idx + 1) % 5060 if _q_short_idx == 0 and _q_short_count >= 5061 _q_origin2 = _q_short_off + _q_short_sum / _q_short_count62 _q_total2 = 0.063 _q_totalsq2 = 0.064 for _q_j2 = 0 to 4965 _q_e2 = array.get(_q_short_buf, _q_j2) - _q_origin266 _q_total2 := _q_total2 + _q_e267 _q_totalsq2 := _q_totalsq2 + _q_e2 * _q_e268 _q_short_off := _q_origin269 _q_short_sum := _q_total270 _q_short_sumsq := _q_totalsq271_q_sample3 = close_l72if na(_q_sample3) or math.abs(_q_sample3) > 1.7976931348623157e30873 _q_long_skipped := _q_long_skipped + 174else75 if _q_long_count == 076 _q_long_off := _q_sample377 if _q_long_count >= 20078 _q_old4 = array.get(_q_long_buf, _q_long_idx) - _q_long_off79 _q_long_sum := _q_long_sum - _q_old480 _q_long_sumsq := _q_long_sumsq - _q_old4 * _q_old481 else82 _q_long_count := _q_long_count + 183 _q_dev4 = _q_sample3 - _q_long_off84 array.set(_q_long_buf, _q_long_idx, _q_sample3)85 _q_long_sum := _q_long_sum + _q_dev486 _q_long_sumsq := _q_long_sumsq + _q_dev4 * _q_dev487 _q_long_idx := (_q_long_idx + 1) % 20088 if _q_long_idx == 0 and _q_long_count >= 20089 _q_origin4 = _q_long_off + _q_long_sum / _q_long_count90 _q_total4 = 0.091 _q_totalsq4 = 0.092 for _q_j4 = 0 to 19993 _q_e4 = array.get(_q_long_buf, _q_j4) - _q_origin494 _q_total4 := _q_total4 + _q_e495 _q_totalsq4 := _q_totalsq4 + _q_e4 * _q_e496 _q_long_off := _q_origin497 _q_long_sum := _q_total498 _q_long_sumsq := _q_totalsq499if _q_long_count < slow100 _q_running := false101if _q_running102 if _q_int(strategy.position_size) == 0 and (_q_short_count == 0 ? 0.0 : _q_short_off + _q_short_sum / _q_short_count) > (_q_long_count == 0 ? 0.0 : _q_long_off + _q_long_sum / _q_long_count)103 _q_qty5 = _q_int(clip)104 if _q_qty5 <= 0105 runtime.error("market order quantity must be a positive whole unit")106 _q_pos5 = _q_int(strategy.position_size)107 if _q_pos5 > 0 or _q_pos5 < 0 and _q_qty5 < -_q_pos5108 runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")109 strategy.order("q1", strategy.long, _q_qty5)110 else if _q_int(strategy.position_size) > 0 and (_q_short_count == 0 ? 0.0 : _q_short_off + _q_short_sum / _q_short_count) < (_q_long_count == 0 ? 0.0 : _q_long_off + _q_long_sum / _q_long_count)111 _q_qty6 = _q_int(math.abs(_q_int(strategy.position_size)))112 if _q_qty6 <= 0113 runtime.error("market order quantity must be a positive whole unit")114 _q_pos6 = _q_int(strategy.position_size)115 if _q_pos6 < 0 or _q_pos6 > 0 and _q_qty6 < _q_pos6116 runtime.error("this order would add to or partially reduce a position, so its trade ledger would not be faithful")117 strategy.order("q2", 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
- 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 ESU6NQ: 43 contracts, NQH6 to NQU6
- Costs paid
- ES: $134 in fees, $538 in slippageNQ: $130 in fees, $630 in slippage
- Warm-up
- Each new contract first reads the last 200 trading days, moved onto its prices
- Flagged days
- ES: NoneNQ: None Days the data holds too few bars for. Flagged, not removed.
Could you pass
a prop firm challenge
with the golden cross?
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 golden cross
What is the golden cross?
Buy when the 50-day average closes above the 200-day average, and sell when it closes back below. Atlantive backtested it on CME futures from January 2016 to July 2026 after costs.
Is the golden cross profitable on ES futures?
In this backtest it made money: on ES futures from January 2016 to July 2026 it made $130,653 after costs, over 37 trades, positive in 8 of 11 years; on NQ it made $214,615. Buying and holding one ES contract over the same window made $236,212. The average trade was $3,641, its 95% interval −$1,071 to $7,760. These are hypothetical results of a backtest, not of trading.
What are the golden cross's rules?
The averages are simple means of the daily closes of the CME trading day, over 50 and 200 days. When the 50-day average closes above the 200-day, the strategy buys one contract. When it closes below the 200-day, the death cross, the strategy sells and stays flat. Its parameters are the published ones, never tuned on the data it was tested on.
How was the golden cross 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 golden cross 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 golden cross 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.