The London Breakout strategy is a session-based framework that defines a price range during the quieter hours before the London FX session opens, then watches for a break above or below that range as London liquidity arrives. Traders use it to structure a possible entry around a specific time window rather than reacting to price all day. It is an educational framework only — it is not predictive, behavior varies by instrument and period, and trading carries a real risk of loss.
The idea rests on a simple observation about the trading clock: the hours before London opens (roughly the late Asian session) are often calmer and trade in a tighter range, while the London open tends to bring an increase in volume and volatility. The strategy formalizes this by marking the high and low of a chosen pre-London window — for example, a fixed block of hours ending at the London open. Those two levels become the "breakout box." Once the session starts, a candle that closes beyond the box high is read as a potential upside breakout, and one that closes below the box low as a potential downside breakout. Traders typically combine the level break with a filter (such as a minimum or maximum box width, or a volatility check) to skip boxes that are unusually wide or narrow. Everything here is about defining rules clearly and testing them — the time-of-day pattern is a tendency, not a guarantee, and breakouts can and do fail.
//@version=6
strategy("London Breakout (Educational)", overlay=true, calc_on_every_tick=false)
// --- Inputs ---
boxStartHour = input.int(0, "Pre-London box start hour (exchange tz)", minval=0, maxval=23)
boxEndHour = input.int(7, "Box end / London open hour (exchange tz)", minval=0, maxval=23)
sessionEnd = input.int(16, "Flatten after this hour (exchange tz)", minval=0, maxval=23)
rrTarget = input.float(1.5, "Target as multiple of box width", minval=0.1)
// --- Identify the pre-London window using the chart's exchange time ---
inBox = (hour >= boxStartHour) and (hour < boxEndHour)
// Persist the box high/low and per-box state across the day
var float boxHigh = na
var float boxLow = na
var bool boxDone = false
var bool traded = false
// Reset and start a fresh box at the first bar of the window
if inBox and not inBox[1]
boxHigh := high
boxLow := low
boxDone := false
traded := false
// Extend the box while inside the window
if inBox
boxHigh := math.max(nz(boxHigh, high), high)
boxLow := math.min(nz(boxLow, low), low)
// Mark the box complete on the first bar after the window ends
if not inBox and inBox[1]
boxDone := true
// --- Trading window: after the box is set, before the flatten time ---
afterOpen = boxDone and (hour < sessionEnd)
boxWidth = boxHigh - boxLow
// Entry conditions: a confirmed close beyond the box edge during the trading window
longSignal = afterOpen and not na(boxHigh) and close > boxHigh
shortSignal = afterOpen and not na(boxLow) and close < boxLow
// Only the first valid break of each box may trigger
if longSignal and not traded and strategy.position_size == 0
traded := true
strategy.entry("Long", strategy.long)
strategy.exit("Long X", from_entry="Long", stop=boxLow, limit=close + boxWidth * rrTarget)
if shortSignal and not traded and strategy.position_size == 0
traded := true
strategy.entry("Short", strategy.short)
strategy.exit("Short X", from_entry="Short", stop=boxHigh, limit=close - boxWidth * rrTarget)
// Time-based flatten at the end of the session
if hour >= sessionEnd and strategy.position_size != 0
strategy.close_all(comment="Session end")
// --- Visualize the box edges ---
plot(boxDone ? boxHigh : na, "Box High", color=color.teal, style=plot.style_linebr)
plot(boxDone ? boxLow : na, "Box Low", color=color.maroon, style=plot.style_linebr)The London FX session opens around 08:00 London time, so a common reference window is the few quieter hours before that (the late Asian session). The exact hours on your chart depend on your exchange/broker timezone and on daylight-saving changes, so confirm them rather than assuming. In the example script the window is set with adjustable start and end hours so you can match it to your own data.
It is most associated with major FX pairs that are active around the London open, but the time-of-day framework can be applied to other instruments that have a clear session rhythm. Traders often build the box on intraday timeframes (for example 5-15 minute charts) so the range and the breakout are well defined. Whatever you choose, test it on your own data — behavior differs by instrument and period.
That is exactly what the ForexCodes Strategy Validator is built for. It turns a plain-English or AI-written strategy into validated Pine Script v6 and flags issues like look-ahead bias, repainting, and intent mismatches before you trust a backtest. It does not promise results — it helps make sure the code does what you think it does. You can try it free.
Educational & software only — not financial advice, not a recommendation to trade. Backtests are illustrative; past performance does not predict future results. Trading involves substantial risk of loss.