OPEN-SOURCE SCRIPT

XAUUSD Ultra

277
# XAUUSD High-Profit MTF VWAP Breakout + EMAs + Clean TP/SL

## Overview

This is a high-probability, high-reward breakout strategy designed for XAUUSD (Gold/USD) on the M5 chart.
It employs multi-timeframe trend confirmation using the H1 and H4 timeframes, only entering trades in the direction of both higher timeframe trends.
Entries are triggered on strong breakouts relative to the VWAP, and take-profits are set aggressively for maximum reward.

**Features:**
- **Multi-Timeframe Trend Filter:** Only trades when both H1 and H4 trends align (using EMA 20, 34, 100 on each).
- **Entry:** On the M5 chart, a trade is entered when price breaks out above (or below) VWAP and higher timeframe trends agree.
- **Take Profit:** Two aggressive targets, TP1 and TP2, based on multiples of the M5 ATR (default: 1.5x and 3x).
- **Stop Loss:** Set using ATR for volatility-adaptive risk.
- **Visuals:** All major EMAs and VWAP plotted; round number levels for psychological support/resistance.
- **No session filters:** Trades during all sessions, focusing purely on price action and trend.
- **Labels/Lines:** Entry, TP, SL, and profit lines clearly marked on chart.

---

## How It Works

### 1. **Multi-Timeframe Trend Filter**
- On every M5 bar, the indicator checks the trend on both H1 and H4 timeframes.
- **Uptrend:** EMA20 > EMA34 > EMA100 on both H1 and H4.
- **Downtrend:** EMA20 < EMA34 < EMA100 on both H1 and H4.
- **No Trade:** If trends do not align, no trade is taken.

### 2. **Breakout Entry**
- **Long Entry:** Occurs when the M5 close crosses above VWAP, and both H1 and H4 are in uptrend.
- **Short Entry:** Occurs when the M5 close crosses below VWAP, and both H1 and H4 are in downtrend.

### 3. **Stop Loss and Take Profit**
- **Stop Loss:** Set at entry price minus (for long) or plus (for short) ATR × multiplier.
- **TP1:** Entry ± ATR × 1.5 (default).
- **TP2:** Entry ± ATR × 3.0 (default).
- *All levels can be adjusted in the input panel.*

### 4. **Visuals**
- EMAs and VWAP are plotted for clarity.
- Entry, TP, and SL labels and lines are shown on each breakout signal bar.
- Round-number levels plotted for context.

---

## How To Use

1. **Add the Script to Your TradingView Chart**
- Copy and paste the script into a new TradingView Pine Script strategy.
- Add to your XAUUSD chart and select the M5 timeframe.

2. **Configure Settings (Optional)**
- Adjust ATR period, multipliers, and which EMAs/VWAP to display as desired.
- Set your own round number step for psychological levels.

3. **Trade Execution**
- The strategy will automatically identify and mark valid long/short breakouts.
- Entry, stop, and take profits are managed by the strategy logic.
- Use the strategy tester to optimize parameters and review historical performance.

4. **Best Practice**
- Use as a signal generation tool; always confirm with your own risk management.
- Works best when used alongside higher timeframe analysis and during periods of strong trend.

---

## Example Settings

- **Timeframe:** M5 for entries.
- **HTF Trend 1:** H1 (60 minutes).
- **HTF Trend 2:** H4 (240 minutes).
- **ATR Length:** 14 (default).
- **ATR Multiplier (SL):** 1.2.
- **TP1 Multiplier:** 1.5.
- **TP2 Multiplier:** 3.0.

---

## Publishing and Attribution

- You may publish and share this script with the above explanation.
- Please credit the original author and do not remove this README if published.

---

## Disclaimer

This strategy is provided for educational purposes only.
Past performance is not indicative of future results.
Always test any trading system in a demo environment before risking real capital.

Penafian

Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.