OPEN-SOURCE SCRIPT

XAUUSD 10-Minute Strategy

This XAUUSD 10-Minute Strategy is designed for trading Gold vs. USD on a 10-minute timeframe. By combining multiple technical indicators (MACD, RSI, Bollinger Bands, and ATR), the strategy effectively captures both trend-following and reversal opportunities, with adaptive risk management for varying market volatility. This approach balances high-probability entries with robust volatility management, making it suitable for traders seeking to optimise entries during significant price movements and reversals.

Key Components and Logic:
MACD (12, 26, 9):
  • Generates buy signals on MACD Line crossovers above the Signal Line and sell signals on crossovers below the Signal Line, helping to capture momentum shifts.

RSI (14):
  • Utilizes oversold (below 35) and overbought (above 65) levels as a secondary filter to validate entries and avoid overextended price zones.

Bollinger Bands (20, 2):
  • Uses upper and lower Bollinger Bands to identify potential overbought and oversold conditions, aiming to enter long trades near the lower band and short trades near the upper band.

ATR-Based Stop Loss and Take Profit:
  • Stop Loss and Take Profit levels are dynamically set as multiples of ATR (3x for stop loss, 5x for take profit), ensuring flexibility with market volatility to optimise exit points.


Entry & Exit Conditions:
Buy Entry: Triggered when any of the following conditions are met:
  • MACD Line crosses above the Signal Line
  • RSI is oversold
  • Price drops below the lower Bollinger Band

Sell Entry: Triggered when any of the following conditions are met:
  • MACD Line crosses below the Signal Line
  • RSI is overbought
  • Price moves above the upper Bollinger Band

Exit Strategy: Trades are closed based on opposing entry signals, with adaptive spread adjustments for realistic exit points.

Backtesting Configuration & Results:
  • Backtesting Period: July 21, 2024, to October 30, 2024
  • Symbol Info: XAUUSD, 10-minute timeframe, OANDA data source
  • Backtesting Capital: Initial capital of $700, with each trade set to 10 contracts (equivalent to approximately 0.1 lots based on the broker’s contract size for gold).


Users should confirm their broker's contract size for gold, as this may differ. This script uses 10 contracts for backtesting purposes, aligned with 0.1 lots on brokers offering a 100-contract specification.

Key Backtesting Performance Metrics:

  • Net Profit: $4,733.90 USD (676.27% increase)
  • Total Closed Trades: 526
  • Win Rate: 53.99%
  • Profit Factor: 1.44 (1.96 for Long trades, 1.14 for Short trades)
  • Max Drawdown: $819.75 USD (56.33% of equity)
  • Sharpe Ratio: 1.726
  • Average Trade: $9.00 USD (0.04% of equity per trade)


This backtest reflects realistic conditions, with a spread adjustment of 38 points and no slippage or commission applied. The settings aim to simulate typical retail trading conditions. However, please adjust the initial capital, contract size, and other settings based on your account specifics for best results.

Usage:
This strategy is tuned specifically for XAUUSD on a 10-minute timeframe, ideal for both trend-following and reversal trades. The ATR-based stop loss and take profit levels adapt dynamically to market volatility, optimising entries and exits in varied conditions. To backtest this script accurately, ensure your broker’s contract specifications for gold align with the parameters used in this strategy.
Average True Range (ATR)Moving Average Convergence / Divergence (MACD)Relative Strength Index (RSI)smuk90XAUUSD

오픈 소스 스크립트

진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.

차트에 이 스크립트를 사용하시겠습니까?

면책사항