Strategy · Pine Script v5 · On the chart

XAUUSD Strategy V4.9.7 - Adaptive Sell + Reclaim Buy

by aeiioaeiio

This Pine Script strategy for XAUUSD combines Exponential Moving Averages (20, 50, and 200), Stochastic, RSI, and ATR indicators to generate trading signals.

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code313
Settings40inputs
LicenceNone stated
Last update4 months ago6 Jun 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above. It reads the file straight from GitHub.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

The code stays on GitHub. The author has not published this script under an open licence, so ForexR does not show its code. Copy script reads the file straight from GitHub into your clipboard, so you can still try it on your own chart. Ask the author before reusing the code anywhere else.

Overview

XAUUSD Strategy V4.9.7 - Adaptive Sell + Reclaim Buy identifies potential buy and sell opportunities using trend alignment, M15 overbought or oversold conditions, rejection wicks, and Fibonacci tolerance zones. Entries are categorized into main confirmation trades and optional scalp trades. Risk management features include swing-based and ATR-buffered stop losses, fixed risk-to-reward take profit targets, and trade blocking filters for wide stop loss distances or ATR volatility spikes. Indicators, signals, and an info dashboard plot directly on the price chart.

Details

Published by

aeiioaeiio on GitHub

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Trend, Oscillators & momentum, Moving averages, Support & resistance

Markets

Gold

Timeframes

M1-M5, M15-H1

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Stoch Periodint5stochLen
Stoch Kint3stochKLen
Stoch Dint3stochDLen
RSI Periodint14rsiLen
EMA Fastint20emaFastLen
EMA Slowint50emaSlowLen
EMA Trendint200emaTrendLen
ATR Periodint14atrLen
Backtest ModestringConfirm Onlymode
Use Closed Bar OnlybooltrueuseConfirmedBar
Enable BUY CONFIRMbooltrueenableBuyConfirm
Enable SELL CONFIRMbooltrueenableSellConfirm
Show all 40 settings
SettingTypeDefaultVariable
Enable LSB SCALPboolfalseenableLsbScalp
Enable LSS SCALPboolfalseenableLssScalp
Show Disabled Scalp Marks for ReviewboolfalseshowDisabledLegs
M15 Sell OB Levelfloat70sellOb
M15 Buy OS Levelfloat30buyOs
M15 Rejection Wick %float0.35wickPct
Require M15 Trigger for ConfirmbooltruerequireM15
Fib Lookbackint50fibLookback
Fib/EMA Zone Tolerance x ATRfloat0.45fibTolAtr
No Chase Distance from EMA20 x ATRfloat1.35noChaseAtr
Confirm TP RRfloat1.5rrConfirm
Scalp TP RRfloat0.8rrScalp
Confirm SL Buffer x ATRfloat0.35slAtrBuf
Scalp SL Buffer x ATRfloat0.12scalpSlAtr
Confirm SL Swing Lookbackint8swingLb
Scalp SL Swing Lookbackint3scalpLb
Show DashboardbooltrueshowDash
Show SignalsbooltrueshowSignals
Show Watch MarksbooltrueshowWatch
Show Key FibbooltrueshowFib
Block Trade if SL too wideboolfalseuseRiskBlock
Max SL Distance (price points)float60.0maxSlPoints
Block Trade during ATR SpikebooltrueuseAtrSpikeBlock
ATR Spike MA Lengthint50atrSpikeLen
Max ATR x Average ATRfloat1.65atrSpikeMult
Use Strict BUY QualitybooltrueuseStrictBuyV495
BUY Min H1 RSIfloat45.0buyRsiMinV495
BUY Require Close > EMA20booltruerequireBuyEma20
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

This strategy overlays the price chart and looks for VWAP pullbacks. It goes long when a short SMA crosses above VWAP after RSI has been oversold within ten bars, and short on the opposite cross after RSI has been overbought. Optional Minervini-style moving-av

Strategy v5 TrendOscillators & momentum
Updated 2 years ago · GPL-3.0 GitHub repository of Advanced VWAP-Momentum Pullback Trend Qualifier

This strategy trades 1-minute futures contracts on Binance. It plots pivot high and low resistance and support levels on the price chart, along with an EMA and a custom Cto indicator. Long and short entries trigger on EMA and Cto crossovers combined with price

Strategy v5 TrendMoving averages Repaints
Updated 2 years ago · None stated GitHub repository of Binancash Futures Strategy 1M Candles

Optimizer v1

by QuantGeekDev
7 stars

This strategy generates long signals on the price chart using multiple technical indicators. It computes EMA 70 and 100, SMA 70, ADX with DMI, CCI, and MACD values. A long entry occurs when EMA crossover condition, SMA condition, ADX above 15, CCI above 30, an

Strategy v5 TrendOscillators & momentum
Updated 3 years ago · None stated GitHub repository of Optimizer v1

This strategy combines MACD momentum signals with support and resistance levels from pivot points and an EMA100 trend filter for long positions. It plots the 100-period EMA on the price chart and signals when price breaks above the EMA or forms bullish pivot p

Strategy v4 TrendOscillators & momentum
Updated 3 years ago · Apache-2.0 GitHub repository of MACD + Support / Resistance Long Strategy

This overlay strategy combines swing price structure with MACD structure and two higher-timeframe exponential moving averages. It finds pivot highs and lows over ten bars, labels higher highs, lower highs, higher lows and lower lows, and builds matching states

Strategy v5 TrendOscillators & momentum Repaints
Updated 5 months ago · None stated GitHub repository of Price Action Candles with MACD Signals Strategy

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers