OPEN-SOURCE SCRIPT
Gold Oil Ratio

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.
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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.