OPEN-SOURCE SCRIPT

XAUUSD/SPX Slope with MACD

39
The XAUUSD/SPX Slope with MACD Indicator tracks the slope of the XAUUSD (Gold) to SPX (S&P 500) ratio using linear regression over a customizable lookback period (default 20 bars), plotted as a blue line to show Gold’s relative performance against stocks. A MACD overlay (fast: 12, slow: 26, signal: 9, scaled by 5) is applied to the slope, with a green MACD line, red signal line, and green/red histogram to highlight momentum. A positive slope indicates Gold outperforming SPX, while MACD trends provide additional context. A zero line and background coloring (green for positive slope, red for negative) aid interpretation. Ensure XAUUSD and SPX symbols are supported by your platform.

Usage Notes:

Interpretation:

Slope (Blue): Positive values indicate Gold outperforming SPX; negative values show SPX outperforming.

MACD Components: The green MACD line, red signal line, and histogram (green for positive, red for negative) reflect momentum in the slope. Crossovers or histogram shifts can be analyzed manually for potential trend changes.

Customization: Adjust lookback, macd_fast, macd_slow, or macd_signal to tune sensitivity. The MACD scale is fixed at 5 for clarity.
Symbol Check: Verify "XAUUSD" and "SPX" match your platform’s tickers (e.g., "GOLD" or "SP500").






Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.