Gold- und Silberarbitragestrategie


Erstellungsdatum: 2026-03-12 11:50:47 zuletzt geändert: 2026-03-12 11:50:47
Kopie: 0 Klicks: 22
2
konzentrieren Sie sich auf
413
Anhänger

Gold- und Silberarbitragestrategie Gold- und Silberarbitragestrategie

ZSCORE, RSI, ATR, SMA, EMA

Z-Score-Arbitrage: Das mathematische Spiel des Gold-Silber-Verhältnisses

Dies ist keine gewöhnliche Trend-Tracking-Strategie. Die XAG/XAU-Statistik-Arrangierungs-Strategie basiert auf einer Kernannahme: Es gibt eine langfristige Mean-Return-Beziehung zwischen Gold- und Silberpreisen. Wenn der Z-Score die ±2-Standarddifferenz überschreitet, weichen die Preise von den statistisch bedeutenden Maximalwerten ab, um die Chance auf eine Rückkehr zu ergreifen.

20 Zyklus-Standardisierungs-Verhältnis: Genauer als herkömmliche Korrelationsanalyse

Der Kern der Strategie besteht darin, ein standardisiertes Preisverhältnismodell zu erstellen. Es wird durch eine 20-Zyklus-SMA für XAG und XAU standardisiert, dann wird das Verhältnis berechnet und mit einem 3-Zyklus-EMA ausgeglichen. Diese Handhabung ist stabiler als eine einfache Preisverhältnis und filtert kurzfristige Geräusche effektiv.

RSI-Filter: Der raffinierte Einsatz der 50er-Grenze

Anders als bei traditionellen RSI-Überkauf-Überverkauf-Signalen wird der RSI=50 als Leerfilterbedingungen verwendet. RSI<50 erlaubt Überkaufen und RSI>50 erlaubt Leerverkaufen. Die Designlogik ist klar: Kaufen und warten auf eine Reaktion bei relativer Schwäche und verkaufen und warten auf eine Rückkehr bei relativer Stärke.

3:8 ATR-Risiko-Gewinn-Verhältnis: Mathematische Erwartung positiv

Die Stop-Loss-Rate ist 3-fach ATR, die Stop-Loss-Rate ist 8-fach ATR, und das Risiko-Gewinn-Verhältnis beträgt 1:2.67. Die Konstruktion basiert auf statistischem Arbitrage: Die Wahrscheinlichkeit eines Durchschnittsrückgangs ist hoch, aber es ist erforderlich, ausreichend Fehlerraum zu gewähren. Die 14-Zyklus-ATR stellt sicher, dass die Stop-Loss-Rate sich an die Veränderungen der Marktvolatilität anpasst.

Anwendungsfall: Schwankungen sind besser als Trends

Die statistische Arbitrage-Strategie funktioniert am besten bei schwankenden Schwankungen am Horizont, da die Rückkehr der Mittelwerte zu diesem Zeitpunkt deutlicher ist. In einem einseitigen Trendmarkt können die Preise für eine lange Zeit vom Mittelwert abweichen, was zu einem größeren Rücktrittsrisiko für die Strategie führt. Es wird empfohlen, diese Strategie zu verwenden, wenn die Marktfluktuation moderat ist und kein eindeutiger einseitiger Trend vorliegt.

Ratschläge: Die Grenzen statistischer Modelle

Historische statistische Beziehungen garantieren keine zukünftige Fortführung. Die Gold-Silber-Verhältnispreise können aufgrund von Veränderungen in der Strukture der Nachfrage und der Differenzen in der Geldpolitik zu einer langfristigen Abweichung führen. Die Strategie besteht das Risiko einer kontinuierlichen Verlustentwicklung, insbesondere während der strukturellen Veränderungen des Marktes.

Strategiequellcode
//@version=6
strategy("Stat Arb(xag & xau)")

// ══════════════════════════════════════════════════════════════
// BENCHMARK DATA
// ══════════════════════════════════════════════════════════════
float benchClose = request.security("XAG_USDT.swap", timeframe.period, close)

// ══════════════════════════════════════════════════════════════
// HELPER FUNCTIONS
// ══════════════════════════════════════════════════════════════
f_cov(float src1, float src2, int len) =>
    ta.sma(src1 * src2, len) - ta.sma(src1, len) * ta.sma(src2, len)

f_var(float src, int len) =>
    ta.sma(src * src, len) - math.pow(ta.sma(src, len), 2)

// ══════════════════════════════════════════════════════════════
// SPREAD ENGINE — NORMALIZED RATIO
// ══════════════════════════════════════════════════════════════
int lookback = 20

float pairSma   = ta.sma(close,      lookback)
float benchSma  = ta.sma(benchClose, lookback)
float pairNorm  = pairSma  != 0 ? close      / pairSma  * 100.0 : 100.0
float benchNorm = benchSma != 0 ? benchClose / benchSma * 100.0 : 100.0
float modelRaw  = benchNorm != 0 ? pairNorm / benchNorm : 1.0
float model     = ta.ema(modelRaw, 3)

float zMean  = ta.sma(model, lookback)
float zStd   = ta.stdev(model, lookback)
float zScore = zStd != 0 ? (model - zMean) / zStd : 0.0

// ══════════════════════════════════════════════════════════════
// RSI FILTER — BELOW / ABOVE 50
// ══════════════════════════════════════════════════════════════
float rsiVal    = ta.rsi(close, 14)
bool  rsiLongOk  = rsiVal < 50.0
bool  rsiShortOk = rsiVal > 50.0

// ══════════════════════════════════════════════════════════════
// ENTRY SIGNALS
// Z crosses below -2 = long, above +2 = short
// ══════════════════════════════════════════════════════════════
bool enterLong  = ta.crossunder(zScore, -2.0) and rsiLongOk
bool enterShort = ta.crossover(zScore,   2.0) and rsiShortOk

// ══════════════════════════════════════════════════════════════
// ATR STOP + TAKE PROFIT
// Stop:  8x ATR from entry (hardcoded)
// TP:    3x ATR from entry (hardcoded), stamped at entry
// ══════════════════════════════════════════════════════════════
float atrVal = ta.atr(14)

var float tpLevel   = na
var float slLevel   = na
var float entryPrice = na

bool isNewEntry = strategy.position_size != 0 and strategy.position_size[1] == 0
if isNewEntry
    entryPrice := strategy.position_avg_price
    if strategy.position_size > 0
        tpLevel := entryPrice + atrVal * 3.0
        slLevel := entryPrice - atrVal * 8.0
    else
        tpLevel := entryPrice - atrVal * 3.0
        slLevel := entryPrice + atrVal * 8.0

if strategy.position_size == 0
    tpLevel    := na
    slLevel    := na
    entryPrice := na

// ══════════════════════════════════════════════════════════════
// EXIT CONDITIONS — high/low for intrabar touch
// ══════════════════════════════════════════════════════════════
bool tpHitLong  = strategy.position_size > 0 and not na(tpLevel) and high >= tpLevel
bool tpHitShort = strategy.position_size < 0 and not na(tpLevel) and low  <= tpLevel
bool slHitLong  = strategy.position_size > 0 and not na(slLevel) and low  <  slLevel
bool slHitShort = strategy.position_size < 0 and not na(slLevel) and high >  slLevel

// ══════════════════════════════════════════════════════════════
// EXECUTION
// ══════════════════════════════════════════════════════════════
if enterLong
    strategy.close("Short", comment="Flip")
    strategy.entry("Long",  strategy.long)
if enterShort
    strategy.close("Long",  comment="Flip")
    strategy.entry("Short", strategy.short)

if tpHitLong
    strategy.close("Long",  comment="TP")
if tpHitShort
    strategy.close("Short", comment="TP")
if slHitLong
    strategy.close("Long",  comment="SL")
if slHitShort
    strategy.close("Short", comment="SL")

// ══════════════════════════════════════════════════════════════
// VISUALS
// ══════════════════════════════════════════════════════════════
hline( 2.0, "+2",  color=color.new(color.red,  20), linestyle=hline.style_dashed)
hline(-2.0, "-2",  color=color.new(color.teal, 20), linestyle=hline.style_dashed)
hline( 0.0, "Mid", color=color.gray,                linestyle=hline.style_solid)

color zCol = zScore >= 0 ? color.new(color.red, 10) : color.new(color.teal, 10)
plot(zScore, title="Z Score", color=zCol, linewidth=3)

bgcolor(zScore >  2.0 ? color.new(color.red,  90) : na, title="Overbought Zone")
bgcolor(zScore < -2.0 ? color.new(color.teal, 90) : na, title="Oversold Zone")
bgcolor(strategy.position_size > 0 ? color.new(color.teal, 93) : na, title="In Long")
bgcolor(strategy.position_size < 0 ? color.new(color.red,  93) : na, title="In Short")

plotshape(enterLong,  style=shape.triangleup,   location=location.bottom, color=color.teal, size=size.small)
plotshape(enterShort, style=shape.triangledown, location=location.top,    color=color.red,  size=size.small)
plotshape(tpHitLong or tpHitShort, style=shape.flag,   location=location.top, color=color.yellow, size=size.tiny, text="TP")
plotshape(slHitLong or slHitShort, style=shape.xcross, location=location.top, color=color.orange, size=size.tiny, text="SL")