Indicator · Pine Script v5 · On the chart

ICT Seek & Destroy Profile

by Ahmed1926· code credited to tradeforopp

An overlay indicator that shades the Asia, London and New York sessions and classifies days against the seek and destroy profile.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code224
Settings28inputs
LicenceNone statedfile: MPL-2.0
Last update9 months ago31 Jan 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

224 lines of Pine Script v5 from S&D Profile.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

S&D Profile.txt
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © tradeforopp

//@version=5
indicator("ICT Seek & Destroy Profile [TFO]", "S&D Profile [TFO]", true, max_boxes_count = 500, max_labels_count = 500)

// -------------------------------------------------- Inputs --------------------------------------------------
var g_KZS           = "Killzones" 
as_am               = input.session(title="Asia", defval="2000-0300", inline = "ASKZ", group = g_KZS)
askz_color          = input.color(color.new(color.blue, 80), "", inline = "ASKZ", group = g_KZS)
lo_am               = input.session(title="London", defval="0300-0830", inline = "LOKZ", group = g_KZS)
ldkz_color          = input.color(color.new(color.yellow, 80), "", inline = "LOKZ", group = g_KZS)
ny_am               = input.session(title="New York", defval="0830-1600", inline = "NYKZ", group = g_KZS)
nykz_color          = input.color(color.new(color.green, 80), "", inline = "NYKZ", group = g_KZS)

var g_CRT = "Success Criteria"
crt_inside_day      = input.bool(true, "NY Stays Within London Range", tooltip = "The New York range is contained within the London range", group = g_CRT)
crt_outside_day     = input.bool(true, "NY Exceeds London High & Low", tooltip = "The New York range exceeds both the high and low of the London range", group = g_CRT)
crt_close_in_lo     = input.bool(true, "NY Closes Within London Range", tooltip = "The New York range closes within the London range", group = g_CRT)
crt_sd_limit        = input.bool(true, "NY Range Too Small", tooltip = "The New York range will be compared to the standard deviation of its historical ranges, multiplied by this factor", inline = "SD", group = g_CRT)
sd_limit            = input.float(1.0, "", inline = "SD", group = g_CRT)

var g_SND = "Labels"
show_snd_pre        = input.bool(true, "Potential S&D Day", inline = "PRE", tooltip = "If London took both sides of the Asian range, this label will be generated", group = g_SND)
snd_pre_color       = input.color(title="", defval = #f23645, inline = "PRE", group = g_SND)
show_snd_day        = input.bool(true, "Successful S&D Day", inline = "POST", tooltip = "If New York met any of the selected success criteria, this label will populate", group = g_SND)
snd_day_color       = input.color(title="", defval = #089981, inline = "POST", group = g_SND)

var g_WRN = "Warning"
show_wrn_table      = input.bool(true, "Show Warning", tooltip = "Display the custom warning message when it is a potential S&D day (for the duration of the NY session)", group = g_WRN)
wrn_msg             = input.string("Potential S&D Day", "Warning Message", group = g_WRN)
wrn_text            = input.color(color.white, "Text Color", group = g_WRN)
wrn_bg              = input.color(#f23645, "Table Background", group = g_WRN)

var g_STY = "Statistics"
show_stat_table     = input.bool(true, "Show Statistics Table", group = g_STY)
table_position      = input.string('Top Right', "Table Position", options = ['Bottom Center', 'Bottom Left', 'Bottom Right', 'Middle Center', 'Middle Left', 'Middle Right', 'Top Center', 'Top Left', 'Top Right'], group = g_STY)
table_size          = input.string('Auto', "Text Size", options = ['Auto', 'Tiny', 'Small', 'Normal', 'Large', 'Huge'], group = g_STY)
table_text          = input.color(color.black, "Text", group = g_STY)
table_bg            = input.color(color.white, "Table Background", group = g_STY)
table_frame         = input.color(color.black, "Table Frame", group = g_STY)
table_border        = input.color(color.black, "Table Border", group = g_STY)
table_border_width  = input.int(1, "Table Border Width", group = g_STY)
table_frame_width   = input.int(2, "Table Frame Width", group = g_STY)
// -------------------------------------------------- Inputs --------------------------------------------------


// -------------------------------------------------- Constants & Variables --------------------------------------------------
nykz = not na(time(timeframe.period, ny_am, "America/New_York"))
lokz = not na(time(timeframe.period, lo_am, "America/New_York"))
askz = not na(time(timeframe.period, as_am, "America/New_York"))

var int sessions = 0

var int last_snd_pre = 0
var int last_snd_day = 0

var int total_snd_wrn = 0
var int total_snd_day = 0

var box nykz_box = na
var box lokz_box = na
var box askz_box = na

var int last_new_ny = na
var float last_ny_high = na
var float last_ny_low = na
var float last_ny_close = na

var int last_new_lo = na
var float last_lo_high = na
var float last_lo_low = na
var float last_lo_close = na

var int last_new_as = na
var float last_as_high = na
var float last_as_low = na
var float last_as_close = na

var ny_range = array.new_float()
// -------------------------------------------------- Constants & Variables --------------------------------------------------


// -------------------------------------------------- Functions --------------------------------------------------
manual_stdev() =>
    mean = ny_range.avg()
    accum = 0.0
    size = ny_range.size()
    if size > 0
        for i = 0 to size - 1
            accum += math.pow((ny_range.get(i) - mean), 2)
    sd = math.sqrt(accum / size)

get_table_position(pos) =>
    result = switch pos
        "Bottom Center" => position.bottom_center
        "Bottom Left" => position.bottom_left
        "Bottom Right" => position.bottom_right
        "Middle Center" => position.middle_center
        "Middle Left" => position.middle_left
        "Middle Right" => position.middle_right
        "Top Center" => position.top_center
        "Top Left" => position.top_left
        "Top Right" => position.top_right

get_text_size(size) =>
    result = switch size
        'Auto' => size.auto
        'Tiny' => size.tiny
        'Small' => size.small
        'Normal' => size.normal
        'Large' => size.large
        'Huge' => size.huge
// -------------------------------------------------- Functions --------------------------------------------------


// -------------------------------------------------- Core Logic --------------------------------------------------
if nykz 
    if not nykz[1]
        nykz_box := box.new(bar_index, high, bar_index, low, text = "New York", text_color = nykz_color, bgcolor = nykz_color, border_color = nykz_color)
        sessions += 1
    else
        top = box.get_top(nykz_box)
        bot = box.get_bottom(nykz_box)
        if high > top
            top := high
        if low < bot
            bot := low
        box.set_rightbottom(nykz_box, bar_index, bot)
        box.set_top(nykz_box, top)

if lokz 
    if not lokz[1]
        lokz_box := box.new(bar_index, high, bar_index, low, text = "London", text_color = ldkz_color, bgcolor = ldkz_color, border_color = ldkz_color)
    else
        top = box.get_top(lokz_box)
        bot = box.get_bottom(lokz_box)
        if high > top
            top := high
        if low < bot
            bot := low
        box.set_rightbottom(lokz_box, bar_index, bot)
        box.set_top(lokz_box, top)

if askz 
    if not askz[1]
        askz_box := box.new(bar_index, high, bar_index, low, text = "Asia", text_color = askz_color, bgcolor = askz_color, border_color = askz_color)
    else
        top = box.get_top(askz_box)
        bot = box.get_bottom(askz_box)
        if high > top
            top := high
        if low < bot
            bot := low
        box.set_rightbottom(askz_box, bar_index, bot)
        box.set_top(askz_box, top)

if not nykz and nykz[1]
    last_ny_high := box.get_top(nykz_box[1])
    last_ny_low := box.get_bottom(nykz_box[1])
    last_ny_close := close[1]
    last_new_ny := bar_index
    ny_range.push(last_ny_high - last_ny_low)
    
if not lokz and lokz[1]
    last_lo_high := box.get_top(lokz_box[1])
    last_lo_low := box.get_bottom(lokz_box[1])
    last_lo_close := close[1]
    last_new_lo := bar_index
    
if not askz and askz[1]
    last_as_high := box.get_top(askz_box[1])
    last_as_low := box.get_bottom(askz_box[1])
    last_as_close := close[1]
    last_new_as := bar_index

snd_day_wrn = false
if last_new_lo > last_new_as and last_lo_high > last_as_high and last_lo_low < last_as_low and last_snd_pre < last_new_lo
    snd_day_wrn := true
    last_snd_pre := bar_index
    total_snd_wrn += 1

snd_day_valid = false
if last_new_ny > last_new_lo and last_snd_pre > last_new_as and last_snd_day < last_new_ny
    outside_day = crt_outside_day ? last_ny_high >= last_lo_high and last_ny_low <= last_lo_low : false
    inside_day = crt_inside_day ? last_ny_high < last_lo_high and last_ny_low > last_lo_low : false
    close_inside_lo = crt_close_in_lo ? last_ny_close < last_lo_high and last_ny_close > last_lo_low : false
    stdev = crt_sd_limit ? last_ny_high - last_ny_low <= manual_stdev() * sd_limit : false

    if outside_day or inside_day or close_inside_lo or stdev
        snd_day_valid := true
        last_snd_day := bar_index
        total_snd_day += 1

if show_snd_pre and snd_day_wrn
    label.new(bar_index, last_lo_high, "Potential S&D Day", color = snd_pre_color, textcolor = wrn_text)
if show_snd_day and snd_day_valid
    label.new(bar_index, last_ny_high, "Valid S&D Day", color = snd_day_color, textcolor = wrn_text)
// -------------------------------------------------- Core Logic --------------------------------------------------


// -------------------------------------------------- Table --------------------------------------------------
var stats = table.new(get_table_position(table_position), 10, 10, bgcolor = table_bg, frame_color = table_frame, border_color = table_border, frame_width = table_frame_width, border_width = table_border_width)
table_text_size = get_text_size(table_size)

if barstate.islast
    if show_stat_table
        table.cell(stats, 0, 1, "Seek & Destroy Profile", text_color = table_text, text_size = table_text_size)
        table.cell(stats, 0, 2, "Total Sessions", text_color = table_text, text_size = table_text_size)
        table.cell(stats, 1, 2, str.tostring(sessions), text_color = table_text, text_size = table_text_size)
        table.cell(stats, 0, 3, "Warnings Given", text_color = table_text, text_size = table_text_size)
        table.cell(stats, 1, 3, str.tostring(total_snd_wrn), text_color = table_text, text_size = table_text_size)
        table.cell(stats, 0, 4, "Warning Success", text_color = table_text, text_size = table_text_size)
        table.cell(stats, 1, 4, str.tostring(total_snd_day), text_color = table_text, text_size = table_text_size)
        table.cell(stats, 0, 5, "Warning Success Rate", text_color = table_text, text_size = table_text_size)
        table.cell(stats, 1, 5, str.tostring(math.round(total_snd_day / total_snd_wrn * 100)) + "%", text_color = table_text, text_size = table_text_size)
        
    if show_wrn_table
        if last_snd_pre > last_new_ny
            table.cell(stats, 0, 1, wrn_msg, text_color = wrn_text, bgcolor = wrn_bg, text_size = table_text_size)
// -------------------------------------------------- Table --------------------------------------------------


My Note: Definitely requires changed settings, should turn off the tables.

Overview

If London takes both sides of the Asian range, it labels a potential day and can show a warning table for the New York session. After New York, it labels the day successful when chosen criteria are met, such as staying inside or exceeding the London range, closing inside it or having a small range. A statistics table summarises the results. Session hours, colours and tables are adjustable.

Details

Published by

Ahmed1926 on GitHub

Code credit

tradeforopp, as written in the script's header

Draws

On the price chart

Markets

Any symbol

Timeframes

M15-H1

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
Asiasession2000-0300as_am
askz_colorcolorcolor.new(color.blue, 80)askz_color
Londonsession0300-0830lo_am
ldkz_colorcolorcolor.new(color.yellow, 80)ldkz_color
New Yorksession0830-1600ny_am
nykz_colorcolorcolor.new(color.green, 80)nykz_color
NY Stays Within London Rangebooltruecrt_inside_day
NY Exceeds London High & Lowbooltruecrt_outside_day
NY Closes Within London Rangebooltruecrt_close_in_lo
NY Range Too Smallbooltruecrt_sd_limit
sd_limitfloat1.0sd_limit
Potential S&D Daybooltrueshow_snd_pre
Show all 28 settings
SettingTypeDefaultVariable
snd_pre_colorcolor#f23645snd_pre_color
Successful S&D Daybooltrueshow_snd_day
snd_day_colorcolor#089981snd_day_color
Show Warningbooltrueshow_wrn_table
Warning MessagestringPotential S&D Daywrn_msg
Text Colorcolorcolor.whitewrn_text
Table Backgroundcolor#f23645wrn_bg
Show Statistics Tablebooltrueshow_stat_table
Table PositionstringTop Righttable_position
Text SizestringAutotable_size
Textcolorcolor.blacktable_text
Table Backgroundcolorcolor.whitetable_bg
Table Framecolorcolor.blacktable_frame
Table Bordercolorcolor.blacktable_border
Table Border Widthint1table_border_width
Table Frame Widthint2table_frame_width
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

Golden Bullet Strategy

by TradersPost
228 stars

The Golden Bullet Strategy is an overlay signal indicator based on Smart Money Concepts and time-based liquidity models. It identifies liquidity sweeps of a designated reference session range during a specified hunt window. It then confirms Market Structure Sh

Indicator v6 SMC / ICT / price actionSessions & time
Updated 3 months ago · None stated GitHub repository of Golden Bullet Strategy

This indicator detects and draws the first Fair Value Gap (FVG) that forms in each hourly session based on a selected lower timeframe, with specialized handling for Regular Trading Hours (RTH) confluence windows. It draws FVG range boxes, midpoint lines, hourl

Indicator v5 SMC / ICT / price actionSupport & resistance Repaints

Clusterbreak

by Jferheart
15 stars

This indicator identifies Break of Structure (BOS) and Market Structure Shift (MSS) zones, plotting automated bracket levels on the price chart. It triggers signals when a reversal breaks a swing point formed inside an opposing zone, projecting stop loss and t

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated 4 weeks ago · None stated GitHub repository of Clusterbreak

MyTTFM - Clean

by dbruce1990
12 stars

MyTTFM - Clean draws a higher-timeframe candle overlay on the price chart and marks related ICT fractal structure. It plots configurable HTF candles, period separator lines, midpoint levels, a T-Spot box, and labels for recent C2 and C3 patterns plus swept lev

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · None stated GitHub repository of MyTTFM - Clean
9 stars

Smart Money Dashboard plots key Smart Money Concepts on the price chart, including Order Blocks with mitigation tracking, Fair Value Gaps, and Equal Highs or Lows sweeps. It analyzes Cumulative Volume Delta for divergence and combines multi-timeframe structure

Indicator v6 SMC / ICT / price actionVolume
Updated 3 days ago · MIT GitHub repository of Smart Money Dashboard

This indicator overlays a market structure dashboard on the price chart. It reads up to seven user-selected timeframes, each with an on/off switch and a trend weight, and shows columns for EMA trend, swing highs and lows, structure, order blocks, and fair valu

Indicator v6 Screeners & dashboardsSMC / ICT / price action
Updated 3 months ago · None stated GitHub repository of Market Structure Dashboard | Flux Charts

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