TickAtlas
Guide 10 min read · March 28, 2026

XAUUSD (Gold) Technical Analysis via API: Complete Guide

A complete guide to analyzing gold (XAUUSD) programmatically using the TickAtlas API. Covers the indicators that work best for gold and common gold-specific strategies.

CG
By the TickAtlas team

Why Gold is Different

Gold (XAUUSD) does not trade like a currency pair. It is a safe-haven asset, an inflation hedge, and a central bank reserve instrument all at once. This means technical analysis works differently on gold. Trends tend to be longer and stronger, mean reversion is less reliable, and volatility clusters around macroeconomic events rather than session opens.

The TickAtlas API tracks XAUUSD with the same real-time indicators available for forex pairs, making programmatic gold analysis straightforward.

Fetching Gold Data

python
import requests

API_KEY = "your_api_key_here"
BASE_URL = "https://tickatlas.com/v1"
HEADERS = {"X-API-Key": API_KEY}

def gold_analysis(timeframe: str = "H4") -> dict:
    """Fetch comprehensive gold indicators."""
    resp = requests.get(f"{BASE_URL}/indicators", params={
        "symbol": "XAUUSD",
        "timeframe": timeframe,
        "indicators": "RSI_14,MACD,BBANDS_20,ADX_14,ATR_14,EMA_50,EMA_200"
    }, headers=HEADERS)
    return resp.json()["data"]

data = gold_analysis("H4")
print(f"Gold price: \${data['price']['close']:.2f}")
print(f"RSI: {data['indicators']['RSI_14']['value']:.1f}")
print(f"ADX: {data['indicators']['ADX_14']['value']:.1f}")

API Response for XAUUSD

json
// GET /v1/indicators?symbol=XAUUSD&timeframe=H4&indicators=RSI_14,MACD,ATR_14
{
  "success": true,
  "data": {
    "symbol": "XAUUSD",
    "timeframe": "H4",
    "indicators": {
      "RSI_14": {
        "value": 62.4,
        "signal": "neutral"
      },
      "MACD": {
        "macd_line": 3.42,
        "signal_line": 2.18,
        "histogram": 1.24
      },
      "ATR_14": {
        "value": 12.35
      }
    },
    "price": {
      "close": 2341.50
    },
    "timestamp": "2026-03-28T12:00:00Z"
  }
}

Best Indicators for Gold

EMA 50/200 (Trend Direction)

The golden cross (EMA 50 above EMA 200) and death cross are especially reliable on gold. Gold trends persist for months — the EMA crossover catches these moves early.

ADX (Trend Strength)

Gold frequently enters strong trends (ADX > 30) driven by macro events. Use ADX to confirm whether to apply trend or range strategies.

ATR (Volatility / Position Sizing)

Gold ATR is measured in dollars, not pips. A typical H4 ATR of $12-15 means stop losses need to be wider than on forex pairs. Essential for position sizing.

RSI (Timing)

RSI works on gold but the thresholds should be adjusted. Gold can stay overbought longer than forex — use 75/25 instead of the standard 70/30.

Gold Trend-Following Strategy

python
def gold_trend_strategy() -> dict:
    """Trend-following strategy optimized for XAUUSD."""
    data = gold_analysis("H4")
    ind = data["indicators"]
    price = data["price"]["close"]

    ema_50 = ind["EMA_50"]["value"]
    ema_200 = ind["EMA_200"]["value"]
    adx = ind["ADX_14"]["value"]
    rsi = ind["RSI_14"]["value"]
    macd_hist = ind["MACD"]["histogram"]
    atr = ind["ATR_14"]["value"]

    signal = "HOLD"
    reasons = []

    # Trend direction: EMA crossover
    if ema_50 > ema_200:
        reasons.append("Bullish: EMA 50 above EMA 200")
        if adx > 25 and rsi < 75 and macd_hist > 0:
            signal = "BUY"
            reasons.append(f"Entry: ADX {adx:.1f}, RSI {rsi:.1f}, MACD bullish")
    elif ema_50 < ema_200:
        reasons.append("Bearish: EMA 50 below EMA 200")
        if adx > 25 and rsi > 25 and macd_hist < 0:
            signal = "SELL"
            reasons.append(f"Entry: ADX {adx:.1f}, RSI {rsi:.1f}, MACD bearish")

    # Risk management
    stop_distance = atr * 2
    take_profit = atr * 3

    return {
        "signal": signal,
        "price": price,
        "stop_loss": price - stop_distance if signal == "BUY" else price + stop_distance,
        "take_profit": price + take_profit if signal == "BUY" else price - take_profit,
        "atr": atr,
        "reasons": reasons
    }

result = gold_trend_strategy()
print(f"Signal: {result['signal']}")
print(f"Price: \${result['price']:.2f}")
if result["signal"] != "HOLD":
    print(f"Stop: \${result['stop_loss']:.2f}")
    print(f"Target: \${result['take_profit']:.2f}")
for r in result["reasons"]:
    print(f"  - {r}")

Gold-Specific Considerations

Wider Stops Required

Gold moves $10-20 on H4 regularly. A 2x ATR stop on gold might be $25, compared to 20 pips on EURUSD. Adjust position sizes accordingly.

Correlated with USD Strength

Gold often moves inversely to the US Dollar. Cross-reference with DXY or USDCHF before taking gold trades.

News Sensitivity

Gold reacts strongly to Fed decisions, CPI data, and geopolitical events. Check the economic calendar before entering gold positions.

Further Reading

Try this with live data

Every account gets $2.50 in free PAYG credits. No card required — paste your API key and run the code above against live broker data.