OPEN-SOURCE SCRIPT

Precious Metals & GSR (Zeiierman)

Overview
The Precious Metals & GSR (Zeiierman) is designed to provide traders and investors with a comprehensive view of the Gold-Silver Ratio (GSR) and other precious metal relationships. This tool helps evaluate the relative strength between different metals by analyzing their price ratios over historical periods, using quantile-based analysis and trend interpretation tables to highlight key insights.

snapshot

The Gold-Silver Ratio (GSR) is a widely utilized metric in precious metals trading, representing the number of silver ounces required to purchase one ounce of gold. Historically, this ratio has fluctuated, providing traders with insights into the relative value of these two metals. By analyzing the GSR, traders can identify potential trading opportunities based on historical patterns and market dynamics.

By integrating customizable percentile bands, gradient coloring for performance visualization, and dynamic ratio analysis, this indicator assists in understanding how one metal is performing relative to another, making it useful for trend tracking, risk management, and portfolio allocation.


snapshot

How It Works

The Precious Metals & GSR Indicator operates by fetching the latest prices of the selected precious metals in the user's chosen currency. It then calculates the ratio between two selected metals (Metal 1 and Metal 2) and analyzes this ratio over a specified period. By computing quantile bands and high/low bands, the indicator provides insights into the historical performance and current standing of the ratio.

Ratio Calculation
  • The core of this indicator is the metal ratio, calculated by dividing the price of Metal 1 by Metal 2.
  • A rising ratio means Metal 1 is outperforming Metal 2.
  • A falling ratio means Metal 2 is outperforming Metal 1.
  • The indicator automatically retrieves live market prices of Gold, Silver, Platinum, and Palladium to compute the ratio.


Quantile Ratio Bands
  • The indicator calculates the highest (max) and lowest (min) ratio levels over a user-defined period.
  • It also plots quantile bands at the 10th, 25th, 50th (median), 75th, and 90th percentiles, providing deeper statistical insights into how extreme or average the current ratio is.
  • The median (Q50) acts as a reference level, showing whether the ratio is above or below its historical midpoint.


Interpretation Table
  • The Ratio Interpretation Table provides a text-based summary of the ratio’s strength.
  • It detects whether Metal 1 is at a historical high, low, or within common ranges.
  • This helps traders and investors make informed decisions on whether the ratio is overextended, mean-reverting, or trending.


Precious Metals Table
  • Displays live market prices for Gold, Silver, Platinum, and Palladium.
  • Prices are shown in different units (oz, kg, grams, and troy ounces) based on user preferences.
  • A color-coded system highlights price changes, making it easier to track market movements.


Physical Holding Calculator
  • Users can enter their precious metal holdings to estimate their current value.
  • The system adjusts calculations based on weight, purity (24K, 22K, etc.), and unit of measurement.
  • The holding value is displayed in the selected currency (USD, EUR, GBP, etc.).


How to Use

Trend Identification
  • If the ratio is increasing, Metal 1 is gaining strength relative to Metal 2 → Possible Long Position on Metal 1 / Short on Metal 2
  • If the ratio is decreasing, Metal 2 is gaining strength relative to Metal 1 → Possible Short Position on Metal 1 / Long on Metal 2


snapshot

Mean Reversion Strategy
  • When the ratio reaches the 90th percentile, Metal 1 is historically overextended (expensive) compared to Metal 2.
  • Traders may look to sell Metal 1 and buy Metal 2, expecting the ratio to decline back toward its historical average.

Example (Gold/Silver Ratio): If the GSR is above the 90th percentile, gold is very expensive relative to silver, suggesting a potential buying opportunity in silver and/or a selling opportunity in gold.


  • When the ratio reaches the 10th percentile, Metal 1 is historically undervalued (cheap) compared to Metal 2.
  • Traders may look to buy Metal 1 and sell Metal 2, expecting the ratio to rise back toward its historical average.

Example (Gold/Silver Ratio): If the GSR is below the 10th percentile, gold is very cheap relative to silver, suggesting a potential buying opportunity in gold and/or a selling opportunity in silver.


Common Strategy Based on GSR Insights
A common approach involves monitoring the ratio for extreme values based on historical data. When the ratio reaches historically high levels, it suggests that gold is expensive relative to silver, potentially indicating a buying opportunity for silver and/or a selling opportunity for gold. Conversely, when the ratio is at historically low levels, silver is expensive relative to gold, suggesting a potential buying opportunity for gold and/or selling opportunity for silver. This mean-reversion strategy relies on the tendency of the GSR to return to its historical average over time.


snapshot

Hedging & Portfolio Diversification
  • If Gold is strongly outperforming Silver, investors may shift allocations to balance risk.
  • If Silver is rapidly gaining on Gold, it may indicate increased industrial demand or speculative interest.


Inflation & Economic Cycles
  • A rising Gold-Silver ratio often correlates with economic downturns and increased risk aversion.
  • A falling Gold-Silver ratio may signal stronger economic growth and higher inflation expectations.


Settings

Precious Metals Table
  • Select which metals to display (Gold, Silver, Platinum, Palladium)
  • Choose measurement units (oz, kg, grams, troy ounces)


Ratio Analysis
  • Select Metal 1 & Metal 2 for ratio calculation
  • Set historical length for quantile calculations


Interpretation Table
  • Enable automated insights based on ratio levels


Physical Holdings Calculator
  • Enter metal weight, purity, and unit
  • Select calculation currency


-----------------
Disclaimer

The content provided in my scripts, indicators, ideas, algorithms, and systems is for educational and informational purposes only. It does not constitute financial advice, investment recommendations, or a solicitation to buy or sell any financial instruments. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.

All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs.

Wyłączenie odpowiedzialności