Golden cross and death cross explained
By Oalgo · Last reviewed
A golden cross is when a 50-candle moving average crosses above a 200-candle one. A death cross is the reverse: the 50 crosses below the 200. Both usually use simple averages (SMA). They are two names for a moving average crossover with long settings, and the names say nothing about what price does next.
How late does a golden cross come?
#Both averages follow price, so a cross always comes after the move began. On the example prices the lowest close is at candle 48, 90.62. The 20-candle average crosses above the 50-candle one at candle 65, 17 candles later, when the close is 116.21, 28% above that low. The cross below comes at candle 96, again 17 candles after the highest close (118.63 at candle 79), with the close at 97.14, 18% below that high. With 50 and 200 the delay is longer, because both averages are slower.
How much history does a 200-candle average need?
#A 200-candle average has no value until 200 candles exist. A backtest reads some earlier prices before your start date to warm its averages up, but at most 30 days of them.
| Candle length | 200 candles last | First value of the 200-candle average |
|---|---|---|
| 15 minutes | about 2 days | At the start date |
| 1 hour | about 8 days | At the start date |
| 4 hours | about 33 days | About 3 days after the start date |
| 1 day | 200 days | About 170 days after the start date |
A golden cross rule on 1-day candles cannot act in the first 170 days or so of a test, whatever the prices do. Choose a date range long enough to leave room after that.
What are the rules of a golden cross strategy?
#- Entry: the 50-candle SMA crosses above the 200-candle SMA.
- Exit: the 50-candle SMA crosses back below the 200-candle SMA, which is the death cross.
- Stop: a Stop Loss as a percentage, because the exit cross can come after a long fall.
- A pair this slow crosses rarely, so a test needs a long date range to hold more than a handful of trades.
How do you write this strategy in Oalgo?
#In Oalgo you can tell Oalgo AI your golden cross rule in your own words, check the rule it builds, and test it. After testing, if you choose, you Go Live with your own Live Strategy on your own Venue Account at a Supported Venue.
For example, you could tell Oalgo AI: "Enter when the 50-period SMA crosses above the 200-period SMA. Exit when the 50-period SMA crosses back below it. Use a 5% Stop Loss and a 10% exit target. Set the timeframe to 1 day." These numbers are examples to change. In the builder the two SMA blocks feed a Crosses block, set to Crosses Above for the entry and to Crosses Below for the exit. A Live Strategy needs a stop on each side it can enter, and an exit target is optional. The example names both.
How do you test this strategy honestly?
#- Use a long date range and count the trades. A few trades say little.
- Check the date of the first trade. On 1-day candles it cannot come sooner than about 170 days after the start.
- Try nearby pairs, such as 40 and 150, or 60 and 250. If the report falls apart, the first result may be overfitting.
- Run a backtest on a rising period, a falling one and a sideways one, then run a forward test on new prices, with simulated funds. On 1-day candles new prices arrive once a day, so a forward test takes a long time to meet a cross.
What can a golden cross not tell you?
#A cross says that a faster average has moved past a slower one. It does not say price will keep going, and the name does not make it a forecast. In a sideways market the two averages cross back and forth, and a death cross can follow a golden cross within a few candles. By the time the cross happens a large part of the move may be over, as the example above shows.
Read next
- Moving average crossover strategy: rules and how to testA moving average crossover enters when a fast average crosses above a slow one. See the rules, the golden cross and death cross, and how to test them.
- Moving averages: SMA and EMA explainedA moving average smooths price into one line. Learn how the SMA and EMA are calculated, how they differ, and how to use them in your own rules.