Indicator · Pine Script v6 · Own pane

SPX/Gold Ratio Bubble Detector

by EngineeredSuccess

Calculates the price ratio between the S&P 500 (defaulting to SPY) and Gold (defaulting to GLD) to evaluate macro valuation extremes.

View on GitHub

GitHub stars3on the repository
Pine versionv6current
Lines of code228
Settings11inputs
LicenceCustom licence
Last update1 year ago19 Sep 2025

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.

Overview

SPX/Gold Ratio Bubble Detector tracks the ratio alongside a simple moving average and evaluates market status across customizable warning, danger, and extreme thresholds. The script draws the ratio line, moving average, threshold bands, and condition tags in a separate pane. Users can adjust the underlying symbols, threshold tiers, moving average length, and toggle visual elements or alert conditions.

Details

Published by

EngineeredSuccess on GitHub

Type

Indicator, Pine Script v6

Draws

Separate pane below the chart

Category

Moving averages, Support & resistance

Markets

Stocks, Gold, Indices, Oil & commodities

Timeframes

H4 and above

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
SPX Symbol (ETF)symbolSPYspx_symbol
Gold Symbol (ETF)symbolGLDgold_symbol
Bubble Warning Levelfloat2.0bubble_warning
Bubble Danger Levelfloat2.3bubble_danger
Bubble Extreme Levelfloat2.6bubble_extreme
Show Ratio Linebooltrueshow_ratio
Show Moving Averagebooltrueshow_ma
Show Threshold Bandsbooltrueshow_bands
Show Bubble Signalsbooltrueshow_signals
Moving Average Lengthint50ma_length
Enable Alertsbooltrueenable_alerts
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

BTC Multiples

by readysetcryptocodes
43 stars

BTC Multiples calculates and displays Bitcoin macro valuation metrics in a separate pane, including the Mayer Multiple, Stock-to-Flow Multiple, Difficulty Multiple, and Puell Multiple. Each valuation multiple features configurable overvalued and undervalued th

Indicator v4 Moving averagesSupport & resistance
Updated 2 years ago · None stated GitHub repository of BTC Multiples

MACD Breakout

by jerryinyang
5 stars

MACD Breakout builds a higher-timeframe MACD from preset fast and slow lengths using SMA or EMA, and marks support and resistance zones from histogram sensitivity. Optional filters require zero-line agreement, higher-timeframe direction, and linear-regression

Indicator v4 Oscillators & momentumMoving averages
Updated 2 years ago · None stated GitHub repository of MACD Breakout

Noob's Indicators

by InNoobWeTrust
4 stars

This Pine Script indicator plots multiple exponential moving averages in a separate pane for technical analysis. It calculates Elliott wave EMAs using Fibonacci wave counts of 34 and 89, plus 200-session and golden ratio lines. Additional Pythagorean cloud lev

Indicator v5 Moving averagesSupport & resistance
Updated today · None stated GitHub repository of Noob's Indicators

Cipher B

by diehardyearone
3 stars

Cipher B is a multi-indicator plotting WaveTrend oscillator lines and signals alongside Stochastic RSI, MFI area with color bars, and buy sell marks. It draws all elements in a separate pane. WaveTrend calculates using SMMA and EMA on source like ohlc4 with ad

Indicator v6 Oscillators & momentumMoving averages
Updated 1 year ago · None stated GitHub repository of Cipher B
3 stars

This indicator demonstrates debugging visualization patterns for Pine Script. It plots value tracking with mean, min, and max reference lines, condition markers using shapes and arrows, historical comparisons with standard deviation bands, multi-series overlay

Indicator v5 Moving averagesVolatility & bands
Updated 7 months ago · None stated GitHub repository of Debugging Visualization Patterns

This indicator renders Ichimoku cloud components consisting of conversion line, base line, leading span A and leading span B. It tracks Tenkan-Kijun crosses and assigns a numeric score to each based on whether the cross occurs below, inside or above the Kumo c

Indicator v5 Moving averagesSupport & resistance
Updated 5 months ago · None stated GitHub repository of Ichimoku Cloud Weight Original

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers