INVITE-ONLY SCRIPT

Gold Futures Leading Momentum v4

60
Gold Futures Leading Momentum v4 — Strategy Overview
Core Concept
This is a cross-market momentum breakout strategy that uses COMEX Gold Futures (GC1!) signals to trade spot XAUUSD. The key idea is that futures price movements lead spot price movements, so by detecting breakouts and momentum on the futures side, you can enter spot trades with a timing edge.

Signal Generation
Long Entry requires ALL of these simultaneously:

Futures Breakout: GC1! close > highest high of the last 7 bars (configurable)
Positive Momentum: GC1! Rate of Change over 5 bars > 0.2%
Confirmation: GC1! close has been rising for the last 2 consecutive bars
(Optional) MA Filter: spot price > 50-period SMA
Short Entry is the mirror — futures close below lowest low, negative momentum, consecutive declining closes.

Position Management
Up to 10 simultaneous positions (pyramiding), each tracked independently in array slots
Each position is 1 oz ($2,600 notional), with 500x leverage (margin = 0.2%), so each position requires only ~$5.20 margin
Minimum 1-bar interval between entries to prevent over-stacking on a single candle
Exit Logic (per-position, independent)
Each of the 10 slots is evaluated separately every bar:

Trailing Stop (primary exit): Once unrealized profit exceeds 0.5% of entry price, trailing activates. It tracks the peak profit in dollar terms. If profit pulls back 20% from its peak (e.g., peak profit was $100, now it's $80), the position closes.

Fixed Take Profit (disabled by default): Closes at 5% profit from entry.

Fixed Stop Loss (enabled, 2.5%): Closes if price moves 2.5% against the position. Long stop-loss can be optionally disabled (for trend-following mode).

Visual System (color-coded)
Signal Shape Color Location
Long Entry ▲ triangle up Blue #0066FF Below bar
Short Entry ▼ triangle down Red #FF0000 Above bar
Long Profit Exit × xcross Green #00CC00 Above bar
Long Stop Loss × xcross (large) Cyan #00FFFF Above bar
Short Profit Exit × xcross Orange #FF8800 Below bar
Short Stop Loss × xcross (large) Yellow #FFFF00 Below bar
Cool colors (blue/green/cyan) = Long side. Warm colors (red/orange/yellow) = Short side. Larger × = stop loss, normal × = profit exit.

Chart Overlays
Orange line: GC1! futures close price (overlaid on spot chart)
Bright green stepline: Futures highest high level (breakout resistance)
Bright red stepline: Futures lowest low level (breakout support)
Info Table (bottom-left)
Real-time dashboard showing: futures price, momentum direction/%, active positions with individual P&L, trailing status with pullback %, trade restrictions, win rate, and total profit.

Key Design Decisions
Anti-repainting: lookahead=barmerge.lookahead_off on all request.security() calls ensures no future data leaks
$1,000 capital: Works because margin_long=0.2 provides 500x leverage, so 1 oz gold (~$2,600) requires only ~$5.20 margin per position
Independent slot management: Each position has its own trailing peak, entry price, and exit logic — they don't interfere with each other

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน