Strategy · Pine Script v6 · On the chart

XAUUSD Intraday Trend Pullback Strategy

by raybird

A gold pullback strategy for intraday charts.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code139
Settings15inputs
LicenceNone stated
Last update2 months ago15 Aug 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 Intraday Trend Pullback Strategy trades in the direction of a 20 over 50 EMA trend when price dips to the fast EMA and closes back beyond it, with RSI rising in that direction. Filters require a minimum ATR, an ADX of at least 16, a cooldown and the 07:00 to 17:00 session. Stops are ATR based, the target is a risk multiple, and breakeven and trailing stop options are available.

Details

Published by

raybird on GitHub

Type

Strategy, Pine Script v6

Draws

On the price chart

Category

Trend, Sessions & time, Moving averages

Markets

Gold

Timeframes

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
快線 EMA 長度int20emaFastLen
慢線 EMA 長度int50emaSlowLen
RSI 長度int14rsiLen
RSI 做多門檻float50.0rsiLongThreshold
RSI 做空門檻float50.0rsiShortThreshold
ATR 長度int14atrLen
啟用最低波動過濾booltrueuseMinVolFilter
最低 ATR 門檻float1.2minAtrThreshold
止損 ATR 倍數float1.2slAtrMult
獲利盈虧比 (R-Multiple)float2.0tpRrMult
啟用 1R 保本止損booltrueuseBreakeven
啟用 ATR 追蹤止損boolfalseuseTrailingStop
Show all 15 settings
SettingTypeDefaultVariable
追蹤止損 ATR 倍數float1.0trailAtrMult
交易時段 (倫敦 + 紐約)session0700-1700tradeSession
僅在收盤確認後進場booltrueonlyOnCloseConfirm
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

257 stars

Donald - Test Logic Futures is an overlay strategy designed for intraday futures trading. It combines kernel regression functions with exponential moving averages to evaluate price retracements and entry timing. Trades are filtered by session execution windows

Strategy v5 TrendMoving averages Repaints
Updated 6 weeks ago · None stated GitHub repository of Donald - Test Logic Futures

Andean Scalping

by hasnocool
106 stars

Andean Scalping is a Pine Script v5 strategy template designed for backtesting trading signals. It features session and date-range filtering, directional trade toggles for long and short entries, and optional trend filtering tools including higher-timeframe EM

Strategy v5 TrendMoving averages
Updated 2 years ago · GPL-3.0 GitHub repository of Andean Scalping

This strategy plots a 90-period simple moving average from the daily and four-hour charts plus a daily session VWAP on the price chart. It enters long when VWAP is above the daily average and the four-hour VWAP crosses above its average, and short in the oppos

Strategy v5 TrendMoving averages Repaints
Updated 3 years ago · MIT GitHub repository of 1D Bullish Buy 4H Bearish Sell Session
4 stars

This strategy trades directional momentum breakouts for crude oil on the price chart. It enters long or short positions when a fast exponential moving average crosses a slow exponential moving average, provided that current Average True Range exceeds its movin

Strategy v6 TrendMoving averages
Updated 2 months ago · MIT GitHub repository of CL Crude Oil Momentum [trugurpala]

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