OPEN-SOURCE SCRIPT
Gold/Spread Algo

XAUUSD 1-Minute RSI Scalping Strategy – Mean-Reversion with Fixed Exits
This open-source strategy is a high-frequency, counter-trend scalping system designed specifically for **XAUUSD (Gold)** on the 1-minute timeframe.
Core Logic
The strategy uses classic RSI(14) to identify short-term overextension:
- Long entry when RSI drops below oversold (default 30) → expects quick snap-back
- Short entry when RSI rises above overbought (default 70) → expects quick pullback
Entries are taken only when flat (no pyramiding). Exits are fixed in pips and set immediately on entry:
- Take Profit: +10 pips (0.10 in XAUUSD price)
- Stop Loss: –5 pips (0.05 in XAUUSD price)
- Built-in Risk:Reward = 1:2
This fixed structure gives the system positive mathematical expectancy even with moderate win rates (≈55–65% before costs), provided gold continues to exhibit frequent mean-reversion behavior on 1-minute charts.
Why this simple approach?
Gold is one of the most volatile and momentum-driven instruments on very short timeframes. Pure RSI extremes often capture quick exhaustion moves after news spikes, order flow imbalances, or session transitions — especially during London/NY overlap. Fixed pip targets prevent over-optimization and mimic real broker execution more closely than dynamic trailing or percentage-based exits.
Important Realism & Backtesting Notes
To produce non-misleading results, use these settings when publishing/testing:
- Initial Capital: $10,000 – $30,000 (realistic retail size)
- Position sizing: fixed 0.10–0.30 lots or 1–3% equity per trade
- Commission: 5–8 USD round-turn per lot (typical ECN/raw-spread)
- Slippage: 3–8 ticks (≈0.03–0.08 in price) — gold spreads widen during volatility
- Minimum dataset: 12–36 months of 1-minute data (aim for 800–2000+ trades)
- Risk per trade: usually 0.5–1.5% with defaults — never exceeds sustainable levels
Results vary significantly:
- Strongest in ranging or mildly trending sessions
- Weaker during strong directional moves or major news (NFP, FOMC, geopolitics)
- Expect drawdowns during trending regimes — this is NOT a trend-following system
Visual & Dashboard Elements
- RSI line + fill (blue/orange background) + overbought/oversold zones
- BUY/SELL triangles at entry points
- Professional top-right dashboard showing:
- Net Profit & Loss
- Total Trades / Win Rate / Profit Factor
- Winning / Losing Trades
- Current RSI value
- Position status (LONG / SHORT / FLAT)
- TP:SL ratio
Alerts
- 🟢 LONG ENTRY – RSI oversold
- 🔴 SHORT ENTRY – RSI overbought
How to Use
1. Apply to XAUUSD 1-minute chart only
2. Use realistic commission/slippage in Strategy Tester
3. Trade primarily during London & New York sessions for best liquidity
4. Avoid major news events or widen stops manually
5. Forward-test on demo for 2–3 months minimum
6. Always size conservatively — never risk more than 1–2% per trade
Publish Recommendation
- Use a clean chart: only this strategy, no extra indicators/drawings
- Show realistic tester results with commission/slippage applied
- Screenshot during active session with visible entry signals + dashboard
Educational tool — open-source for learning and testing. Not financial advice. Gold 1-minute trading is extremely volatile and carries high risk of loss. Trade responsibly.
This open-source strategy is a high-frequency, counter-trend scalping system designed specifically for **XAUUSD (Gold)** on the 1-minute timeframe.
Core Logic
The strategy uses classic RSI(14) to identify short-term overextension:
- Long entry when RSI drops below oversold (default 30) → expects quick snap-back
- Short entry when RSI rises above overbought (default 70) → expects quick pullback
Entries are taken only when flat (no pyramiding). Exits are fixed in pips and set immediately on entry:
- Take Profit: +10 pips (0.10 in XAUUSD price)
- Stop Loss: –5 pips (0.05 in XAUUSD price)
- Built-in Risk:Reward = 1:2
This fixed structure gives the system positive mathematical expectancy even with moderate win rates (≈55–65% before costs), provided gold continues to exhibit frequent mean-reversion behavior on 1-minute charts.
Why this simple approach?
Gold is one of the most volatile and momentum-driven instruments on very short timeframes. Pure RSI extremes often capture quick exhaustion moves after news spikes, order flow imbalances, or session transitions — especially during London/NY overlap. Fixed pip targets prevent over-optimization and mimic real broker execution more closely than dynamic trailing or percentage-based exits.
Important Realism & Backtesting Notes
To produce non-misleading results, use these settings when publishing/testing:
- Initial Capital: $10,000 – $30,000 (realistic retail size)
- Position sizing: fixed 0.10–0.30 lots or 1–3% equity per trade
- Commission: 5–8 USD round-turn per lot (typical ECN/raw-spread)
- Slippage: 3–8 ticks (≈0.03–0.08 in price) — gold spreads widen during volatility
- Minimum dataset: 12–36 months of 1-minute data (aim for 800–2000+ trades)
- Risk per trade: usually 0.5–1.5% with defaults — never exceeds sustainable levels
Results vary significantly:
- Strongest in ranging or mildly trending sessions
- Weaker during strong directional moves or major news (NFP, FOMC, geopolitics)
- Expect drawdowns during trending regimes — this is NOT a trend-following system
Visual & Dashboard Elements
- RSI line + fill (blue/orange background) + overbought/oversold zones
- BUY/SELL triangles at entry points
- Professional top-right dashboard showing:
- Net Profit & Loss
- Total Trades / Win Rate / Profit Factor
- Winning / Losing Trades
- Current RSI value
- Position status (LONG / SHORT / FLAT)
- TP:SL ratio
Alerts
- 🟢 LONG ENTRY – RSI oversold
- 🔴 SHORT ENTRY – RSI overbought
How to Use
1. Apply to XAUUSD 1-minute chart only
2. Use realistic commission/slippage in Strategy Tester
3. Trade primarily during London & New York sessions for best liquidity
4. Avoid major news events or widen stops manually
5. Forward-test on demo for 2–3 months minimum
6. Always size conservatively — never risk more than 1–2% per trade
Publish Recommendation
- Use a clean chart: only this strategy, no extra indicators/drawings
- Show realistic tester results with commission/slippage applied
- Screenshot during active session with visible entry signals + dashboard
Educational tool — open-source for learning and testing. Not financial advice. Gold 1-minute trading is extremely volatile and carries high risk of loss. Trade responsibly.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.