Home › Guides › Golden Cross

WHY BOTS FAILFREENO ACCOUNTAUTOMATED TRADE BOTSGolden CrossThe arithmetic of how bots failEDUCATION ONLY | NO SIGNALSEXAMPLE NUMBERS ARE LABELLEDAUTOMATED TRADE BOTSautomatedtradebots.com
A free page on golden cross. Education only, with example numbers labelled.
WHY BOTS FAIL

Golden Cross

Short answer

A golden cross happens when the 50 bar simple moving average rises from below to above the 200 bar simple moving average. The opposite event is the death cross.

A golden cross is the moment a faster average climbs above a slower one. The arithmetic is plain, and so is the main catch: it only says so after the move has happened.

The page explains the idea in plain words, works through the arithmetic with a table, and shows how it hits grid, martingale and DCA bots, then tells you what to check before you run one.

  • A worked example with real arithmetic
  • How it hits grid, martingale and DCA bots
  • How to check for it before you run a bot
  • No advice, no signals, no profit promises

Last reviewed 28 October 2026. Education only, not advice.

Free, no account Runs in your browser Worked numbers shown Not advice Examples labelled

Ready to go further

Next: see the mirror image

The death cross is the same two averages crossing the other way. Read it to see how a rule built from both crosses behaves.

Reading time9 minutes
Worked exampleExact arithmetic
Tools linked1 on this page
Reviewed28 Oct 2026

What is included

  • What it is, in plain words
  • The formula or mechanism, with exact arithmetic
  • How it hits grid, martingale and DCA bots
  • A check you can run before you switch a bot on

Who it is for

  • People who run or plan to run a trading bot
  • Anyone reading a backtest or a bot sales page
  • Readers who want the numbers, not the pitch
  • Not advice, and not a signal service
Price, 50 bar and 200 bar averages (made-up)801001201100200300Cross, bar 202Bar numberMade-up closes. Simple averages. Calculated by us on 31 Oct 2026, exact. Grey = price, amber = 200 bar, green = 50 bar.
The picture for this page. Example numbers are made up unless the page says they were calculated.

Key facts

  • A golden cross happens when the 50 bar simple moving average rises from below to above the 200 bar simple moving average. The opposite event is the death cross.
  • It is a description of what price has already done. It is not a forecast, and this page does not give signals.
  • In the made-up path below the cross fires at bar 202 at a close of 99.37, with the 50 bar average at 90.00 and the 200 bar average at 89.75 (calculated by us on 31 Oct 2026, exact).
  • The low of that path was 78.67 at bar 146 and the high was 121.65 at bar 260. The cross fired 56 bars after the low, with about 48 percent of the low-to-high rise already behind it.
  • In a sideways made-up market the same rule gave 3 long trades that all lost, a total of -27.17 per unit before costs. That is whipsaw.

What a golden cross is

A moving average is the average of the last N closing prices, recalculated on every new bar. A bar is one candle of whatever time frame you chose: a minute, an hour, a day. A simple moving average (SMA) gives every one of the N closes the same weight. An exponential one gives recent closes more weight, which is the subject of EMA crossover.

The 50 bar average reacts quickly because it only looks back 50 bars. The 200 bar average reacts slowly because it looks back 200. When the quick line moves from below the slow line to above it, that event is called a golden cross. People read it as a sign that recent prices have climbed far enough to pull the short average over the long one. When the quick line falls back under the slow one, it is called a death cross.

Nothing about the numbers 50 and 200 is special in the arithmetic. They are conventions, chosen because they are round and widely used. On daily bars they cover about ten weeks and about forty weeks of trading. On a five minute chart they cover a few hours and a day or two. The same words, golden cross, are used for all of these, and the meaning changes with the time frame.

SMA(N) at bar t = (close[t] + close[t-1] + ... + close[t-N+1]) / N
Golden cross at bar t: SMA(50) at bar t-1 is at or below SMA(200) at bar t-1, and SMA(50) at bar t is above SMA(200) at bar t

The 200 bar average needs 200 closes before it exists at all, so the earliest a cross can happen is bar 201. A bot that starts with a fresh chart has to load at least that much history first.

A worked example with made-up prices

The picture at the top uses a made-up path of 320 closes. It falls from 100 to about 80 over the first 150 bars, climbs to about 120 by bar 260, and then drifts down slowly, with a small wave added so it is not a straight line. Every number here is invented to show the arithmetic, and none of it describes a real market.

For the first 200 bars the 50 bar average sits below the 200 bar average, because the price has been falling. Then the climb begins. Around bar 202 the quick line catches the slow one. The table shows the three bars around the cross.

BarCloseSMA 50SMA 200GapSMA 50 is
20198.5189.6489.76-0.12below
20299.3790.0089.750.24above
203100.2090.3689.750.61above

The gap is SMA 50 minus SMA 200. It is negative before the cross and positive after. The bar where it first turns positive is the cross bar, 202. That is when a rule written as "buy on a golden cross" would act, at about the next price it can get.

Result of each long trade from the cross rule (made-up sideways market)-11.96Trade 1bar 267 to 337-8.75Trade 2bar 399 to 458-6.46Trade 3bar 528 to 584Made-up closes, one unit, before costs. Total -27.17. Calculated by us on 31 Oct 2026, exact.
In a sideways market the 50 and 200 bar averages keep swapping places. Each cross-up was followed by a cross-down at a lower price, so every trade lost.

How late it fires

Both averages are built from old prices, so the cross can only appear after the price has already moved. In the made-up path the lowest close was 78.67 at bar 146. The cross appeared at bar 202, which is 56 bars later, at a close of 99.37. From the low to the cross the price had already risen 20.70. The whole low-to-high rise in the path is 42.98, so roughly 48 percent of it was behind the cross before the signal existed.

That is the trade-off in plain view. A longer average is steadier and gives fewer false alarms, but it waits longer. A shorter average reacts sooner and gives more false alarms. You cannot have both. A bot that uses the cross as an entry has to be built knowing that part of the move is gone, and that the stop point or exit rule has to be judged against that late price.

The delay also depends on the shape of the move. A sharp V-shaped recovery pulls the 50 bar average up fast, but the 200 bar average barely moves, so the cross comes quickly. A slow grind up takes a long time to lift the quick line over the slow one. The price moves first, the 50 bar average second and the 200 bar average last, so the cross is always the final step in the chain.

Whipsaw: when the lines keep swapping

A trending market is the friendly case. A sideways market is the hard one. When the price swings up and down around a level, the 50 bar average wanders back and forth across the 200 bar average, and each crossing looks like a new golden cross or death cross. Traders call the repeated false starts whipsaw.

The second made-up path has 600 bars and moves sideways with two waves of different length added on top of a tiny drift. A rule that goes long on each golden cross and sells at the next death cross produced 3 trades:

TradeIn barIn priceOut barOut priceResult
1267107.4933795.53-11.96
2399107.7845899.03-8.75
3528105.5858499.12-6.46

Each entry came after a rise and each exit after a fall, and the exit price was lower than the entry price every time. The total is -27.17 per unit, before any spread or slippage. Those costs would only make it worse. This is one made-up path chosen to show the mechanism. It does not say how often this happens in real markets, and it does not say the rule always loses. It says the rule has no way to tell a trend from a swing until after the fact.

How a bot rule is written

A bot can only act on information it has when the bar closes. A golden cross rule is therefore written in terms of closed bars. In plain steps it looks like this:

  • Inputs. The fast length (50), the slow length (200), the type of average (simple here) and the time frame.
  • Warm-up. Do nothing until there are at least 200 closed bars.
  • On each closed bar. Compute SMA 50 and SMA 200 for this bar and for the previous bar.
  • Entry condition. If SMA 50 was at or below SMA 200 on the previous bar and is above it now, and the bot is flat, open a long position on the next bar.
  • Exit condition. If SMA 50 crosses back below SMA 200, close the position. Many designs also add a protective stop, which is a separate rule with its own setting. Position size comes from a separate rule too, for example position size.

Two details cause most of the bugs. The first is using the current, still-forming bar. The average on an unfinished bar changes with every tick, so a cross can appear and vanish within the same bar. Use closed bars only. The second is using a price from the future when testing, for example acting at the same close that created the cross. Real orders go in after the close. See look-ahead bias.

How bots break it

  • Whipsaw losses. Many small losing trades in a range, each paying the spread. The losses are small one at a time and large in a row. Check the max drawdown across a whole sideways stretch, not only the trends.
  • Late entry, late exit. The exit is a death cross, which also fires late, so a bot can give back a large share of a gain before it exits.
  • Few signals, fragile statistics. On a daily chart a 50 and 200 cross happens only a handful of times in many years of data. A test with a few trades says very little, and picking the best lengths from a grid of choices is overfitting.
  • Different averages, different dates. A simple average and an exponential one cross on different bars. A tool that uses a different type, or a different price such as the high, gives a different date for the same picture.
  • Gaps and thin trading. A cross is computed on closes, but an order fills at a real price. If the price jumps between bars, the fill can be far from the close that triggered it.

How to check a rule that uses it

Test it on more than one kind of market: a long uptrend, a long downtrend and a long sideways stretch. Count the trades, and look at the average result per trade after costs and the longest run of losing trades. Then keep part of the data back and test once on it, as in how to backtest. If the rule only works for lengths very close to 50 and 200 and fails at 45 or 55, the result depends on a lucky setting, not on a feature of the market. Compare it also with the plain EMA crossover, breakout trading and doing nothing.

It can also be combined with other tools, such as the RSI indicator, Bollinger bands or VWAP. Each addition is another setting that can be fitted to the past, so the same tests apply to the whole bundle. A rule that fires on a cross and then fails at once is a close cousin of a false breakout.

What it does not tell you

It does not say where the price goes next. It says that, over the last 50 bars, the average close is higher than the average over the last 200. That is all. It does not say how long a move will last, how far it will go, or whether it will reverse. No setting of it removes risk, and this page is education, not advice.

FAQ

Frequently Asked Questions

What is a golden cross?

It is the point where the 50 period moving average rises from below to above the 200 period moving average. It describes past prices and does not forecast the next move.

How is a golden cross calculated?

Add the last 50 closes and divide by 50, then do the same with 200. When the 50 bar value moves from at or below the 200 bar value to above it, that is a cross.

Why does the golden cross come so late?

Both averages are built from old closes, so the price has already moved before they cross. Longer averages give fewer false alarms but wait longer.

What is whipsaw?

It is a run of false crosses in a sideways market, where the two averages keep swapping places and each trade ends at a loss. Costs make it worse.

How would a bot trade a golden cross?

It waits for 200 closed bars, compares the two averages on each closed bar, and acts only when the fast one was at or below the slow one on the previous bar and is above it now.

Does the golden cross work?

No fixed answer exists. It depends on the market, the time frame, the settings and the costs. Test any rule on data it has not seen before trusting it.

Are the numbers on this page real?

Example numbers are made up to show how the maths works, and the page says so. A figure only counts as exact when the page says it was calculated on a stated date. Nothing you enter in a calculator leaves your browser.

Can I use this to decide whether to run a bot?

It can show whether a bot's numbers hold together and how much an account can lose. It cannot say what the market will do, and it is not advice. Use it to ask better questions, then read the terms of your own broker or exchange.

Is this financial advice?

No. It is general education about a calculation. The prices are made up and it is not a signal.

Know the Risk Before You Run It

Free calculators and guides, added every week. Leave your details and we will email you when new ones go up.

Trading carries a risk of loss