Re: Best forex pairs to scalp during london session
Posted: Mon Sep 21, 2026 6:19 pm
The Pine Script (v5)
Code: Select all
//@version=5
indicator("EURGBP Quiet Range Sweeps", overlay=true)
// --- Inputs ---
grp1 = "Range Settings"
length = input.int(20, title="Band Length", group=grp1)
mult = input.float(2.0, title="Band Multiplier", group=grp1)
grp2 = "Volatility Filter (Avoid Breakouts)"
atrLen = input.int(14, title="ATR Length", group=grp2)
volThreshold = input.float(1.0, title="Max Volatility Threshold", tooltip="1.0 = Average Volatility. Lower means quieter market.", step=0.1, group=grp2)
// --- Range Calculation (Bollinger Bands) ---
basis = ta.sma(close, length)
dev = mult * ta.stdev(close, length)
upperBand = basis + dev
lowerBand = basis - dev
// --- Volatility Filter (Normalized ATR) ---
// We compare current ATR to a long-term ATR moving average to detect "quiet" vs "catalyst" regimes
currentAtr = ta.atr(atrLen)
avgAtr = ta.sma(currentAtr, 100)
volatilityRatio = currentAtr / (avgAtr == 0 ? 1 : avgAtr)
// Is the market in a quiet, range-bound state?
isQuiet = volatilityRatio < volThreshold
// --- Liquidity Sweep Logic ---
// Sweep High: Price poked above upper band but closed inside
sweepHigh = high > upperBand and close < upperBand and open < upperBand
// Sweep Low: Price poked below lower band but closed inside
sweepLow = low < lowerBand and close > lowerBand and open > lowerBand
// --- Signals ---
fadeShort = isQuiet and sweepHigh
fadeLong = isQuiet and sweepLow
// --- Plotting ---
// Draw the range
plot(basis, color=color.new(color.gray, 50), title="Mean")
p1 = plot(upperBand, color=color.new(color.blue, 70), title="Upper Range")
p2 = plot(lowerBand, color=color.new(color.blue, 70), title="Lower Range")
fill(p1, p2, color=color.new(color.blue, 95), title="Range Background")
// Draw the signals
plotshape(fadeShort, title="Fade Short", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small, text="FADE")
plotshape(fadeLong, title="Fade Long", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small, text="FADE")
// Alert conditions for scalping
alertcondition(fadeShort, title="EURGBP Short Sweep", message="Bearish liquidity sweep in quiet market conditions.")
alertcondition(fadeLong, title="EURGBP Long Sweep", message="Bullish liquidity sweep in quiet market conditions.")