Indicator · Pine Script v6 · On the chart

London Breakout - Asian Range, Entry, Stop and Targets

by TradingSignalBot

This indicator defines the Asian session range from the New York evening until the London open.

View on GitHub

GitHub stars19on the repository
Pine versionv6current
Lines of code484
Settings17inputs
LicenceMIT
Last update3 weeks ago2 Nov 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 indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

484 lines of Pine Script v6 from indicators/london-breakout.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

london-breakout.pine
//@version=6
// This source code is subject to the terms of the MIT License (LICENSE in the source repository).
// © TradingSignalBot
//
// London breakout. The Asian session sets a range, from 19:00 New York to the London open (08:00
// London). From the open until 11:00 London, the first candle to close above the range's high is a
// buy, below its low a sell: the first break of the day only. A day whose range is wider than 0.6
// times the average daily range of the previous 14 trading days is skipped, and so is a range with a
// candle missing. The stop is the other side of the range (or its middle); the targets are
// multiples of the stop distance. A trading day runs 17:00 to 17:00 New York. Built on 15-minute
// candles by default.
indicator("London Breakout - Asian Range, Entry, Stop and Targets", shorttitle = "London Breakout", overlay = true, max_lines_count = 500, max_labels_count = 500, max_boxes_count = 500)

const string ID = "london-breakout"
const string NAME = "London breakout"
const float TP1_R = 1.0
const float TP2_R = 2.0
const float TP3_R = 3.0

// ---- TSBStyle:begin ----
// Inline copy of library/TSBStyle.pine (scripts/sync-style.mjs writes it: edit the library, not this).
// @function The ink colour: panel backgrounds.
// @returns color
colInk() => #0B0B0D

// @function The grey colour: secondary text and frames.
// @returns color
colGrey() => #8A949E

// @function The entry colour.
// @returns color
colWhite() => #FFFFFF

// @function The stop colour, and sells.
// @returns color
colRed() => #E5484D

// @function The target colour, and buys.
// @returns color
colGreen() => #16A34A

// @function The colour of a strategy's levels (the opening range, a swing, the previous day's high or low).
// @returns color
colGold() => #E8B84A

// @function The colour of a session range (the Asian range) and a second indicator line.
// @returns color
colBlue() => #5B8DEF

// @function The colour of indicator marks (a trend EMA, a divergence line).
// @returns color
colViolet() => #B18CFF

// @type The drawings of one signal, deleted together once it is no longer among the newest kept.
// @field lines Its lines.
// @field labels Its labels.
// @field boxes Its boxes.
type Drawn
    array<line> lines
    array<label> labels
    array<box> boxes

// @function An empty set of drawings.
// @returns Drawn
newDrawn() =>
    Drawn.new(array.new<line>(), array.new<label>(), array.new<box>())

// @function The pip size of a symbol, by the house convention: gold one dollar, JPY pairs 0.01, other currency pairs 0.0001, anything else ten ticks.
// @param ticker The symbol's ticker (syminfo.ticker).
// @param symType The symbol's type (syminfo.type).
// @param mintick The symbol's tick (syminfo.mintick).
// @param override A pip size to use instead; 0 for automatic.
// @returns float
pipSize(string ticker, string symType, float mintick, float override) =>
    string fiat = "USD EUR GBP JPY CHF AUD NZD CAD NOK SEK DKK SGD HKD MXN ZAR PLN TRY CNH"
    bool fx = symType == "forex" or (str.length(ticker) == 6 and str.contains(fiat, str.substring(ticker, 0, 3)) and str.contains(fiat, str.substring(ticker, 3, 6)))
    float p = mintick * 10.0
    if override > 0
        p := override
    else if str.contains(ticker, "XAU")
        p := 1.0
    else if fx
        p := str.endswith(ticker, "JPY") ? 0.01 : 0.0001
    p

// @function The distance between two prices in whole pips.
// @param a A price.
// @param b Another price.
// @param pipSz The pip size (pipSize()).
// @returns int
pipsBetween(float a, float b, float pipSz) =>
    math.round(math.abs(a - b) / pipSz)

// @function A price as the chart shows it.
// @param v The price.
// @returns string
priceText(float v) =>
    str.tostring(v, format.mintick)

// @function The target multiples as a sentence: "1, 2, 3"; a target of 0 is left out.
// @param r1 TP1 in multiples of the stop distance.
// @param r2 TP2.
// @param r3 TP3, or 0.
// @returns string
rsText(float r1, float r2, float r3) =>
    string s = str.tostring(r1) + ", " + str.tostring(r2)
    if r3 > 0
        s += ", " + str.tostring(r3)
    s

// @function A target at a multiple of the stop distance, or na when the multiple is 0.
// @param isBuy True for a buy.
// @param entry The entry price.
// @param stop The stop price.
// @param r The multiple.
// @returns float
targetAt(bool isBuy, float entry, float stop, float r) =>
    float risk = math.abs(entry - stop)
    r > 0 ? (isBuy ? entry + r * risk : entry - r * risk) : na

// @function A filled tag at the right end of a level, with its text.
// @param x The bar index of the tag.
// @param y Its price.
// @param txt Its text.
// @param bg Its fill.
// @param fg Its text colour.
// @param lblSize A label size ("tiny", "small", "normal", "large").
// @returns label
levelTag(int x, float y, string txt, color bg, color fg, string lblSize) =>
    label.new(x = x, y = y, text = txt, xloc = xloc.bar_index, yloc = yloc.price, color = bg, textcolor = fg, style = label.style_label_left, size = lblSize)

// @function The entry, the stop and the targets, drawn from the signal candle, and the signal marked on it.
// @param isBuy True for a buy.
// @param entry The entry price (the signal candle's close).
// @param stop The stop price.
// @param tp1 TP1.
// @param tp2 TP2, or na.
// @param tp3 TP3, or na.
// @param x The signal candle's bar index.
// @param length How many candles the levels run to the right.
// @param name The strategy's name, for the mark on the candle.
// @param pipSz The pip size (pipSize()).
// @param lblSize A label size.
// @param anchor Where the mark sits: the candle's low for a buy, its high for a sell.
// @returns Drawn
drawSignal(bool isBuy, float entry, float stop, float tp1, float tp2, float tp3, int x, int length, string name, float pipSz, string lblSize, float anchor) =>
    Drawn d = newDrawn()
    int x2 = x + length
    string word = isBuy ? "BUY" : "SELL"
    d.lines.push(line.new(x1 = x, y1 = entry, x2 = x2, y2 = entry, xloc = xloc.bar_index, color = colWhite(), width = 2, style = line.style_solid))
    d.lines.push(line.new(x1 = x, y1 = stop, x2 = x2, y2 = stop, xloc = xloc.bar_index, color = colRed(), width = 1, style = line.style_dashed))
    d.labels.push(levelTag(x2, entry, "ENTRY · " + word + " " + priceText(entry), colWhite(), colInk(), lblSize))
    d.labels.push(levelTag(x2, stop, "STOP LOSS · " + str.tostring(pipsBetween(entry, stop, pipSz)) + " PIPS · " + priceText(stop), colRed(), colWhite(), lblSize))
    array<float> tps = array.from(tp1, tp2, tp3)
    for [k, tp] in tps
        if not na(tp)
            d.lines.push(line.new(x1 = x, y1 = tp, x2 = x2, y2 = tp, xloc = xloc.bar_index, color = colGreen(), width = 1, style = line.style_dashed))
            d.labels.push(levelTag(x2, tp, "TP" + str.tostring(k + 1) + " · +" + str.tostring(pipsBetween(entry, tp, pipSz)) + " PIPS · " + priceText(tp), colGreen(), colWhite(), lblSize))
    d.labels.push(label.new(x = x, y = anchor, text = word + " · " + name, xloc = xloc.bar_index, yloc = yloc.price, color = isBuy ? colGreen() : colRed(), textcolor = colWhite(), style = isBuy ? label.style_label_up : label.style_label_down, size = lblSize))
    d

// @function A shaded range (the opening range, the Asian range, a sweep) with its name in the corner.
// @param xLeft The first bar index.
// @param xRight The last bar index.
// @param top The range's high.
// @param bottom The range's low.
// @param col Its colour.
// @param txt Its name.
// @param lblSize A label size.
// @returns box
rangeBox(int xLeft, int xRight, float top, float bottom, color col, string txt, string lblSize) =>
    box.new(left = xLeft, top = top, right = xRight, bottom = bottom, border_color = col, border_width = 1, border_style = line.style_solid, xloc = xloc.bar_index, bgcolor = color.new(col, 85), text = txt, text_size = lblSize, text_color = col, text_halign = text.align_left, text_valign = text.align_top)

// @function A strategy's level (a swing, the previous day's high or low): a dotted line with its name at the left end.
// @param x1 The bar index it starts at.
// @param x2 The bar index it ends at.
// @param y Its price.
// @param col Its colour.
// @param txt Its name.
// @param below True to write the name under the line.
// @param lblSize A label size.
// @returns [line, label]
levelLine(int x1, int x2, float y, color col, string txt, bool below, string lblSize) =>
    line ln = line.new(x1 = x1, y1 = y, x2 = x2, y2 = y, xloc = xloc.bar_index, color = col, width = 1, style = line.style_dotted)
    label lb = label.new(x = x1, y = y, text = txt, xloc = xloc.bar_index, yloc = yloc.price, color = color.new(col, 100), textcolor = col, style = below ? label.style_label_up : label.style_label_down, size = lblSize)
    [ln, lb]

// @function A small mark on a candle (the break, the sweep, an RSI value).
// @param x The bar index.
// @param y The price.
// @param txt Its text.
// @param col Its colour.
// @param above True to put it over the price, false under it.
// @param tip The tooltip.
// @param lblSize A label size.
// @returns label
markLabel(int x, float y, string txt, color col, bool above, string tip, string lblSize) =>
    label.new(x = x, y = y, text = txt, xloc = xloc.bar_index, yloc = yloc.price, color = color.new(col, 100), textcolor = col, style = above ? label.style_label_down : label.style_label_up, size = lblSize, tooltip = tip)

// @function Deletes a signal's drawings.
// @param d The drawings.
// @returns bool
deleteDrawn(Drawn d) =>
    for ln in d.lines
        line.delete(ln)
    for lb in d.labels
        label.delete(lb)
    for bx in d.boxes
        box.delete(bx)
    true

// @function Keeps a signal's drawings, and deletes the oldest beyond the newest maxKept.
// @param list The drawings kept so far.
// @param d The new signal's drawings.
// @param maxKept How many signals to keep on the chart.
// @returns int
keepDrawn(array<Drawn> list, Drawn d, int maxKept) =>
    list.push(d)
    while list.size() > math.max(maxKept, 1)
        deleteDrawn(list.shift())
    list.size()

// @function The signal as the bot's message: side, symbol and strategy; entry, stop and targets in pips; the strategy's line; the disclaimer.
// @param isBuy True for a buy.
// @param symbol The symbol.
// @param name The strategy's name.
// @param entry The entry.
// @param stop The stop.
// @param tp1 TP1.
// @param tp2 TP2, or na.
// @param tp3 TP3, or na.
// @param pipSz The pip size.
// @param why The strategy's sentence on what happened and where the stop and targets go.
// @returns string
signalText(bool isBuy, string symbol, string name, float entry, float stop, float tp1, float tp2, float tp3, float pipSz, string why) =>
    string s = (isBuy ? "🟢 BUY " : "🔴 SELL ") + symbol + " · " + name + "\n\n"
    s += "Entry: " + priceText(entry) + " (market)\n"
    s += "Stop: " + priceText(stop) + " (" + str.tostring(pipsBetween(entry, stop, pipSz)) + " pips)\n"
    array<float> tps = array.from(tp1, tp2, tp3)
    for [k, tp] in tps
        if not na(tp)
            s += "TP" + str.tostring(k + 1) + ": " + priceText(tp) + " (+" + str.tostring(pipsBetween(entry, tp, pipSz)) + " pips)\n"
    s += "\n" + why + "\n\nNot financial advice. Trade at your own risk."
    s

// @function A string made safe to put between quotes in JSON.
// @param s The string.
// @returns string
jsonText(string s) =>
    str.replace_all(str.replace_all(str.replace_all(s, "\\", "\\\\"), "\"", "\\\""), "\n", "\\n")

// @function The signal as JSON for a webhook (the format docs/alerts.md describes).
// @param id The strategy's id ("london-breakout").
// @param isBuy True for a buy.
// @param symbol The symbol (syminfo.ticker).
// @param exchange The exchange (syminfo.prefix).
// @param tf The chart's timeframe (timeframe.period).
// @param entry The entry.
// @param stop The stop.
// @param tp1 TP1.
// @param tp2 TP2, or na.
// @param tp3 TP3, or na.
// @param barTime The signal candle's close time, in milliseconds (time_close).
// @param msg The message (signalText()).
// @param secretKey A shared secret for the webhook, or "".
// @returns string
alertJson(string id, bool isBuy, string symbol, string exchange, string tf, float entry, float stop, float tp1, float tp2, float tp3, int barTime, string msg, string secretKey) =>
    string tps = priceText(tp1)
    if not na(tp2)
        tps += "," + priceText(tp2)
    if not na(tp3)
        tps += "," + priceText(tp3)
    string j = "{\"source\":\"tv-strategies\",\"strategy\":\"" + id + "\",\"symbol\":\"" + jsonText(symbol) + "\",\"exchange\":\"" + jsonText(exchange) + "\",\"timeframe\":\"" + tf + "\""
    j += ",\"side\":\"" + (isBuy ? "buy" : "sell") + "\",\"entry\":" + priceText(entry) + ",\"stop\":" + priceText(stop) + ",\"targets\":[" + tps + "]"
    j += ",\"time\":" + str.tostring(barTime) + ",\"text\":\"" + jsonText(msg) + "\""
    if secretKey != ""
        j += ",\"secret\":\"" + jsonText(secretKey) + "\""
    j + "}"

// @function Fills the latest-signal panel: the strategy, the side and symbol, and the levels.
// @param t A table of one column and three rows.
// @param isBuy True for a buy.
// @param name The strategy's name.
// @param symbol The symbol.
// @param detail The levels in one line.
// @returns bool
heroPanel(table t, bool isBuy, string name, string symbol, string detail) =>
    table.cell(t, 0, 0, "New signal · " + name, text_color = colGrey(), text_halign = text.align_right, text_size = size.small)
    table.cell(t, 0, 1, (isBuy ? "▲ BUY  " : "▼ SELL  ") + symbol, text_color = isBuy ? colGreen() : colRed(), text_halign = text.align_right, text_size = size.large)
    table.cell(t, 0, 2, detail, text_color = colWhite(), text_halign = text.align_right, text_size = size.small)
    true

// @function Writes a notice (a timeframe the strategy cannot run on) in a one-cell table.
// @param t A table of one cell.
// @param msg The notice.
// @returns bool
notice(table t, string msg) =>
    table.cell(t, 0, 0, msg, text_color = colGold(), text_halign = text.align_left, text_size = size.small)
    true
// ---- TSBStyle:end ----

const string GRP_S = "Strategy"
const string NY = "America/New_York"
const string LON = "Europe/London"
int asiaH = input.int(19, "Range starts (New York)", minval = 0, maxval = 23, inline = "asia", group = GRP_S, tooltip = "It ends at the London open, 08:00 London.")
int asiaM = input.int(0, "", minval = 0, maxval = 59, inline = "asia", group = GRP_S)
int untilH = input.int(11, "Last entry (London)", minval = 8, maxval = 23, inline = "until", group = GRP_S)
int untilM = input.int(0, "", minval = 0, maxval = 59, inline = "until", group = GRP_S)
float maxRange = input.float(0.6, "Widest range, times the average daily range", minval = 0.05, step = 0.05, group = GRP_S, tooltip = "A wider Asian range is skipped.")
int adrDays = input.int(14, "Average daily range over (trading days)", minval = 1, maxval = 60, group = GRP_S, tooltip = "High minus low of each 17:00 to 17:00 New York day. A day with under 70% of its candles is not counted.")
string stopAt = input.string("Other side", "Stop", options = ["Other side", "Middle"], group = GRP_S)

// ---- common:begin ----
// Shared by every indicator in the pack: src/common.pine, copied in by scripts/sync-style.mjs.
// It expects ID, NAME, TP1_R, TP2_R and TP3_R to be declared above it.
const string GRP_T = "Entry, stop and targets"
const string GRP_D = "Drawing"
const string GRP_A = "Alerts"
float tp1R = input.float(TP1_R, "TP1, times the stop distance", minval = 0.1, step = 0.1, group = GRP_T)
float tp2R = input.float(TP2_R, "TP2, times the stop distance", minval = 0.1, step = 0.1, group = GRP_T)
float tp3R = input.float(TP3_R, "TP3, times the stop distance (0: no TP3)", minval = 0.0, step = 0.1, group = GRP_T)
int keepN = input.int(10, "Signals kept on the chart", minval = 1, maxval = 40, group = GRP_D)
int extendN = input.int(20, "Levels run for (candles)", minval = 3, maxval = 300, group = GRP_D)
string lblSize = input.string("small", "Label size", options = ["tiny", "small", "normal", "large"], group = GRP_D)
bool showHero = input.bool(true, "Latest signal panel", group = GRP_D)
float pipIn = input.float(0.0, "Pip size (0: automatic)", minval = 0.0, step = 0.0001, group = GRP_D, tooltip = "Automatic: gold 1.00, JPY pairs 0.01, other currency pairs 0.0001, anything else ten ticks.")
bool jsonAlerts = input.bool(true, "Send each signal as JSON to alert() calls", group = GRP_A, tooltip = "Create an alert on this indicator with the condition \"Any alert() function call\" to receive it.")
string secret = input.string("", "Webhook secret (optional)", group = GRP_A, tooltip = "Added to the JSON as \"secret\", for a webhook receiver that checks it. Leave empty if yours takes the secret in its address.")

float pip = pipSize(syminfo.ticker, syminfo.type, syminfo.mintick, pipIn)
bool closed = barstate.isconfirmed
bool afterGap = bar_index > 0 and time - time[1] > 86400000
var array<Drawn> drawn = array.new<Drawn>()
var table hero = table.new(position.top_right, 1, 3, bgcolor = color.new(colInk(), 10), frame_color = colGrey(), frame_width = 1)
var table note = table.new(position.bottom_right, 1, 1, bgcolor = color.new(colInk(), 10))

// What the bar signalled, for the alert conditions and the Data Window. Set where a signal fires.
bool buySig = false
bool sellSig = false
float sigEntry = na
float sigStop = na
float sigTp1 = na
float sigTp2 = na
float sigTp3 = na

// One signal at this candle's close: drawn, kept, shown in the panel and sent as JSON.
// `why` is the strategy's line for the message. Returns the drawings (for the strategy's own
// marks) and the three targets.
emit(bool isBuy, float entry, float stopPx, string why) =>
    float t1 = targetAt(isBuy, entry, stopPx, tp1R)
    float t2 = targetAt(isBuy, entry, stopPx, tp2R)
    float t3 = targetAt(isBuy, entry, stopPx, tp3R)
    Drawn d = drawSignal(isBuy, entry, stopPx, t1, t2, t3, bar_index, extendN, NAME, pip, lblSize, isBuy ? low : high)
    keepDrawn(drawn, d, keepN)
    if showHero
        heroPanel(hero, isBuy, NAME, syminfo.ticker, "Entry " + priceText(entry) + " · stop " + priceText(stopPx) + " (" + str.tostring(pipsBetween(entry, stopPx, pip)) + " pips) · TP1 " + priceText(t1))
    if jsonAlerts
        alert(alertJson(ID, isBuy, syminfo.ticker, syminfo.prefix, timeframe.period, entry, stopPx, t1, t2, t3, time_close, signalText(isBuy, syminfo.ticker, NAME, entry, stopPx, t1, t2, t3, pip, why), secret), alert.freq_once_per_bar_close)
    [d, t1, t2, t3]
// ---- common:end ----

int tfSec = timeframe.in_seconds()
bool tfOk = timeframe.isintraday and tfSec <= 3600 and 3600 % tfSec == 0
string tfNote = NAME + ": use an intraday chart of one hour or less (15 minutes is the default)."
int nyMin = hour(time, NY) * 60 + minute(time, NY)
int lonMin = hour(time, LON) * 60 + minute(time, LON)
// minutes since the 17:00 New York session break: 19:00 is 120, 00:00 is 420
int sinceBreak = (nyMin - 1020 + 1440) % 1440
int r0 = (asiaH * 60 + asiaM - 1020 + 1440) % 1440
int untilMin = untilH * 60 + untilM
// the trading day a candle belongs to: 17:00 New York plus seven hours is midnight
int dayKey = year(time + 25200000, NY) * 10000 + month(time + 25200000, NY) * 100 + dayofmonth(time + 25200000, NY)
bool newDay = bar_index == 0 or dayKey != dayKey[1]

// The average high-to-low of the last n full days among the last 2n days, or na.
adrOf(array<float> list, int n) =>
    float sum = 0.0
    int got = 0
    int sz = list.size()
    if sz > 0
        for j = sz - 1 to math.max(0, sz - 2 * n)
            float v = list.get(j)
            if got < n and not na(v)
                sum += v
                got += 1
    got == n ? sum / n : na

var array<float> dayRanges = array.new<float>()
var float dHi = na
var float dLo = na
var int dN = 0
var float rHi = na
var float rLo = na
var int rN = 0
var int rFirstTime = na
var int rFirstBar = na
var bool rFirstOk = false
var float rAdr = na
var int phase = 0 // 0: building the range, 1: London is open and the break is awaited, 2: done for the day
var box rBox = na
var array<box> ranges = array.new<box>()

if closed and tfOk
    if newDay
        if dN > 0
            dayRanges.push(dN >= 0.7 * 86400 / tfSec ? dHi - dLo : na)
            if dayRanges.size() > 2 * adrDays + 2
                dayRanges.shift()
        dHi := high
        dLo := low
        dN := 1
        rHi := na
        rLo := na
        rN := 0
        rFirstTime := na
        rFirstBar := na
        rFirstOk := false
        rAdr := na
        phase := 0
        rBox := na
    else
        dHi := math.max(dHi, high)
        dLo := math.min(dLo, low)
        dN += 1
    bool isRange = sinceBreak >= r0 and (sinceBreak < 420 or lonMin < 480)
    if phase == 0
        if isRange
            if rN == 0
                rFirstTime := time
                rFirstBar := bar_index
                rFirstOk := sinceBreak == r0
                rHi := high
                rLo := low
            else
                rHi := math.max(rHi, high)
                rLo := math.min(rLo, low)
            rN += 1
        else if rN > 0 and sinceBreak >= 420 and lonMin >= 480
            // the London open's candle
            rAdr := adrOf(dayRanges, adrDays)
            bool whole = rFirstOk and rN * tfSec * 1000 == time - rFirstTime
            bool quiet = not na(rAdr) and rHi - rLo <= maxRange * rAdr
            phase := whole and quiet ? 1 : 2
            if whole
                string share = na(rAdr) ? "" : " · " + str.tostring(math.round(100 * (rHi - rLo) / rAdr)) + "% of the " + str.tostring(adrDays) + "-day range"
                rBox := rangeBox(rFirstBar, bar_index, rHi, rLo, colBlue(), "Asian range · " + str.tostring(pipsBetween(rHi, rLo, pip)) + " pips" + share + (quiet ? "" : " · too wide, skipped"), lblSize)
                ranges.push(rBox)
                if ranges.size() > keepN
                    box.delete(ranges.shift())
    if phase == 1
        if lonMin >= untilMin
            phase := 2
        else
            box.set_right(rBox, bar_index)
            bool up = close > rHi
            bool dn = close < rLo
            if up or dn
                phase := 2
                float stopPx = stopAt == "Middle" ? (rHi + rLo) / 2 : up ? rLo : rHi
                if up ? stopPx < close : stopPx > close
                    string why = "Asian range broken after the London open. Stop at the " + (stopAt == "Middle" ? "middle" : "other side") + " of the range; targets at " + rsText(tp1R, tp2R, tp3R) + " times the stop."
                    [d, t1, t2, t3] = emit(up, close, stopPx, why)
                    buySig := up
                    sellSig := not up
                    sigEntry := close
                    sigStop := stopPx
                    sigTp1 := t1
                    sigTp2 := t2
                    sigTp3 := t3

// ---- outputs:begin ----
// Shared by every indicator in the pack: src/outputs.pine, copied in by scripts/sync-style.mjs.
// It expects tfOk and tfNote to be declared above it.
plot(sigEntry, "Entry", color = colWhite(), display = display.data_window)
plot(sigStop, "Stop", color = colRed(), display = display.data_window)
plot(sigTp1, "TP1", color = colGreen(), display = display.data_window)
plot(sigTp2, "TP2", color = colGreen(), display = display.data_window)
plot(sigTp3, "TP3", color = colGreen(), display = display.data_window)
alertcondition(buySig, NAME + ": buy", NAME + ': BUY {{ticker}} ({{interval}}). Entry {{plot("Entry")}}, stop {{plot("Stop")}}, TP1 {{plot("TP1")}}, TP2 {{plot("TP2")}}, TP3 {{plot("TP3")}}.')
alertcondition(sellSig, NAME + ": sell", NAME + ': SELL {{ticker}} ({{interval}}). Entry {{plot("Entry")}}, stop {{plot("Stop")}}, TP1 {{plot("TP1")}}, TP2 {{plot("TP2")}}, TP3 {{plot("TP3")}}.')
alertcondition(buySig or sellSig, NAME + ": any signal", NAME + ': signal on {{ticker}} ({{interval}}). Entry {{plot("Entry")}}, stop {{plot("Stop")}}, TP1 {{plot("TP1")}}, TP2 {{plot("TP2")}}, TP3 {{plot("TP3")}}.')
if barstate.islast and not tfOk
    notice(note, tfNote)
// ---- outputs:end ----

Overview

When a candle closes above the range high or below the range low before the cutoff time, it plots a breakout entry on the price chart. The script draws stop loss levels at the opposite side or midpoint of the range alongside up to three configurable risk-reward target levels. Days exceeding a set fraction of the average daily range are automatically filtered out.

Details

Published by

TradingSignalBot on GitHub

Draws

On the price chart

Markets

Forex, Gold

Timeframes

M15-H1, 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.

Topics

forexindicatorlondon-breakoutpine-scriptsupertrendtrading-strategytradingview

Settings

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

SettingTypeDefaultVariable
Range starts (New York)int19asiaH
asiaMint0asiaM
Last entry (London)int11untilH
untilMint0untilM
Widest range, times the average daily rangefloat0.6maxRange
Average daily range over (trading days)int14adrDays
StopstringOther sidestopAt
TP1, times the stop distancefloatTP1_Rtp1R
TP2, times the stop distancefloatTP2_Rtp2R
TP3, times the stop distance (0: no TP3)floatTP3_Rtp3R
Signals kept on the chartint10keepN
Levels run for (candles)int20extendN
Show all 17 settings
SettingTypeDefaultVariable
Label sizestringsmalllblSize
Latest signal panelbooltrueshowHero
Pip size (0: automatic)float0.0pipIn
Send each signal as JSON to alert() callsbooltruejsonAlerts
Webhook secret (optional)stringsecret
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

IB / ORB Live Stats

by TamaraKGreen
47 stars

This overlay indicator marks the New York initial balance and a configurable opening range on the price chart and reports live range statistics in two tables. It builds an IB box for a default 09:30–10:30 ET window, an ORB box from 09:30 for a set number of mi

Indicator v6 Sessions & timeBreakout
Updated 2 months ago · None stated GitHub repository of IB / ORB Live Stats

The Mathematical Indicator calculates session bias by evaluating previous daily and 4-hour closed candles. It draws timeframe support and resistance levels using candle bodies, highlights clean trading zones, and identifies setup patterns involving consolidati

Indicator v6 TrendSupport & resistance Repaints
Updated 3 days ago · MIT GitHub repository of The Mathematical Indicator · 2-Candle Bias
34 stars

This indicator calculates and plots multi-stage Opening Range Breakout high, low, and mid-range levels for 5, 15, 30, and 60 minute intervals on the price chart. It draws shaded range boxes and labels breakouts, retests, and failed breaks with cycle counting,

Indicator v6 BreakoutSessions & time
Updated 2 weeks ago · MIT GitHub repository of Luxy BIG beautiful Dynamic ORB

Zen-DAX GX

by Zen-Tim
29 stars

This indicator calculates and plots session ranges and key breakout levels for DAX futures directly on the price chart. It defines the overnight Globex session, the Frankfurt pre-market range, and the regular trading hours open using European timezone settings

Indicator v5 Sessions & timeBreakout
Updated 5 weeks ago · MIT GitHub repository of Zen-DAX GX

ORB Pro - Research-Based ORB

by Mrshahidali420
16 stars

The ORB Pro indicator calculates and plots Opening Range Breakout levels, stop-loss and take-profit zones, signal labels, and an status dashboard on the price chart. Built on academic research, it evaluates trades using an opening-candle direction filter, open

Indicator v6 BreakoutSessions & time Repaints
Updated 4 months ago · None stated GitHub repository of ORB Pro - Research-Based ORB

Nexural ORB

by JasonTeixeira
11 stars

This indicator plots opening range breakout levels across multiple timeframes, including five, fifteen, thirty, and sixty minutes, directly on the price chart. It also displays the session open and overnight high and low levels. The script calculates an openin

Indicator v6 BreakoutSessions & time
Updated 5 weeks ago · Custom licence GitHub repository of Nexural ORB

More Sessions & time 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