OPEN-SOURCE SCRIPT

Gold Oil Ratio

1 718
Gold Oil Ratio: Macro Sentiment & Mean Reversion Overlay
This indicator provides a sophisticated look at the Gold-to-Oil Ratio, one of the oldest and most reliable macro-economic barometers. By tracking the relative value between "Safe Haven" Gold and "Industrial Growth" Oil, traders can gauge global economic sentiment and potential market turning points.
Key Features:
Macro Barometer: Instantly see if the market is in a "Risk-Off" (high ratio) or "Risk-On" (low ratio) phase.
Adaptive Volatility Bands: Uses a custom-built volatility envelope (Mean + Standard Deviation) that adjusts to historical price action, highlighting extreme overbought or oversold conditions in the ratio.
Dynamic Gradient Visualization: The candle colors change dynamically based on where the ratio sits relative to its historical bands—shifting from green (undervalued/low) to red (overvalued/high).
The "2020 Precision Fix": Includes a specialized logic to handle the extreme negative oil price anomaly of April 2020, ensuring your charts remain readable and the bands don't get distorted by the "black swan" spike.
Inversion Toggle: Switch between Gold/Oil and Oil/Gold focus with a single click in the settings.
How to use it:
Mean Reversion: When the ratio touches the Upper Band (Red), Gold is historically expensive compared to Oil—watch for a potential reversal or macro shift.
Risk Sentiment: Crossing above the Mean Line often signals increasing global uncertainty, while staying below suggests industrial expansion and stable growth.
Divergence: Use the gradient candles to spot when the ratio is losing momentum at extreme levels before the price action confirms it.
Note: This script pulls data from COMEX:GC1! and NYMEX:CL1! to ensure the most accurate futures-based ratio calculation.

Penafian

Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.