OPEN-SOURCE SCRIPT
Strategy 250 XAUUSD - Composite Quality Score

**Strategy 250 XAUUSD – Composite Quality Score v2**
Strategy 250 is a trend-continuation breakout system designed for **XAUUSD on the 1H timeframe**.
The strategy uses a **Composite Quality Score** to evaluate whether a Donchian breakout has enough structural quality to justify an entry. Instead of entering every breakout, it filters signals by combining positive confirmation factors with negative market-structure penalties.
### Core Logic
The strategy looks for breakouts above or below a previous Donchian range:
* **Long entry:** price closes above the previous Donchian High.
* **Short entry:** price closes below the previous Donchian Low.
* The breakout is only accepted if the final quality score is above the minimum threshold.
* EMA200 slope must confirm direction:
* Positive slope for long trades.
* Negative slope for short trades.
### Composite Quality Score
The score is built from two main groups:
### Amplifiers
These are factors that improve the quality of the setup:
1. **EMA200 Slope**
Measures whether the macro trend is aligned with the breakout.
2. **Macro Mid-Bias**
Evaluates where price is located inside a wider historical range.
3. **EMA200 Distance in ATR**
Measures how far price is from the EMA200 using ATR as normalization.
### Penalties
These are factors that reduce the quality of the setup:
1. **Acceptance Penalty**
Penalizes breakouts where price has spent too much time near the breakout zone, reducing the surprise factor.
2. **Sweep Penalty**
Penalizes setups where recent liquidity sweeps suggest poorer breakout quality.
3. **Range Position Penalty**
Penalizes breakouts that originate from a weak position inside the prior range.
### Exits
Positions are closed when:
* Price breaks the opposite Donchian boundary.
* The maximum holding period is reached.
### Recommended Market
* Symbol: **XAUUSD**
* Timeframe: **1H**
* Market type: Gold / CFD / Spot Gold depending on broker feed.
### Optimized Parameters Used
* Donchian Period: `50`
* Macro Bias Period: `600`
* EMA200 Slope Period: `30`
* Acceptance Lookback: `20`
* Sweep Lookback: `20`
* Minimum Quality Score: `0.8`
* Maximum Hold Bars: `80`
### Notes
This strategy is not a simple breakout system. It is designed to avoid low-quality breakouts by penalizing conditions historically associated with weaker performance in XAUUSD.
As always, results may vary depending on broker data, spread, commissions, and execution quality. This script is intended for research, testing, and educational purposes only.
Strategy 250 is a trend-continuation breakout system designed for **XAUUSD on the 1H timeframe**.
The strategy uses a **Composite Quality Score** to evaluate whether a Donchian breakout has enough structural quality to justify an entry. Instead of entering every breakout, it filters signals by combining positive confirmation factors with negative market-structure penalties.
### Core Logic
The strategy looks for breakouts above or below a previous Donchian range:
* **Long entry:** price closes above the previous Donchian High.
* **Short entry:** price closes below the previous Donchian Low.
* The breakout is only accepted if the final quality score is above the minimum threshold.
* EMA200 slope must confirm direction:
* Positive slope for long trades.
* Negative slope for short trades.
### Composite Quality Score
The score is built from two main groups:
### Amplifiers
These are factors that improve the quality of the setup:
1. **EMA200 Slope**
Measures whether the macro trend is aligned with the breakout.
2. **Macro Mid-Bias**
Evaluates where price is located inside a wider historical range.
3. **EMA200 Distance in ATR**
Measures how far price is from the EMA200 using ATR as normalization.
### Penalties
These are factors that reduce the quality of the setup:
1. **Acceptance Penalty**
Penalizes breakouts where price has spent too much time near the breakout zone, reducing the surprise factor.
2. **Sweep Penalty**
Penalizes setups where recent liquidity sweeps suggest poorer breakout quality.
3. **Range Position Penalty**
Penalizes breakouts that originate from a weak position inside the prior range.
### Exits
Positions are closed when:
* Price breaks the opposite Donchian boundary.
* The maximum holding period is reached.
### Recommended Market
* Symbol: **XAUUSD**
* Timeframe: **1H**
* Market type: Gold / CFD / Spot Gold depending on broker feed.
### Optimized Parameters Used
* Donchian Period: `50`
* Macro Bias Period: `600`
* EMA200 Slope Period: `30`
* Acceptance Lookback: `20`
* Sweep Lookback: `20`
* Minimum Quality Score: `0.8`
* Maximum Hold Bars: `80`
### Notes
This strategy is not a simple breakout system. It is designed to avoid low-quality breakouts by penalizing conditions historically associated with weaker performance in XAUUSD.
As always, results may vary depending on broker data, spread, commissions, and execution quality. This script is intended for research, testing, and educational purposes only.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.