OPEN-SOURCE SCRIPT
Golden Cross Screener

# Golden Cross Screener — find the *fresh* crosses, not last month's
## The problem this solves
TradingView's built-in screener can already filter for a 50/200 moving-average crossover. But if you've actually used it, you know the catch: it surfaces every name in a crossed-up *state*, so a cross that fired this morning sits in the same list as one from three weeks ago. There's no native way to ask "which stocks crossed in the last day or two" — and for a signal where timing is the entire edge, that's a real gap.
This screener closes it. It adds a true **recency dimension** to the golden cross, so you can isolate the crosses that *just happened* and leave the stale, already-extended ones behind.
## What it does
Built for the **Pine Screener**, this script scans a watchlist and exposes a set of columns you can filter and sort on:
- **GC today** — fires (1) only on the bar the 50 crosses above the 200. Run it end-of-day for a clean list of that session's fresh golden crosses.
- **GC recent** — flags (1) any cross within a window you set (default 5 bars), so you never miss one because you scanned a day late.
- **Bars since GC** — the column the native screener doesn't have: a precise count of how many bars have passed since the cross. Sort ascending and the freshest signals rise to the top. Filter `0–3` and weeks-old crosses simply disappear.
- **50 > 200 state** — the standing condition, for when you want every name currently in a golden-cross posture rather than the event itself.
- **MA gap %** — how far the fast MA sits above the slow one. A small gap means the cross is fresh and tight; a large gap means it happened long ago and price may be extended.
- **Price vs fast %** — where price sits relative to the fast MA, so you can drop names that have already rolled back under it.
Lengths are configurable, and you can switch between SMA (the classic golden cross) and EMA (faster, earlier signals) with a single input.
## How to set it up
1. Open the **Pine Screener** (top-left screener-type dropdown → Pine Screener).
2. Add this script to your favorites (the star) so the screener can see it.
3. Point it at a watchlist and set the timeframe to **Daily** — the 50/200 golden cross is a daily-chart signal.
4. Filter the columns. A few recipes to start with:
- *Today's fresh crosses:* `GC today = 1`
- *Anything from the last few days:* `Bars since GC` between `0` and `3`
- *Clean crosses only:* add `Price vs fast % ≥ 0` so price is still above the fast MA
- *Tight, just-crossed setups:* keep `MA gap %` in a small range to weed out extended names
## On-chart use too
Add it to any chart as a normal indicator and you get the two moving averages drawn plus green/red triangles marking each golden and death cross — handy for eyeballing a name the screener surfaces before you commit.
## Honest notes
A 50/200 golden cross is a **lagging, trend-confirmation signal** by design — by the time the slower average is crossed, part of the move has already happened. This tool is built to help you act on crosses *promptly* and filter for *quality*, not to promise a specific outcome. It pairs best with your own confirmation: relative strength, volume, and the broader trend.
Two practical points. **Bars since GC** only has a value when the cross occurred within the history the script loaded for each symbol, so a name that's been in a golden-cross state for a very long time may show blank rather than a large number — which is fine here, since you're filtering for *small* values and the blanks (the stale ones) correctly fall out. And because the screener reads the last bar of the selected timeframe, keep it on Daily for the classic signal — a "golden cross" on an intraday timeframe means something different.
## Settings summary
- **Fast / Slow MA length** — defaults 50 / 200.
- **MA type** — SMA (classic) or EMA (faster).
- **Recent cross window** — how many bars back "GC recent" looks (default 5).
Open-source, so the logic is fully visible — read it, tweak it, make it yours. Feedback and suggestions are welcome in the comments.
## Disclaimer
This script is for research and educational purposes and is not financial advice. Moving-average crossovers are lagging signals and do not predict future price. Always do your own analysis and manage risk before acting on any screen result.
## The problem this solves
TradingView's built-in screener can already filter for a 50/200 moving-average crossover. But if you've actually used it, you know the catch: it surfaces every name in a crossed-up *state*, so a cross that fired this morning sits in the same list as one from three weeks ago. There's no native way to ask "which stocks crossed in the last day or two" — and for a signal where timing is the entire edge, that's a real gap.
This screener closes it. It adds a true **recency dimension** to the golden cross, so you can isolate the crosses that *just happened* and leave the stale, already-extended ones behind.
## What it does
Built for the **Pine Screener**, this script scans a watchlist and exposes a set of columns you can filter and sort on:
- **GC today** — fires (1) only on the bar the 50 crosses above the 200. Run it end-of-day for a clean list of that session's fresh golden crosses.
- **GC recent** — flags (1) any cross within a window you set (default 5 bars), so you never miss one because you scanned a day late.
- **Bars since GC** — the column the native screener doesn't have: a precise count of how many bars have passed since the cross. Sort ascending and the freshest signals rise to the top. Filter `0–3` and weeks-old crosses simply disappear.
- **50 > 200 state** — the standing condition, for when you want every name currently in a golden-cross posture rather than the event itself.
- **MA gap %** — how far the fast MA sits above the slow one. A small gap means the cross is fresh and tight; a large gap means it happened long ago and price may be extended.
- **Price vs fast %** — where price sits relative to the fast MA, so you can drop names that have already rolled back under it.
Lengths are configurable, and you can switch between SMA (the classic golden cross) and EMA (faster, earlier signals) with a single input.
## How to set it up
1. Open the **Pine Screener** (top-left screener-type dropdown → Pine Screener).
2. Add this script to your favorites (the star) so the screener can see it.
3. Point it at a watchlist and set the timeframe to **Daily** — the 50/200 golden cross is a daily-chart signal.
4. Filter the columns. A few recipes to start with:
- *Today's fresh crosses:* `GC today = 1`
- *Anything from the last few days:* `Bars since GC` between `0` and `3`
- *Clean crosses only:* add `Price vs fast % ≥ 0` so price is still above the fast MA
- *Tight, just-crossed setups:* keep `MA gap %` in a small range to weed out extended names
## On-chart use too
Add it to any chart as a normal indicator and you get the two moving averages drawn plus green/red triangles marking each golden and death cross — handy for eyeballing a name the screener surfaces before you commit.
## Honest notes
A 50/200 golden cross is a **lagging, trend-confirmation signal** by design — by the time the slower average is crossed, part of the move has already happened. This tool is built to help you act on crosses *promptly* and filter for *quality*, not to promise a specific outcome. It pairs best with your own confirmation: relative strength, volume, and the broader trend.
Two practical points. **Bars since GC** only has a value when the cross occurred within the history the script loaded for each symbol, so a name that's been in a golden-cross state for a very long time may show blank rather than a large number — which is fine here, since you're filtering for *small* values and the blanks (the stale ones) correctly fall out. And because the screener reads the last bar of the selected timeframe, keep it on Daily for the classic signal — a "golden cross" on an intraday timeframe means something different.
## Settings summary
- **Fast / Slow MA length** — defaults 50 / 200.
- **MA type** — SMA (classic) or EMA (faster).
- **Recent cross window** — how many bars back "GC recent" looks (default 5).
Open-source, so the logic is fully visible — read it, tweak it, make it yours. Feedback and suggestions are welcome in the comments.
## Disclaimer
This script is for research and educational purposes and is not financial advice. Moving-average crossovers are lagging signals and do not predict future price. Always do your own analysis and manage risk before acting on any screen result.
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。