Strategy · Pine Script v6 · On the chart

XAUUSD-Asia Reversion Strategy

by riegodavid-git

A gold strategy built on fractal sweeps, fair value gaps and a short-period RSI.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code401
Settings25inputs
LicenceNone statedfile: MPL-2.0
Last update4 months ago25 Jun 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  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

401 lines of Pine Script v6 from pinescript/strategies/xauusd_asia_reversion.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

xauusd_asia_reversion.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/

//@version=6
strategy("XAUUSD-Asia Reversion", shorttitle="XAUUSD-AR", overlay=true, max_boxes_count=500, max_lines_count=500, format=format.price, precision=2, pyramiding=0, calc_on_every_tick=false, initial_capital=10000, default_qty_type=strategy.percent_of_equity, default_qty_value=10)

// ═══════════════════════════════════════════════════════════════════════════════
// RSI INPUTS
// ═══════════════════════════════════════════════════════════════════════════════
rsiLen = input.int(7, "RSI Length", minval=1, tooltip="Set 7 for 1-minute charts", group="RSI")

// ═══════════════════════════════════════════════════════════════════════════════
// FSI — FRACTAL SWEEP INPUTS
// ═══════════════════════════════════════════════════════════════════════════════
leftBars  = input.int(2, "Left Bars",         minval=1,                                                        group="FSI — Fractal Sweep")
rightBars = input.int(2, "Right Bars",        minval=1,                                                        group="FSI — Fractal Sweep")
lookback  = input.int(5, "Fractals to Track", minval=1, tooltip="How many past fractals to check for sweeps", group="FSI — Fractal Sweep")

// ═══════════════════════════════════════════════════════════════════════════════
// FSI — FVG INPUTS
// ═══════════════════════════════════════════════════════════════════════════════
fvgExt      = input.int  (0,                        "Extend FVGs",       group="FSI — FVG Settings")
upcolor     = input.color(color.new(color.teal, 50), "Bullish FVG Color", group="FSI — FVG Style")
downcolor   = input.color(color.new(color.red,  50), "Bearish FVG Color", group="FSI — FVG Style")
fvgVolFilt  = input.bool (false, "Volume Filter", group="FSI — FVG Filters")
fvgAtrFilt  = input.bool (false, "ATR Filter",    group="FSI — FVG Filters")
fvgTrndFilt = input.bool (false, "Trend Filter",  group="FSI — FVG Filters")

// ═══════════════════════════════════════════════════════════════════════════════
// STRATEGY INPUTS
// ═══════════════════════════════════════════════════════════════════════════════
oeTimer     = input.int  (10,  "Overextension Timer (bars)",   minval=1,             group="Strategy")
rsiOB       = input.int  (75,  "RSI Overbought (short gate)",  minval=50, maxval=100, group="Strategy")
rsiOS       = input.int  (25,  "RSI Oversold (long gate)",     minval=0,  maxval=50,  group="Strategy")
atrStopMult = input.float(0.5, "Stop ATR×",                    minval=0.0, step=0.1,  group="Strategy")
nBarsCancel = input.int  (10,  "Cancel unfilled limit after N bars", minval=1,        group="Strategy")
tpMode      = input.string("VWAP", "Take-Profit Target", options=["VWAP", "1:1 RR"],  group="Strategy", tooltip="VWAP = exit at the anchored VWAP line; 1:1 RR = fixed target the same distance as the initial stop")

// ═══════════════════════════════════════════════════════════════════════════════
// STOP-LOSS INPUTS  (TSL ATR logic — choose Hard or Trail)
// ═══════════════════════════════════════════════════════════════════════════════
stopMode      = input.string("Hard",       "Stop Mode",     options=["Hard", "Trail"],                group="Stop Loss")
exitType      = input.string("Wick",       "Stop Trigger",  options=["Wick", "Close"],                group="Stop Loss")
trailSource   = input.string("Lows/Highs", "Trail Source",  options=["Lows/Highs", "Close", "Open"],  group="Stop Loss")
trailMethod   = input.string("ATR",        "Trail Method",  options=["ATR", "Percent"],               group="Stop Loss")
trailPercent  = input.float (10.0,         "Trail Percent", minval=0.1, step=0.1,                      group="Stop Loss")
swingLookback = input.int   (7,            "Trail Lookback (swing bars)", minval=1,                    group="Stop Loss")


// ═══════════════════════════════════════════════════════════════════════════════
// SESSION WINDOWS  (PHT = Asia/Manila, UTC+8, no DST)
//   Each enabled session re-anchors VWAP 5 min after its open; the trading window
//   opens 1.5h after the open and runs to the session close.
//     Asia     : 6:00am  →  anchor 6:05am,  trade 7:30am–10:30am
//     London   : 12:00pm →  anchor 12:05pm, trade 1:30pm–4:30pm
//     New York : 6:00pm  →  anchor 6:05pm,  trade 7:30pm–10:30pm
// ═══════════════════════════════════════════════════════════════════════════════
useAsia   = input.bool(true, "Asia (6:00am–10:30am)",     group="Sessions")
useLondon = input.bool(true, "London (12:00pm–4:30pm)",   group="Sessions")
useNY     = input.bool(true, "New York (6:00pm–10:30pm)", group="Sessions")

h = hour(time, "Asia/Manila")
m = minute(time, "Asia/Manila")

// trading windows — open 1.5h after each session open, close at session end
inAsiaTrade   = (h == 7  and m >= 30) or h == 8  or h == 9  or (h == 10 and m < 30)
inLondonTrade = (h == 13 and m >= 30) or h == 14 or h == 15 or (h == 16 and m < 30)
inNYTrade     = (h == 19 and m >= 30) or h == 20 or h == 21 or (h == 22 and m < 30)
inTradingWindow = (useAsia and inAsiaTrade) or (useLondon and inLondonTrade) or (useNY and inNYTrade)

// ═══════════════════════════════════════════════════════════════════════════════
// RSI LOGIC
// ═══════════════════════════════════════════════════════════════════════════════
rsi = ta.rsi(close, rsiLen)

// ═══════════════════════════════════════════════════════════════════════════════
// ANCHORED VWAP LOGIC (re-anchors 5 min after each enabled session's open)
// ═══════════════════════════════════════════════════════════════════════════════
// vwap windows — from anchor (open + 5 min) to session close
inAsiaVwap   = (h == 6  and m >= 5) or h == 7  or h == 8  or h == 9  or (h == 10 and m < 30)
inLondonVwap = (h == 12 and m >= 5) or h == 13 or h == 14 or h == 15 or (h == 16 and m < 30)
inNYVwap     = (h == 18 and m >= 5) or h == 19 or h == 20 or h == 21 or (h == 22 and m < 30)
inVwapWindow = (useAsia and inAsiaVwap) or (useLondon and inLondonVwap) or (useNY and inNYVwap)

// anchors — first bar at/after each session open + 5 min
isAsiaAnchor   = h == 6  and m >= 5 and (h[1] < 6  or (h[1] == 6  and m[1] < 5))
isLondonAnchor = h == 12 and m >= 5 and (h[1] < 12 or (h[1] == 12 and m[1] < 5))
isNYAnchor     = h == 18 and m >= 5 and (h[1] < 18 or (h[1] == 18 and m[1] < 5))
isVwapAnchor = (useAsia and isAsiaAnchor) or (useLondon and isLondonAnchor) or (useNY and isNYAnchor)

var float vwap_pv  = 0.0
var float vwap_pv2 = 0.0
var float vwap_v   = 0.0

if isVwapAnchor
    vwap_pv  := hlc3 * volume
    vwap_pv2 := hlc3 * hlc3 * volume
    vwap_v   := volume
else if inVwapWindow
    vwap_pv  += hlc3 * volume
    vwap_pv2 += hlc3 * hlc3 * volume
    vwap_v   += volume

avwap    = inVwapWindow and vwap_v > 0 ? vwap_pv / vwap_v : na
avwapStd = inVwapWindow and vwap_v > 0 ? math.sqrt(math.max(vwap_pv2 / vwap_v - avwap * avwap, 0)) : na

// ═══════════════════════════════════════════════════════════════════════════════
// FSI — FRACTAL SWEEP LOGIC
// ═══════════════════════════════════════════════════════════════════════════════
fractHigh = ta.pivothigh(high, leftBars, rightBars)
fractLow  = ta.pivotlow(low, leftBars, rightBars)

var highsArr   = array.new_float()
var highsIdx   = array.new_int()
var highsSwept = array.new_bool()
var lowsArr    = array.new_float()
var lowsIdx    = array.new_int()
var lowsSwept  = array.new_bool()

if not na(fractHigh)
    array.unshift(highsArr, fractHigh)
    array.unshift(highsIdx, bar_index - rightBars)
    array.unshift(highsSwept, false)
    if array.size(highsArr) > lookback
        array.pop(highsArr)
        array.pop(highsIdx)
        array.pop(highsSwept)

if not na(fractLow)
    array.unshift(lowsArr, fractLow)
    array.unshift(lowsIdx, bar_index - rightBars)
    array.unshift(lowsSwept, false)
    if array.size(lowsArr) > lookback
        array.pop(lowsArr)
        array.pop(lowsIdx)
        array.pop(lowsSwept)

if array.size(highsArr) > 0
    for i = 0 to array.size(highsArr) - 1
        val   = array.get(highsArr, i)
        idx   = array.get(highsIdx, i)
        swept = array.get(highsSwept, i)
        if not swept and high > val
            line.new(x1=idx, y1=val, x2=bar_index, y2=val, color=color.rgb(0, 0, 0), style=line.style_dotted, width=1, extend=extend.none)
            alert("Sweep Detected", alert.freq_once_per_bar_close)
            array.set(highsSwept, i, true)

if array.size(lowsArr) > 0
    for i = 0 to array.size(lowsArr) - 1
        val   = array.get(lowsArr, i)
        idx   = array.get(lowsIdx, i)
        swept = array.get(lowsSwept, i)
        if not swept and low < val
            line.new(x1=idx, y1=val, x2=bar_index, y2=val, color=color.rgb(0, 0, 0), style=line.style_dotted, width=1, extend=extend.none)
            alert("Sweep Detected", alert.freq_once_per_bar_close)
            array.set(lowsSwept, i, true)

// ═══════════════════════════════════════════════════════════════════════════════
// FSI — FVG LOGIC
// ═══════════════════════════════════════════════════════════════════════════════
var float recentBullFVG_Low  = na
var float recentBearFVG_High = na
var int   bullFVG_start      = na
var int   bearFVG_start      = na
var bool  bullUsed           = false
var bool  bearUsed           = false

f_fvg() =>
    volfilt  = fvgVolFilt  ? volume[1] > ta.sma(volume, 9) * 1.5 : true
    fvg_atr  = ta.atr(20) / 1.5
    atrfilt  = fvgAtrFilt  ? ((low - high[2] > fvg_atr) or (low[2] - high > fvg_atr)) : true
    loc      = ta.sma(close, 54)
    loc2     = loc > loc[1]
    locfiltb = fvgTrndFilt ? loc2       : true
    locfilts = fvgTrndFilt ? not loc2   : true
    bfvg     = low > high[2] and volfilt and atrfilt and locfiltb
    sfvg     = high < low[2] and volfilt and atrfilt and locfilts
    [bfvg, sfvg]

f_fvgcontrol(_tf) => request.security(syminfo.tickerid, _tf, f_fvg())
[bfvg1m, sfvg1m] = f_fvgcontrol("1")

if barstate.isconfirmed and bfvg1m
    recentBullFVG_Low := high[2]
    bullFVG_start     := bar_index
    box.new(left=bar_index-2, top=low, right=bar_index+fvgExt, bottom=high[2], border_color=color.new(color.gray, 100), bgcolor=color.new(upcolor, 90))
    bullUsed := false

if barstate.isconfirmed and sfvg1m
    recentBearFVG_High := low[2]
    bearFVG_start      := bar_index
    box.new(left=bar_index-2, top=high, right=bar_index+fvgExt, bottom=low[2], border_color=color.new(color.gray, 100), bgcolor=color.new(downcolor, 90))
    bearUsed := false

// Only FSI signals reverting toward AVWAP: red (sell) when price above AVWAP, green (buy) when price below
candleUnderBullFVG = barstate.isconfirmed and inTradingWindow and not na(recentBullFVG_Low)  and close < recentBullFVG_Low  and not bullUsed and not na(avwap) and close > avwap
candleOverBearFVG  = barstate.isconfirmed and inTradingWindow and not na(recentBearFVG_High) and close > recentBearFVG_High and not bearUsed and not na(avwap) and close < avwap

if candleUnderBullFVG
    bullUsed := true
    alert("Sell Signal", alert.freq_once_per_bar_close)
    line.new(x1=bullFVG_start, y1=recentBullFVG_Low, x2=bar_index, y2=recentBullFVG_Low, extend=extend.none, color=color.red, style=line.style_solid, width=1)

if candleOverBearFVG
    bearUsed := true
    alert("Buy Signal", alert.freq_once_per_bar_close)
    line.new(x1=bearFVG_start, y1=recentBearFVG_High, x2=bar_index, y2=recentBearFVG_High, extend=extend.none, color=color.orange, style=line.style_solid, width=1)


// ═══════════════════════════════════════════════════════════════════════════════
// RSI OVEREXTENSION CANDLE COLORING (orange → red as RSI stretches from 50)
// ═══════════════════════════════════════════════════════════════════════════════
rsi_dist  = math.abs(rsi - 50)
rsi_color = rsi_dist < 25 ? na : color.from_gradient(rsi_dist, 25, 50, color.orange, color.red)
oeActive  = inTradingWindow and not na(rsi_color)
barcolor(oeActive ? rsi_color : na, title="RSI Overextension")
plotcandle(oeActive ? open : na, oeActive ? high : na, oeActive ? low : na, oeActive ? close : na, title="RSI OE Candles", color=rsi_color, wickcolor=rsi_color, bordercolor=rsi_color)

// ═══════════════════════════════════════════════════════════════════════════════
// ANCHORED VWAP PLOTS
// ═══════════════════════════════════════════════════════════════════════════════
borderHalf = ta.atr(14) * 1 / 2

avwap2u = na(avwapStd) ? na : avwap + avwapStd * 2
avwap2l = na(avwapStd) ? na : avwap - avwapStd * 2
avwap3u = na(avwapStd) ? na : avwap + avwapStd * 3
avwap3l = na(avwapStd) ? na : avwap - avwapStd * 3

pAvwap  = plot(avwap,   title="AVWAP (session)", color=color.new(color.white, 50),  linewidth=1, style=plot.style_linebr)
p2u     = plot(avwap2u, title="AVWAP +2σ",      color=color.new(color.orange, 50), linewidth=1, style=plot.style_linebr)
p2l     = plot(avwap2l, title="AVWAP -2σ",      color=color.new(color.orange, 50), linewidth=1, style=plot.style_linebr)
p3u     = plot(avwap3u, title="AVWAP +3σ",      color=color.new(color.red, 50),    linewidth=1, style=plot.style_linebr)
p3l     = plot(avwap3l, title="AVWAP -3σ",      color=color.new(color.red, 50),    linewidth=1, style=plot.style_linebr)

// Transparent border (thickness = 1.5×ATR) around each line via offset edge plots + fill
pAvwapU = plot(avwap   + borderHalf, title="AVWAP border+", color=na, display=display.none)
pAvwapD = plot(avwap   - borderHalf, title="AVWAP border-", color=na, display=display.none)
p2uU    = plot(avwap2u + borderHalf, title="+2σ border+",   color=na, display=display.none)
p2uD    = plot(avwap2u - borderHalf, title="+2σ border-",   color=na, display=display.none)
p2lU    = plot(avwap2l + borderHalf, title="-2σ border+",   color=na, display=display.none)
p2lD    = plot(avwap2l - borderHalf, title="-2σ border-",   color=na, display=display.none)
p3uU    = plot(avwap3u + borderHalf, title="+3σ border+",   color=na, display=display.none)
p3uD    = plot(avwap3u - borderHalf, title="+3σ border-",   color=na, display=display.none)
p3lU    = plot(avwap3l + borderHalf, title="-3σ border+",   color=na, display=display.none)
p3lD    = plot(avwap3l - borderHalf, title="-3σ border-",   color=na, display=display.none)

fill(pAvwapU, pAvwapD, color=color.new(color.white, 90),  title="AVWAP border")
fill(p2uU,    p2uD,    color=color.new(color.orange, 90), title="+2σ border")
fill(p2lU,    p2lD,    color=color.new(color.orange, 90), title="-2σ border")
fill(p3uU,    p3uD,    color=color.new(color.red, 90),    title="+3σ border")
fill(p3lU,    p3lD,    color=color.new(color.red, 90),    title="-3σ border")

// ═══════════════════════════════════════════════════════════════════════════════
// STRATEGY GATE  —  STEP 1  (directional overextension + band touch → can_trade)
// ═══════════════════════════════════════════════════════════════════════════════
// Overextended candles via RSI, only inside the trading window
overUp = inTradingWindow and rsi >= rsiOB     // overbought → short side
overDn = inTradingWindow and rsi <= rsiOS     // oversold   → long side

// timer = bars since the last overextended candle; episode stays alive while ≤ oeTimer
bsUp = ta.barssince(overUp)
bsDn = ta.barssince(overDn)
overextendingShort = not na(bsUp) and bsUp <= oeTimer
overextendingLong  = not na(bsDn) and bsDn <= oeTimer

// the episode must touch a 2σ/3σ band at least once (latches until the episode ends)
var bool touchedUp = false
var bool touchedDn = false
if not overextendingShort
    touchedUp := false
if not overextendingLong
    touchedDn := false
// touch = an overextended bar's WICK reaches the 2σ band OR its border zone (covers 3σ too)
if overUp and not na(avwap2u) and high > avwap2u - borderHalf
    touchedUp := true
if overDn and not na(avwap2l) and low < avwap2l + borderHalf
    touchedDn := true

canTradeShort = overextendingShort and touchedUp
canTradeLong  = overextendingLong  and touchedDn

// ═══════════════════════════════════════════════════════════════════════════════
// STRATEGY ENGINE  —  STEP 2  (FSI = FVG revert signal → limit entry, vwap TP, swing-based stop)
// ═══════════════════════════════════════════════════════════════════════════════
atr14   = ta.atr(14)
swHighN = ta.highest(high, swingLookback)   // last swing high (same basis as the trail)
swLowN  = ta.lowest(low,  swingLookback)    // last swing low

var int   mgdDir    = 0        // 0 flat/idle, 1 long, -1 short
var float mgdEntry  = na
var float mgdStop   = na
var int   mgdBar    = na
var bool  mgdFilled = false
var line  lnEntry   = na
var line  lnStop    = na
var float prevPos   = 0.0
var float trailPrice = na      // live trailing stop (TSL ATR)
var float liveStop   = na      // effective stop currently in force (for plotting)

sellFSI = candleUnderBullFVG and canTradeShort and not na(recentBullFVG_Low)
buyFSI  = candleOverBearFVG  and canTradeLong  and not na(recentBearFVG_High)

// ── place a new managed trade (only while flat & idle) ──
if mgdDir == 0 and strategy.position_size == 0
    if sellFSI
        eP = recentBullFVG_Low
        sP = swHighN + atr14 * atrStopMult
        if sP > eP
            mgdDir    := -1
            mgdEntry  := eP
            mgdStop   := sP
            mgdBar    := bar_index
            mgdFilled := false
            trailPrice := sP
            strategy.entry("Short", strategy.short, limit=eP)
            lnEntry := line.new(bar_index, eP, bar_index, eP, color=color.red, style=line.style_solid,  width=2)
            lnStop  := line.new(bar_index, sP, bar_index, sP, color=color.red, style=line.style_dashed, width=1)
    else if buyFSI
        eP = recentBearFVG_High
        sP = swLowN - atr14 * atrStopMult
        if sP < eP
            mgdDir    := 1
            mgdEntry  := eP
            mgdStop   := sP
            mgdBar    := bar_index
            mgdFilled := false
            trailPrice := sP
            strategy.entry("Long", strategy.long, limit=eP)
            lnEntry := line.new(bar_index, eP, bar_index, eP, color=color.green, style=line.style_solid,  width=2)
            lnStop  := line.new(bar_index, sP, bar_index, sP, color=color.red,   style=line.style_dashed, width=1)

// ── manage the live trade ──
if mgdDir != 0
    filledNow = not mgdFilled and strategy.position_size != 0
    if filledNow
        mgdFilled := true

    // ── update the trailing stop (TSL ATR logic) — only tightens, never loosens ──
    if mgdFilled and stopMode == "Trail"
        atrValue = atr14 * atrStopMult
        float nextTrail = na
        if trailMethod == "ATR"
            nextTrail := switch trailSource
                "Close" => mgdDir == 1 ? close - atrValue : close + atrValue
                "Open"  => mgdDir == 1 ? open  - atrValue : open  + atrValue
                => mgdDir == 1 ? swLowN - atrValue : swHighN + atrValue
        else
            float pm = mgdDir == 1 ? (100 - trailPercent) / 100 : (100 + trailPercent) / 100
            nextTrail := switch trailSource
                "Close" => close * pm
                "Open"  => open  * pm
                => mgdDir == 1 ? swLowN * pm : swHighN * pm
        if barstate.isconfirmed and not na(nextTrail)
            if (na(trailPrice) or nextTrail > trailPrice) and mgdDir == 1
                trailPrice := nextTrail
            if (na(trailPrice) or nextTrail < trailPrice) and mgdDir == -1
                trailPrice := nextTrail

    // effective stop in force: trailing price or fixed fractal stop
    float stopPx = stopMode == "Trail" ? trailPrice : mgdStop
    liveStop := mgdFilled ? stopPx : na

    if not na(lnEntry)
        line.set_x2(lnEntry, bar_index)
    // dashed stop line plots only while the limit is pending; once filled, the solid
    // live-stop plot takes over, so the dashed line stops extending
    if not na(lnStop) and (not mgdFilled or filledNow)
        line.set_x2(lnStop, bar_index)

    if mgdFilled
        eid = mgdDir == 1 ? "Long" : "Short"
        // TP target: VWAP line, or a fixed 1:1 (entry reflected across the initial stop)
        tp  = tpMode == "1:1 RR" ? 2 * mgdEntry - mgdStop : (na(avwap) ? na : avwap)
        if exitType == "Wick"
            strategy.exit("X", from_entry=eid, stop=stopPx, limit=tp)
        else
            strategy.exit("X", from_entry=eid, stop=na, limit=tp)
            if not na(stopPx) and ((mgdDir == 1 and close < stopPx) or (mgdDir == -1 and close > stopPx))
                strategy.close(eid, comment="Stop close")
        // VWAP-border market exit only applies when the target IS the VWAP
        if tpMode == "VWAP"
            borderHit = mgdDir == 1 ? (close >= avwap - borderHalf) : (close <= avwap + borderHalf)
            if not na(avwap) and borderHit
                strategy.close(eid, comment="VWAP border")

    if not mgdFilled and bar_index - mgdBar >= nBarsCancel
        strategy.cancel(mgdDir == 1 ? "Long" : "Short")
        mgdDir := 0

    if not inTradingWindow
        strategy.cancel("Long")
        strategy.cancel("Short")
        strategy.close_all(comment="Window close")
        mgdDir := 0

    if mgdFilled and strategy.position_size == 0 and prevPos != 0
        mgdDir := 0

prevPos := strategy.position_size

// Live stop in force (trailing or hard) — stepped, breaks when flat
plot(strategy.position_size != 0 ? liveStop : na, title="Stop (live)", color=color.red, linewidth=1, style=plot.style_linebr)

Overview

XAUUSD-Asia Reversion Strategy fades extended moves, using RSI overbought and oversold gates and an overextension timer, and places limit orders that cancel after a set number of bars. The stop is ATR-based and can be hard or trailing, triggered by a wick or a close, and the take profit can target VWAP. Trading can be limited to Asia, London and New York windows. Position size is a percentage of equity with no pyramiding.

Details

Published by

riegodavid-git on GitHub

Draws

On the price chart

Markets

Gold

Timeframes

M1-M5

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
RSI Lengthint7rsiLen
Left Barsint2leftBars
Right Barsint2rightBars
Fractals to Trackint5lookback
Extend FVGsint0fvgExt
Bullish FVG Colorcolorcolor.new(color.teal, 50)upcolor
Bearish FVG Colorcolorcolor.new(color.red, 50)downcolor
Volume FilterboolfalsefvgVolFilt
ATR FilterboolfalsefvgAtrFilt
Trend FilterboolfalsefvgTrndFilt
Overextension Timer (bars)int10oeTimer
RSI Overbought (short gate)int75rsiOB
Show all 25 settings
SettingTypeDefaultVariable
RSI Oversold (long gate)int25rsiOS
Stop ATR×float0.5atrStopMult
Cancel unfilled limit after N barsint10nBarsCancel
Take-Profit TargetstringVWAPtpMode
Stop ModestringHardstopMode
Stop TriggerstringWickexitType
Trail SourcestringLows/HighstrailSource
Trail MethodstringATRtrailMethod
Trail Percentfloat10.0trailPercent
Trail Lookback (swing bars)int7swingLookback
Asia (6:00am–10:30am)booltrueuseAsia
London (12:00pm–4:30pm)booltrueuseLondon
New York (6:00pm–10:30pm)booltrueuseNY
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

2 stars

This strategy fades liquidity sweeps of confirmed swing highs and lows. It enters a reversal only after price sweeps a prior swing and closes back inside the range. The stop sits an ATR multiple beyond the sweep wick, the target is a fixed reward-to-risk multi

Strategy v6 SMC / ICT / price actionMean reversion
Updated 2 months ago · Custom licence GitHub repository of Liquidity Sweep Reversal [Vantrade]

TnS_IctCombo_V6

by raybird
1 stars

This Pine Script strategy identifies high-confluence trading opportunities using ICT and SMC logic. It calculates a confluence score from HTF bias via EMA, FVG detection with lookback, liquidity sweep confirmation, market structure shift breaks, premium discou

Strategy v6 SMC / ICT / price actionTrend Repaints
Updated 2 months ago · None stated GitHub repository of TnS_IctCombo_V6

Try Trading Future

by dearvn
257 stars

This futures trading strategy combines Fair Value Gap (FVG) detection filtered by Average True Range (ATR) with multi-timeframe Exponential Moving Averages (8, 55, and 165 lengths). It identifies entry setups during a defined intraday trading session window wh

Strategy v5 SMC / ICT / price actionMoving averages Repaints
Updated 6 weeks ago · None stated GitHub repository of Try Trading Future

Daily Bias + FVG Strategy

by TradersPost
228 stars

This overlay strategy plots previous-day high and low, the daily open, and fair value gap zones on the price chart. It takes entries on a selectable timeframe when the FVG requirement and an optional session window allow them, then uses an ATR or fixed pip sto

Strategy v6 SMC / ICT / price actionSupport & resistance Repaints
Updated 3 months ago · None stated GitHub repository of Daily Bias + FVG Strategy

3C QFL Mean Reversal

by hasnocool
106 stars

3C QFL Mean Reversal is a strategy based on the Quickfinger Luc (QFL) trading methodology. It identifies breakdown buying opportunities below established price base levels and enters mean-reversion trades. The strategy includes multi-safety order DCA scaling,

Strategy v5 Mean reversionSupport & resistance Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of 3C QFL Mean Reversal
43 stars

Donald - AI Futures is a price-chart strategy that estimates inner and outer high-low zones and a smoothed close with rational quadratic kernel regression. It builds bullish and bearish momentum signals, optionally compares volume with a volume-weighted moving

Strategy v5 Oscillators & momentumSMC / ICT / price action Repaints
Updated 2 years ago · None stated GitHub repository of Donald - AI Futures

More Mean reversion scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers