Strategy · Pine Script v5 · On the chart

London Breakout - Session Strategy

by Basant1Saini· code credited to TradingTools

This strategy builds the high and low of a configurable Asian session and locks that range when the session ends.

View on GitHub

Repaints

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code88
Settings10inputs
LicenceNone statedfile: MPL-2.0
Last update7 months ago4 Mar 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

88 lines of Pine Script v5 from 15_London_Breakout/15_London_Breakout.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

15_London_Breakout.pine
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0
// © TradingTools

//@version=5
strategy("London Breakout - Session Strategy", overlay=true, default_qty_type=strategy.percent_of_equity, default_qty_value=100)

// ─── Inputs ───
asianSession    = input.session("0000-0700", "Asian Range Session (UTC)", group="Sessions")
londonSession   = input.session("0700-1100", "London Trading Window (UTC)", group="Sessions")
closeSession    = input.session("1100-1600", "Close Window (UTC)", group="Sessions")
bufferPips      = input.float(5, "Breakout Buffer (pips)", step=1, group="Entry")
pipValue        = input.float(0.0001, "Pip Value", step=0.0001, group="Entry", tooltip="0.0001 for most pairs, 0.01 for JPY")
atrLength       = input.int(14, "ATR Length", group="Risk Management")
atrMult         = input.float(1.5, "ATR Multiplier for SL", step=0.1, group="Risk Management")
rrRatio         = input.float(2.0, "Risk:Reward Ratio", step=0.1, group="Risk Management")
maxTrades       = input.int(1, "Max Trades Per Day", group="Risk Management")
showBox         = input.bool(true, "Show Asian Range Box", group="Display")

// ─── Session Detection ───
isAsian  = not na(time(timeframe.period, asianSession))
isLondon = not na(time(timeframe.period, londonSession))
isClose  = not na(time(timeframe.period, closeSession))

// ─── Asian Range ───
var float asianHigh = na
var float asianLow  = na
var bool  rangeSet  = false
var int   dailyTrades = 0

// Reset at start of Asian session
if isAsian and not isAsian[1]
    asianHigh := high
    asianLow  := low
    rangeSet  := false
    dailyTrades := 0

// Build range during Asian session
if isAsian
    asianHigh := math.max(asianHigh, high)
    asianLow  := math.min(asianLow, low)

// Lock range at end of Asian session
if not isAsian and isAsian[1]
    rangeSet := true

// ─── Buffer ───
buffer = bufferPips * pipValue

// ─── ATR ───
atrVal = ta.atr(atrLength)

// ─── Entry Conditions ───
longCondition  = rangeSet and isLondon and close > (asianHigh + buffer) and dailyTrades < maxTrades
shortCondition = rangeSet and isLondon and close < (asianLow - buffer) and dailyTrades < maxTrades

// ─── Execute Trades ───
if longCondition and strategy.position_size == 0
    sl = close - atrVal * atrMult
    tp = close + (close - sl) * rrRatio
    strategy.entry("London Long", strategy.long)
    strategy.exit("London Long Exit", "London Long", stop=sl, limit=tp)
    dailyTrades += 1

if shortCondition and strategy.position_size == 0
    sl = close + atrVal * atrMult
    tp = close - (sl - close) * rrRatio
    strategy.entry("London Short", strategy.short)
    strategy.exit("London Short Exit", "London Short", stop=sl, limit=tp)
    dailyTrades += 1

// ─── Close at End of Window ───
if not isLondon and not isClose and strategy.position_size != 0
    strategy.close_all("Window Closed")

// ─── Plotting ───
asianHighLine = plot(showBox and rangeSet and (isLondon or isClose) ? asianHigh : na, "Asian High", color=color.new(color.teal, 0), linewidth=2, style=plot.style_linebr)
asianLowLine  = plot(showBox and rangeSet and (isLondon or isClose) ? asianLow : na, "Asian Low", color=color.new(color.teal, 0), linewidth=2, style=plot.style_linebr)
fill(asianHighLine, asianLowLine, color=color.new(color.teal, 88), title="Asian Range")

bgcolor(isAsian ? color.new(color.purple, 95) : isLondon ? color.new(color.yellow, 95) : na, title="Session Highlight")

plotshape(longCondition and strategy.position_size[1] == 0, title="London Long", location=location.belowbar, style=shape.arrowup, color=color.green, size=size.small, text="LDN")
plotshape(shortCondition and strategy.position_size[1] == 0, title="London Short", location=location.abovebar, style=shape.arrowdown, color=color.red, size=size.small, text="LDN")

// ─── Alerts ───
alertcondition(longCondition, title="London Long Breakout", message="London Breakout: Price broke above Asian range — Long")
alertcondition(shortCondition, title="London Short Breakout", message="London Breakout: Price broke below Asian range — Short")
alertcondition(rangeSet and not rangeSet[1], title="Asian Range Set", message="London Breakout: Asian range established")

Overview

During the London window it enters long when price closes above the range high plus a pip buffer, or short when it closes below the range low minus the buffer, while flat and under a daily trade limit. Stop loss is an ATR multiple and take profit uses a risk-to-reward ratio; remaining positions close outside the London and close windows. It draws the Asian range on the price chart. Entries use the live bar close, so they can change before the bar finishes.

Details

Published by

Basant1Saini on GitHub

Code credit

TradingTools, as written in the script's header

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Breakout, Sessions & time, Volatility & bands

Markets

Forex

Timeframes

M1-M5, M15-H1

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)

Settings

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

SettingTypeDefaultVariable
Asian Range Session (UTC)session0000-0700asianSession
London Trading Window (UTC)session0700-1100londonSession
Close Window (UTC)session1100-1600closeSession
Breakout Buffer (pips)float5bufferPips
Pip Valuefloat0.0001pipValue
ATR Lengthint14atrLength
ATR Multiplier for SLfloat1.5atrMult
Risk:Reward Ratiofloat2.0rrRatio
Max Trades Per Dayint1maxTrades
Show Asian Range BoxbooltrueshowBox
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

106 stars

This strategy places buy-stop and sell-stop orders around the opening-session high and low, offset by a user-defined pip gap, and only allows those orders during a separate trading session. It exits with a fixed or ATR-based stop loss and a matching take-profi

Strategy v5 Sessions & timeBreakout Repaints
Updated 2 years ago · GPL-3.0 GitHub repository of 50 Pips A Day Strategy - Kaspricci

Turtle MACD Time-Zone Filter

by skywalker0803r
42 stars

This strategy enters long when price closes above the prior Donchian high and short when it closes below the prior Donchian low, only while flat and inside a Taipei-hour window. It exits on a MACD histogram reversal or through an ATR stop and a percentage take

Strategy v5 BreakoutOscillators & momentum
Updated 2 months ago · None stated GitHub repository of Turtle MACD Time-Zone Filter

ORION: Hybrid Strategy

by eddiebelaval
7 stars

This strategy identifies volatility breakout opportunities by constructing dynamic ATR-based price boxes and detecting volatility squeezes. Trades are filtered using an exponential moving average trend condition and designated session hours. Entries trigger up

Strategy v5 Volatility & bandsBreakout
Updated 3 months ago · None stated GitHub repository of ORION: Hybrid Strategy
6 stars

This overlay strategy builds independent timed session ranges and marks range, trendline, mean, VWAP, and high-low levels when those displays are enabled. It enters on range breakouts and exits with strategy exits, choosing among range, ATR, fixed-point, and r

Strategy v5 Sessions & timeBreakout
Updated 7 months ago · None stated GitHub repository of MSG Enhanced LEGO System Strategy

This strategy builds the opening range high and low during the first configurable minutes of the New York regular session, then enters on a close break of that range. A long triggers when price crosses above the range high while flat; a short triggers on a cro

Strategy v6 BreakoutSessions & time
Updated 2 months ago · MIT GitHub repository of ES Opening Range Breakout [trugurpala]

ORB Hunter

by nxtaiapp
2 stars

ORB Hunter is an Opening Range Breakout strategy that identifies price breakouts beyond a defined opening session window (such as 09:30 to 09:45 EST). It places long or short trades when price crosses the opening range bounds with buffer, confirmed by optional

Strategy v5 BreakoutSessions & time
Updated 11 months ago · MIT GitHub repository of ORB Hunter

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