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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.