Killzones EUR/GBP - Manuel De Jesus Leiva// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © tradeforopp
//@version=6
indicator("Killzones EUR/GBP - Manuel De Jesus Leiva", "Killzones EUR/GBP - Manuel De Jesus Leiva", true, max_labels_count = 500, max_lines_count = 500, max_boxes_count = 500)
// ---------------------------------------- Constant Functions --------------------------------------------------
get_line_type(_style) =>
switch _style
"Solid" => line.style_solid
"Dotted" => line.style_dotted
"Dashed" => line.style_dashed
get_size(x) =>
switch x
"Auto" => size.auto
"Tiny" => size.tiny
"Small" => size.small
"Normal" => size.normal
"Large" => size.large
"Huge" => size.huge
get_table_pos(pos) =>
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
// ---------------------------------------- Constant Functions --------------------------------------------------
// ---------------------------------------- Inputs --------------------------------------------------
var g_SETTINGS = "Settings"
max_days = input.int(1000, "Session Drawing Limit", 1, tooltip = "Only this many drawings will be kept on the chart, for each selected drawing type (killzone boxes, pivot lines, open lines, etc.). Set to 200 for ~6 months of sessions.", group = g_SETTINGS)
tf_limit = input.timeframe("60", "Timeframe Limit", tooltip = "Drawings will not appear on timeframes greater than or equal to this", group = g_SETTINGS)
gmt_tz = input.string('America/New_York', "Timezone", options = , tooltip = "Note GMT is not adjusted to reflect Daylight Saving Time changes", group = g_SETTINGS)
lbl_size = get_size(input.string('Normal', "Label Size", options = , tooltip = "The size of all labels", group = g_SETTINGS))
txt_color = input.color(color.black, "Text Color", tooltip = "The color of all label and table text", group = g_SETTINGS)
use_cutoff = input.bool(false, "Drawing Cutoff Time", inline = "CO", tooltip = "When enabled, all pivots and open price lines will stop extending at this time", group = g_SETTINGS)
cutoff = input.session("1800-1801", "", inline = "CO", group = g_SETTINGS)
var tf_limit_is_equal_or_more_chart_tf = timeframe.in_seconds('') <= timeframe.in_seconds(tf_limit)
var g_KZ = "Killzones"
// General Killzone Settings
show_kz = input.bool(true, "Show Killzone Boxes", inline = "KZ", group = g_KZ)
show_kz_text = input.bool(false, "Display Text", inline = "KZ", group = g_KZ)
box_transparency = input.int(70, "Box Transparency", 0, 100, group = g_KZ)
text_transparency = input.int(50, "Text Transparency", 0, 100, group = g_KZ)
// ==================== KILLZONE 01 ====================
use_kz01 = input.bool(true, "00:00-01:00", inline = "KZ01", group = g_KZ)
kz01_txt = input.string("00-01", "", inline = "KZ01", group = g_KZ)
kz01 = input.session("0000-0100", "", inline = "KZ01", group = g_KZ)
kz01_color = input.color(color.blue, "", inline = "KZ01", group = g_KZ)
// ==================== KILLZONE 02 ====================
use_kz02 = input.bool(true, "01:00-02:00", inline = "KZ02", group = g_KZ)
kz02_txt = input.string("01-02", "", inline = "KZ02", group = g_KZ)
kz02 = input.session("0100-0200", "", inline = "KZ02", group = g_KZ)
kz02_color = input.color(color.blue, "", inline = "KZ02", group = g_KZ)
// ==================== KILLZONE 03 ====================
use_kz03 = input.bool(true, "02:00-03:00", inline = "KZ03", group = g_KZ)
kz03_txt = input.string("02-03", "", inline = "KZ03", group = g_KZ)
kz03 = input.session("0200-0300", "", inline = "KZ03", group = g_KZ)
kz03_color = input.color(color.blue, "", inline = "KZ03", group = g_KZ)
// ==================== KILLZONE 04 ====================
use_kz04 = input.bool(true, "03:00-04:00", inline = "KZ04", group = g_KZ)
kz04_txt = input.string("03-04", "", inline = "KZ04", group = g_KZ)
kz04 = input.session("0300-0400", "", inline = "KZ04", group = g_KZ)
kz04_color = input.color(color.blue, "", inline = "KZ04", group = g_KZ)
// ==================== KILLZONE 05 ====================
use_kz05 = input.bool(true, "04:00-05:00", inline = "KZ05", group = g_KZ)
kz05_txt = input.string("04-05", "", inline = "KZ05", group = g_KZ)
kz05 = input.session("0400-0500", "", inline = "KZ05", group = g_KZ)
kz05_color = input.color(color.blue, "", inline = "KZ05", group = g_KZ)
// ==================== KILLZONE 06 ====================
use_kz06 = input.bool(true, "05:00-06:00", inline = "KZ06", group = g_KZ)
kz06_txt = input.string("05-06", "", inline = "KZ06", group = g_KZ)
kz06 = input.session("0500-0600", "", inline = "KZ06", group = g_KZ)
kz06_color = input.color(color.blue, "", inline = "KZ06", group = g_KZ)
// ==================== KILLZONE 07 ====================
use_kz07 = input.bool(true, "06:00-07:00", inline = "KZ07", group = g_KZ)
kz07_txt = input.string("06-07", "", inline = "KZ07", group = g_KZ)
kz07 = input.session("0600-0700", "", inline = "KZ07", group = g_KZ)
kz07_color = input.color(color.blue, "", inline = "KZ07", group = g_KZ)
// ==================== KILLZONE 08 ====================
use_kz08 = input.bool(true, "07:00-08:00", inline = "KZ08", group = g_KZ)
kz08_txt = input.string("07-08", "", inline = "KZ08", group = g_KZ)
kz08 = input.session("0700-0800", "", inline = "KZ08", group = g_KZ)
kz08_color = input.color(color.blue, "", inline = "KZ08", group = g_KZ)
// ==================== KILLZONE 09 ====================
use_kz09 = input.bool(true, "08:00-09:00", inline = "KZ09", group = g_KZ)
kz09_txt = input.string("08-09", "", inline = "KZ09", group = g_KZ)
kz09 = input.session("0800-0900", "", inline = "KZ09", group = g_KZ)
kz09_color = input.color(color.blue, "", inline = "KZ09", group = g_KZ)
// ==================== KILLZONE 10 ====================
use_kz10 = input.bool(true, "09:00-10:00", inline = "KZ10", group = g_KZ)
kz10_txt = input.string("09-10", "", inline = "KZ10", group = g_KZ)
kz10 = input.session("0900-1000", "", inline = "KZ10", group = g_KZ)
kz10_color = input.color(color.blue, "", inline = "KZ10", group = g_KZ)
// ==================== KILLZONE 11 ====================
use_kz11 = input.bool(true, "10:00-11:00", inline = "KZ11", group = g_KZ)
kz11_txt = input.string("10-11", "", inline = "KZ11", group = g_KZ)
kz11 = input.session("1000-1100", "", inline = "KZ11", group = g_KZ)
kz11_color = input.color(color.blue, "", inline = "KZ11", group = g_KZ)
// ==================== KILLZONE 12 ====================
use_kz12 = input.bool(true, "11:00-12:00", inline = "KZ12", group = g_KZ)
kz12_txt = input.string("11-12", "", inline = "KZ12", group = g_KZ)
kz12 = input.session("1100-1200", "", inline = "KZ12", group = g_KZ)
kz12_color = input.color(color.blue, "", inline = "KZ12", group = g_KZ)
// ==================== KILLZONE 13 ====================
use_kz13 = input.bool(true, "12:00-13:00", inline = "KZ13", group = g_KZ)
kz13_txt = input.string("12-13", "", inline = "KZ13", group = g_KZ)
kz13 = input.session("1200-1300", "", inline = "KZ13", group = g_KZ)
kz13_color = input.color(color.blue, "", inline = "KZ13", group = g_KZ)
// ==================== KILLZONE 14 ====================
use_kz14 = input.bool(true, "13:00-14:00", inline = "KZ14", group = g_KZ)
kz14_txt = input.string("13-14", "", inline = "KZ14", group = g_KZ)
kz14 = input.session("1300-1400", "", inline = "KZ14", group = g_KZ)
kz14_color = input.color(color.blue, "", inline = "KZ14", group = g_KZ)
// ==================== KILLZONE 15 ====================
use_kz15 = input.bool(true, "14:00-15:00", inline = "KZ15", group = g_KZ)
kz15_txt = input.string("14-15", "", inline = "KZ15", group = g_KZ)
kz15 = input.session("1400-1500", "", inline = "KZ15", group = g_KZ)
kz15_color = input.color(color.blue, "", inline = "KZ15", group = g_KZ)
// ==================== KILLZONE 16 ====================
use_kz16 = input.bool(true, "15:00-16:00", inline = "KZ16", group = g_KZ)
kz16_txt = input.string("15-16", "", inline = "KZ16", group = g_KZ)
kz16 = input.session("1500-1600", "", inline = "KZ16", group = g_KZ)
kz16_color = input.color(color.blue, "", inline = "KZ16", group = g_KZ)
// ==================== KILLZONE 17 ====================
use_kz17 = input.bool(true, "16:00-17:00", inline = "KZ17", group = g_KZ)
kz17_txt = input.string("16-17", "", inline = "KZ17", group = g_KZ)
kz17 = input.session("1600-1700", "", inline = "KZ17", group = g_KZ)
kz17_color = input.color(color.blue, "", inline = "KZ17", group = g_KZ)
// ==================== KILLZONE 18 ====================
use_kz18 = input.bool(true, "17:00-18:00", inline = "KZ18", group = g_KZ)
kz18_txt = input.string("17-18", "", inline = "KZ18", group = g_KZ)
kz18 = input.session("1700-1800", "", inline = "KZ18", group = g_KZ)
kz18_color = input.color(color.blue, "", inline = "KZ18", group = g_KZ)
// ==================== KILLZONE 19 ====================
use_kz19 = input.bool(true, "18:00-19:00", inline = "KZ19", group = g_KZ)
kz19_txt = input.string("18-19", "", inline = "KZ19", group = g_KZ)
kz19 = input.session("1800-1900", "", inline = "KZ19", group = g_KZ)
kz19_color = input.color(color.blue, "", inline = "KZ19", group = g_KZ)
// ==================== KILLZONE 20 ====================
use_kz20 = input.bool(true, "19:00-20:00", inline = "KZ20", group = g_KZ)
kz20_txt = input.string("19-20", "", inline = "KZ20", group = g_KZ)
kz20 = input.session("1900-2000", "", inline = "KZ20", group = g_KZ)
kz20_color = input.color(color.blue, "", inline = "KZ20", group = g_KZ)
// ==================== KILLZONE 21 ====================
use_kz21 = input.bool(true, "20:00-21:00", inline = "KZ21", group = g_KZ)
kz21_txt = input.string("20-21", "", inline = "KZ21", group = g_KZ)
kz21 = input.session("2000-2100", "", inline = "KZ21", group = g_KZ)
kz21_color = input.color(color.blue, "", inline = "KZ21", group = g_KZ)
// ==================== KILLZONE 22 ====================
use_kz22 = input.bool(true, "21:00-22:00", inline = "KZ22", group = g_KZ)
kz22_txt = input.string("21-22", "", inline = "KZ22", group = g_KZ)
kz22 = input.session("2100-2200", "", inline = "KZ22", group = g_KZ)
kz22_color = input.color(color.blue, "", inline = "KZ22", group = g_KZ)
// ==================== KILLZONE 23 ====================
use_kz23 = input.bool(true, "22:00-23:00", inline = "KZ23", group = g_KZ)
kz23_txt = input.string("22-23", "", inline = "KZ23", group = g_KZ)
kz23 = input.session("2200-2300", "", inline = "KZ23", group = g_KZ)
kz23_color = input.color(color.blue, "", inline = "KZ23", group = g_KZ)
// ==================== KILLZONE 24 ====================
use_kz24 = input.bool(true, "23:00-00:00", inline = "KZ24", group = g_KZ)
kz24_txt = input.string("23-00", "", inline = "KZ24", group = g_KZ)
kz24 = input.session("2300-0000", "", inline = "KZ24", group = g_KZ)
kz24_color = input.color(color.blue, "", inline = "KZ24", group = g_KZ)
// ==================== KILLZONE 25 ====================
use_kz25 = input.bool(true, "17:00-21:00", inline = "KZ25", group = g_KZ)
kz25_txt = input.string("17-21", "", inline = "KZ25", group = g_KZ)
kz25 = input.session("1700-2100", "", inline = "KZ25", group = g_KZ)
kz25_color = input.color(color.orange, "", inline = "KZ25", group = g_KZ)
// ==================== KILLZONE 26 ====================
use_kz26 = input.bool(true, "21:00-01:00", inline = "KZ26", group = g_KZ)
kz26_txt = input.string("21-01", "", inline = "KZ26", group = g_KZ)
kz26 = input.session("2100-0100", "", inline = "KZ26", group = g_KZ)
kz26_color = input.color(color.aqua, "", inline = "KZ26", group = g_KZ)
// ==================== KILLZONE 27 ====================
use_kz27 = input.bool(true, "01:00-05:00", inline = "KZ27", group = g_KZ)
kz27_txt = input.string("01-05", "", inline = "KZ27", group = g_KZ)
kz27 = input.session("0100-0500", "", inline = "KZ27", group = g_KZ)
kz27_color = input.color(color.green, "", inline = "KZ27", group = g_KZ)
// ==================== KILLZONE 28 ====================
use_kz28 = input.bool(true, "05:00-09:00", inline = "KZ28", group = g_KZ)
kz28_txt = input.string("05-09", "", inline = "KZ28", group = g_KZ)
kz28 = input.session("0500-0900", "", inline = "KZ28", group = g_KZ)
kz28_color = input.color(color.yellow, "", inline = "KZ28", group = g_KZ)
// ==================== KILLZONE 29 ====================
use_kz29 = input.bool(true, "09:00-13:00", inline = "KZ29", group = g_KZ)
kz29_txt = input.string("09-13", "", inline = "KZ29", group = g_KZ)
kz29 = input.session("0900-1300", "", inline = "KZ29", group = g_KZ)
kz29_color = input.color(color.red, "", inline = "KZ29", group = g_KZ)
// ==================== KILLZONE 30 ====================
use_kz30 = input.bool(true, "13:00-17:00", inline = "KZ30", group = g_KZ)
kz30_txt = input.string("13-17", "", inline = "KZ30", group = g_KZ)
kz30 = input.session("1300-1700", "", inline = "KZ30", group = g_KZ)
kz30_color = input.color(color.purple, "", inline = "KZ30", group = g_KZ)
var g_LABELS = "Killzone Pivots"
show_pivots = input.bool(false, "Show Pivots", inline = "PV", group = g_LABELS)
use_alerts = input.bool(false, "Alert Broken Pivots", inline = "PV", tooltip = "The desired killzones must be enabled at the time that an alert is created, along with the show pivots option, in order for alerts to work", group = g_LABELS)
show_midpoints = input.bool(false, "Show Pivot Midpoints", inline = "mp", group = g_LABELS)
stop_midpoints = input.bool(false, "Stop Once Mitigated", inline = "mp", group = g_LABELS)
show_labels = input.bool(false, "Show Pivot Labels", inline = "LB", tooltip = "Show labels denoting each killzone's high and low. Optionally choose to show the price of each level. Right side will show labels on the right-hand side of the chart until they are reached", group = g_LABELS)
label_price = input.bool(false, "Display Price", inline = "LB", group = g_LABELS)
label_right = input.bool(false, "Right Side", inline = "LB", group = g_LABELS)
ext_pivots = input.string("Until Mitigated", "Extend Pivots...", options = , group = g_LABELS)
ext_which = input.string("All", "...From Which Sessions", options = , group = g_LABELS)
ash_str = input.string("AS.H", "Killzone 1 Labels", inline = "L_AS", group = g_LABELS)
asl_str = input.string("AS.L", "", inline = "L_AS", group = g_LABELS)
loh_str = input.string("LO.H", "Killzone 2 Labels", inline = "L_LO", group = g_LABELS)
lol_str = input.string("LO.L", "", inline = "L_LO", group = g_LABELS)
nah_str = input.string("NYAM.H", "Killzone 3 Labels", inline = "L_NA", group = g_LABELS)
nal_str = input.string("NYAM.L", "", inline = "L_NA", group = g_LABELS)
nlh_str = input.string("NYL.H", "Killzone 4 Labels", inline = "L_NL", group = g_LABELS)
nll_str = input.string("NYL.L", "", inline = "L_NL", group = g_LABELS)
nph_str = input.string("NYPM.H", "Killzone 5 Labels", inline = "L_NP", group = g_LABELS)
npl_str = input.string("NYPM.L", "", inline = "L_NP", group = g_LABELS)
kzp_style = get_line_type(input.string(defval = 'Solid', title = "Pivot Style", options = , inline = "KZP", group = g_LABELS))
kzp_width = input.int(1, "", inline = "KZP", group = g_LABELS)
kzm_style = get_line_type(input.string(defval = 'Dotted', title = "Midpoint Style", options = , inline = "KZM", group = g_LABELS))
kzm_width = input.int(1, "", inline = "KZM", group = g_LABELS)
var g_RNG = "Killzone Range"
show_range = input.bool(false, "Show Killzone Range", tooltip = "Show the most recent ranges of each selected killzone, from high to low", group = g_RNG)
show_range_avg = input.bool(false, "Show Average", tooltip = "Show the average range of each selected killzone", group = g_RNG)
range_avg = input.int(5, "Average Length", 0, tooltip = "This many previous sessions will be used to calculate the average. If there isn't enough data on the current chart, it will use as many sessions as possible", group = g_RNG)
range_pos = get_table_pos(input.string('Top Right', "Table Position", options = , group = g_RNG))
range_size = get_size(input.string('Normal', "Table Size", options = , group = g_RNG))
var g_DWM = "Day - Week - Month"
sep_unlimited = input.bool(false, "Unlimited", tooltip = "Unlimited will show as many of the selected lines as possible. Otherwise, the session drawing limit will be used", group = g_DWM)
alert_HL = input.bool(false, "Alert High/Low Break", tooltip = "Alert when any selected highs and lows are traded through. The desired timeframe's high/low option must be enabled at the time that an alert is created", group = g_DWM)
show_d_open = input.bool(false, "D Open", inline = "DO", group = g_DWM)
dhl = input.bool(false, "High/Low", inline = "DO", tooltip = "", group = g_DWM)
ds = input.bool(false, "Separators", inline = "DO", tooltip = "Mark where a new day begins", group = g_DWM)
d_color = input.color(color.blue, "", inline = "DO", group = g_DWM)
show_w_open = input.bool(false, "W Open", inline = "WO", group = g_DWM)
whl = input.bool(false, "High/Low", inline = "WO", tooltip = "", group = g_DWM)
ws = input.bool(false, "Separators", inline = "WO", tooltip = "Mark where a new week begins", group = g_DWM)
w_color = input.color(#089981, "", inline = "WO", group = g_DWM)
show_m_open = input.bool(false, "M Open", inline = "MO", group = g_DWM)
mhl = input.bool(false, "High/Low", inline = "MO", tooltip = "", group = g_DWM)
ms = input.bool(false, "Separators", inline = "MO", tooltip = "Mark where a new month begins", group = g_DWM)
m_color = input.color(color.red, "", inline = "MO", group = g_DWM)
htf_style = get_line_type(input.string(defval = 'Solid', title = "Style", options = , inline = "D0", group = g_DWM))
htf_width = input.int(1, "", inline = "D0", group = g_DWM)
dow_labels = input.bool(false, "Day of Week Labels", inline = "DOW", group = g_DWM)
dow_yloc = input.string('Bottom', "", options = , inline = "DOW", group = g_DWM)
dow_xloc = input.string('Midnight', "", options = , inline = "DOW", group = g_DWM)
dow_hide_wknd = input.bool(false, "Hide Weekend Labels", group = g_DWM)
var g_OPEN = "Opening Prices"
open_unlimited = input.bool(false, "Unlimited", tooltip = "Unlimited will show as many of the selected lines as possible. Otherwise, the session drawing limit will be used", group = g_OPEN)
use_h1 = input.bool(false, "", inline = "H1", group = g_OPEN)
h1_text = input.string("17:00 H12/H8/H6/H4", "", inline = "H1", group = g_OPEN)
h1 = input.session("1700-1701", "", inline = "H1", group = g_OPEN)
h1_color = input.color(color.black, "", inline = "H1", group = g_OPEN)
use_h2 = input.bool(false, "", inline = "H2", group = g_OPEN)
h2_text = input.string("05:00 H12/H6/H4", "", inline = "H2", group = g_OPEN)
h2 = input.session("0500-0501", "", inline = "H2", group = g_OPEN)
h2_color = input.color(color.black, "", inline = "H2", group = g_OPEN)
use_h3 = input.bool(false, "", inline = "H3", group = g_OPEN)
h3_text = input.string("01:00 H8/H4", "", inline = "H3", group = g_OPEN)
h3 = input.session("0100-0101", "", inline = "H3", group = g_OPEN)
h3_color = input.color(color.black, "", inline = "H3", group = g_OPEN)
use_h4 = input.bool(false, "", inline = "H4", group = g_OPEN)
h4_text = input.string("09:00 H8/H4", "", inline = "H4", group = g_OPEN)
h4 = input.session("0900-0901", "", inline = "H4", group = g_OPEN)
h4_color = input.color(color.black, "", inline = "H4", group = g_OPEN)
use_h5 = input.bool(false, "", inline = "H5", group = g_OPEN)
h5_text = input.string("23:00 H6", "", inline = "H5", group = g_OPEN)
h5 = input.session("2300-2301", "", inline = "H5", group = g_OPEN)
h5_color = input.color(color.black, "", inline = "H5", group = g_OPEN)
use_h6 = input.bool(false, "", inline = "H6", group = g_OPEN)
h6_text = input.string("11:00 H6", "", inline = "H6", group = g_OPEN)
h6 = input.session("1100-1101", "", inline = "H6", group = g_OPEN)
h6_color = input.color(color.black, "", inline = "H6", group = g_OPEN)
use_h7 = input.bool(false, "", inline = "H7", group = g_OPEN)
h7_text = input.string("21:00 H4", "", inline = "H7", group = g_OPEN)
h7 = input.session("2100-2101", "", inline = "H7", group = g_OPEN)
h7_color = input.color(color.black, "", inline = "H7", group = g_OPEN)
use_h8 = input.bool(false, "", inline = "H8", group = g_OPEN)
h8_text = input.string("13:00 H4", "", inline = "H8", group = g_OPEN)
h8 = input.session("1300-1301", "", inline = "H8", group = g_OPEN)
h8_color = input.color(color.black, "", inline = "H8", group = g_OPEN)
hz_style = get_line_type(input.string(defval = 'Dotted', title = "Style", options = , inline = "H0", group = g_OPEN))
hz_width = input.int(1, "", inline = "H0", group = g_OPEN)
var g_VERTICAL = "Timestamps"
v_unlimited = input.bool(false, "Unlimited", tooltip = "Unlimited will show as many of the selected lines as possible. Otherwise, the session drawing limit will be used", group = g_VERTICAL)
use_v1 = input.bool(false, "", inline = "V1", group = g_VERTICAL)
v1 = input.session("0000-0001", "", inline = "V1", group = g_VERTICAL)
v1_color = input.color(color.black, "", inline = "V1", group = g_VERTICAL)
use_v2 = input.bool(false, "", inline = "V2", group = g_VERTICAL)
v2 = input.session("0800-0801", "", inline = "V2", group = g_VERTICAL)
v2_color = input.color(color.black, "", inline = "V2", group = g_VERTICAL)
use_v3 = input.bool(false, "", inline = "V3", group = g_VERTICAL)
v3 = input.session("1000-1001", "", inline = "V3", group = g_VERTICAL)
v3_color = input.color(color.black, "", inline = "V3", group = g_VERTICAL)
use_v4 = input.bool(false, "", inline = "V4", group = g_VERTICAL)
v4 = input.session("1200-1201", "", inline = "V4", group = g_VERTICAL)
v4_color = input.color(color.black, "", inline = "V4", group = g_VERTICAL)
vl_style = get_line_type(input.string(defval = 'Dotted', title = "Style", options = , inline = "V0", group = g_VERTICAL))
vl_width = input.int(1, "", inline = "V0", group = g_VERTICAL)
// ---------------------------------------- Inputs --------------------------------------------------
// ---------------------------------------- Variables & Constants --------------------------------------------------
type kz
string _title
array _box
array _hi_line
array _md_line
array _lo_line
array _hi_label
array _lo_label
array _hi_valid
array _md_valid
array _lo_valid
array _range_store
float _range_current
type hz
array LN
array LB
array CO
type dwm_hl
array hi_line
array lo_line
array hi_label
array lo_label
bool hit_high = false
bool hit_low = false
type dwm_info
string tf
float o = na
float h = na
float l = na
float ph = na
float pl = na
type lines_helper
hz _hz
string h
string h_text
color h_color
initLines() =>
array res = array.new()
if use_h1
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h1, h1_text, h1_color))
if use_h2
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h2, h2_text, h2_color))
if use_h3
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h3, h3_text, h3_color))
if use_h4
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h4, h4_text, h4_color))
if use_h5
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h5, h5_text, h5_color))
if use_h6
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h6, h6_text, h6_color))
if use_h7
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h7, h7_text, h7_color))
if use_h8
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h8, h8_text, h8_color))
res
var array lines = initLines()
type kz_helper
kz _kz
string session
color c
string box_txt
string hi_txt
string lo_txt
initKZ() =>
array res = array.new()
if use_kz01
res.push(kz_helper.new(
kz.new(kz01_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz01, kz01_color, kz01_txt, "KZ01.H", "KZ01.L"
))
if use_kz02
res.push(kz_helper.new(
kz.new(kz02_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz02, kz02_color, kz02_txt, "KZ02.H", "KZ02.L"
))
if use_kz03
res.push(kz_helper.new(
kz.new(kz03_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz03, kz03_color, kz03_txt, "KZ03.H", "KZ03.L"
))
if use_kz04
res.push(kz_helper.new(
kz.new(kz04_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz04, kz04_color, kz04_txt, "KZ04.H", "KZ04.L"
))
if use_kz05
res.push(kz_helper.new(
kz.new(kz05_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz05, kz05_color, kz05_txt, "KZ05.H", "KZ05.L"
))
if use_kz06
res.push(kz_helper.new(
kz.new(kz06_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz06, kz06_color, kz06_txt, "KZ06.H", "KZ06.L"
))
if use_kz07
res.push(kz_helper.new(
kz.new(kz07_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz07, kz07_color, kz07_txt, "KZ07.H", "KZ07.L"
))
if use_kz08
res.push(kz_helper.new(
kz.new(kz08_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz08, kz08_color, kz08_txt, "KZ08.H", "KZ08.L"
))
if use_kz09
res.push(kz_helper.new(
kz.new(kz09_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz09, kz09_color, kz09_txt, "KZ09.H", "KZ09.L"
))
if use_kz10
res.push(kz_helper.new(
kz.new(kz10_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz10, kz10_color, kz10_txt, "KZ10.H", "KZ10.L"
))
if use_kz11
res.push(kz_helper.new(
kz.new(kz11_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz11, kz11_color, kz11_txt, "KZ11.H", "KZ11.L"
))
if use_kz12
res.push(kz_helper.new(
kz.new(kz12_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz12, kz12_color, kz12_txt, "KZ12.H", "KZ12.L"
))
if use_kz13
res.push(kz_helper.new(
kz.new(kz13_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz13, kz13_color, kz13_txt, "KZ13.H", "KZ13.L"
))
if use_kz14
res.push(kz_helper.new(
kz.new(kz14_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz14, kz14_color, kz14_txt, "KZ14.H", "KZ14.L"
))
if use_kz15
res.push(kz_helper.new(
kz.new(kz15_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz15, kz15_color, kz15_txt, "KZ15.H", "KZ15.L"
))
if use_kz16
res.push(kz_helper.new(
kz.new(kz16_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz16, kz16_color, kz16_txt, "KZ16.H", "KZ16.L"
))
if use_kz17
res.push(kz_helper.new(
kz.new(kz17_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz17, kz17_color, kz17_txt, "KZ17.H", "KZ17.L"
))
if use_kz18
res.push(kz_helper.new(
kz.new(kz18_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz18, kz18_color, kz18_txt, "KZ18.H", "KZ18.L"
))
if use_kz19
res.push(kz_helper.new(
kz.new(kz19_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz19, kz19_color, kz19_txt, "KZ19.H", "KZ19.L"
))
if use_kz20
res.push(kz_helper.new(
kz.new(kz20_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz20, kz20_color, kz20_txt, "KZ20.H", "KZ20.L"
))
if use_kz21
res.push(kz_helper.new(
kz.new(kz21_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz21, kz21_color, kz21_txt, "KZ21.H", "KZ21.L"
))
if use_kz22
res.push(kz_helper.new(
kz.new(kz22_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz22, kz22_color, kz22_txt, "KZ22.H", "KZ22.L"
))
if use_kz23
res.push(kz_helper.new(
kz.new(kz23_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz23, kz23_color, kz23_txt, "KZ23.H", "KZ23.L"
))
if use_kz24
res.push(kz_helper.new(
kz.new(kz24_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz24, kz24_color, kz24_txt, "KZ24.H", "KZ24.L"
))
if use_kz25
res.push(kz_helper.new(
kz.new(kz25_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz25, kz25_color, kz25_txt, "KZ25.H", "KZ25.L"
))
if use_kz26
res.push(kz_helper.new(
kz.new(kz26_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz26, kz26_color, kz26_txt, "KZ26.H", "KZ26.L"
))
if use_kz27
res.push(kz_helper.new(
kz.new(kz27_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz27, kz27_color, kz27_txt, "KZ27.H", "KZ27.L"
))
if use_kz28
res.push(kz_helper.new(
kz.new(kz28_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz28, kz28_color, kz28_txt, "KZ28.H", "KZ28.L"
))
if use_kz29
res.push(kz_helper.new(
kz.new(kz29_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz29, kz29_color, kz29_txt, "KZ29.H", "KZ29.L"
))
if use_kz30
res.push(kz_helper.new(
kz.new(kz30_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz30, kz30_color, kz30_txt, "KZ30.H", "KZ30.L"
))
res
var array _kz = initKZ()
var d_hl = dwm_hl.new(array.new_line(), array.new_line(), array.new_label(), array.new_label())
var w_hl = dwm_hl.new(array.new_line(), array.new_line(), array.new_label(), array.new_label())
var m_hl = dwm_hl.new(array.new_line(), array.new_line(), array.new_label(), array.new_label())
var d_info = dwm_info.new("D")
var w_info = dwm_info.new("W")
var m_info = dwm_info.new("M")
t_co = not na(time("", cutoff, gmt_tz))
type ts_helper
string session
array lines
color c
initTS() =>
array res = array.new()
if use_v1
res.push(ts_helper.new(v1, array.new_line(), v1_color))
if use_v2
res.push(ts_helper.new(v2, array.new_line(), v2_color))
if use_v3
res.push(ts_helper.new(v3, array.new_line(), v3_color))
if use_v4
res.push(ts_helper.new(v4, array.new_line(), v4_color))
res
var array ts_data = initTS()
var d_sep_line = array.new_line()
var w_sep_line = array.new_line()
var m_sep_line = array.new_line()
var d_line = array.new_line()
var w_line = array.new_line()
var m_line = array.new_line()
var d_label = array.new_label()
var w_label = array.new_label()
var m_label = array.new_label()
var transparent = #ffffff00
var ext_current = ext_which == 'Most Recent'
var ext_past = ext_pivots == 'Past Mitigation'
update_dwm_info(dwm_info n) =>
if timeframe.change(n.tf)
n.ph := n.h
n.pl := n.l
n.o := open
n.h := high
n.l := low
else
n.h := math.max(high, n.h)
n.l := math.min(low, n.l)
if dhl or show_d_open
update_dwm_info(d_info)
if whl or show_w_open
update_dwm_info(w_info)
if mhl or show_m_open
update_dwm_info(m_info)
// ---------------------------------------- Variables & Constants --------------------------------------------------
// ---------------------------------------- Functions --------------------------------------------------
get_box_color(color c) =>
color.new(c, box_transparency)
get_text_color(color c) =>
color.new(c, text_transparency)
// ---------------------------------------- Functions --------------------------------------------------
// ---------------------------------------- Core Logic --------------------------------------------------
dwm_sep(string tf, bool use, array arr, color col) =>
if use
if timeframe.change(tf)
arr.unshift(line.new(bar_index, high * 1.0001, bar_index, low, style = htf_style, width = htf_width, extend = extend.both, color = col))
if not sep_unlimited and arr.size() > max_days
arr.pop().delete()
dwm_open(string tf, bool use, array lns, array lbls, dwm_info n, color col) =>
if use
if lns.size() > 0
lns.get(0).set_x2(time)
lbls.get(0).set_x(time)
if timeframe.change(tf)
lns.unshift(line.new(time, n.o, time, n.o, xloc = xloc.bar_time, style = htf_style, width = htf_width, color = col))
lbls.unshift(label.new(time, n.o, tf + " OPEN", xloc = xloc.bar_time, style = label.style_label_left, color = transparent, textcolor = txt_color, size = lbl_size))
if not sep_unlimited and lns.size() > max_days
lns.pop().delete()
lbls.pop().delete()
dwm_hl(string tf, bool use, dwm_hl hl, dwm_info n, color col) =>
if use
if hl.hi_line.size() > 0
hl.hi_line.get(0).set_x2(time)
hl.lo_line.get(0).set_x2(time)
hl.hi_label.get(0).set_x(time)
hl.lo_label.get(0).set_x(time)
if timeframe.change(tf)
hl.hi_line.unshift(line.new(time, n.ph, time, n.ph, xloc = xloc.bar_time, style = htf_style, width = htf_width, color = col))
hl.lo_line.unshift(line.new(time, n.pl, time, n.pl, xloc = xloc.bar_time, style = htf_style, width = htf_width, color = col))
hl.hi_label.unshift(label.new(time, n.ph, "P" + tf + "H", xloc = xloc.bar_time, style = label.style_label_left, color = transparent, textcolor = txt_color, size = lbl_size))
hl.lo_label.unshift(label.new(time, n.pl, "P" + tf + "L", xloc = xloc.bar_time, style = label.style_label_left, color = transparent, textcolor = txt_color, size = lbl_size))
hl.hit_high := false
hl.hit_low := false
if not sep_unlimited and hl.hi_line.size() > max_days
hl.hi_line.pop().delete()
hl.lo_line.pop().delete()
hl.hi_label.pop().delete()
hl.lo_label.pop().delete()
if hl.hi_line.size() > 0 and alert_HL
if not hl.hit_high and high > hl.hi_line.get(0).get_y1()
hl.hit_high := true
alert(str.format("Hit P{0}H", tf))
if not hl.hit_low and low < hl.lo_line.get(0).get_y1()
hl.hit_low := true
alert(str.format("Hit P{0}L", tf))
dwm() =>
if tf_limit_is_equal_or_more_chart_tf
// DWM - Separators
dwm_sep("D", ds, d_sep_line, d_color)
dwm_sep("W", ws, w_sep_line, w_color)
dwm_sep("M", ms, m_sep_line, m_color)
// DWM - Open Lines
dwm_open("D", show_d_open, d_line, d_label, d_info, d_color)
dwm_open("W", show_w_open, w_line, w_label, w_info, w_color)
dwm_open("M", show_m_open, m_line, m_label, m_info, m_color)
// DWM - Highs and Lows
dwm_hl("D", dhl, d_hl, d_info, d_color)
dwm_hl("W", whl, w_hl, w_info, w_color)
dwm_hl("M", mhl, m_hl, m_info, m_color)
method vline(ts_helper this) =>
bool t = not na(time("", this.session, gmt_tz))
bool t_prev = not na(time("", this.session, gmt_tz, bars_back = 1))
array arr = this.lines
color col = this.c
if t and not t_prev
arr.unshift(line.new(bar_index, high * 1.0001, bar_index, low, style = vl_style, width = vl_width, extend = extend.both, color = col))
if not v_unlimited
if arr.size() > max_days
arr.pop().delete()
vlines() =>
if tf_limit_is_equal_or_more_chart_tf
for in ts_data
vline(value)
method hz_line(lines_helper this) =>
bool t = not na(time("", this.h, gmt_tz))
bool t_prev = not na(time("", this.h, gmt_tz, bars_back = 1))
hz hz = this._hz
string txt = this.h_text
color col = this.h_color
if t and not t_prev
hz.LN.unshift(line.new(bar_index, open, bar_index, open, style = hz_style, width = hz_width, color = col))
hz.LB.unshift(label.new(bar_index, open, txt, style = label.style_label_left, color = transparent, textcolor = txt_color, size = lbl_size))
array.unshift(hz.CO, false)
if not open_unlimited and hz.LN.size() > max_days
hz.LN.pop().delete()
hz.LB.pop().delete()
hz.CO.pop()
if not t and hz.CO.size() > 0
if not hz.CO.get(0)
hz.LN.get(0).set_x2(bar_index)
hz.LB.get(0).set_x(bar_index)
if (use_cutoff ? t_co : false)
hz.CO.set(0, true)
hz_lines() =>
if tf_limit_is_equal_or_more_chart_tf
for in lines
hz_line(value)
del_kz(kz k) =>
if k._box.size() > max_days
k._box.pop().delete()
if k._hi_line.size() > max_days
k._hi_line.pop().delete()
k._lo_line.pop().delete()
k._hi_valid.pop()
k._lo_valid.pop()
if show_midpoints
k._md_line.pop().delete()
k._md_valid.pop()
if k._hi_label.size() > max_days
k._hi_label.pop().delete()
k._lo_label.pop().delete()
update_price_string(label L, float P) =>
S = L.get_text()
pre = str.substring(S, 0, str.pos(S, " "))
str.trim(pre)
L.set_text(str.format("{0} ({1})", pre, P))
adjust_in_kz(kz kz, bool t) =>
if t
kzBox0 = kz._box.get(0)
kzBox0.set_right(time)
newTop = math.max(kzBox0.get_top(), high)
kzBox0.set_top(newTop)
newBottom = math.min(kzBox0.get_bottom(), low)
kzBox0.set_bottom(newBottom)
kz._range_current := newTop - newBottom
if show_pivots and kz._hi_line.size() > 0
kzHiLine0 = kz._hi_line.get(0)
kzHiLine0.set_x2(time)
if high > kzHiLine0.get_y1()
kzHiLine0.set_xy1(time, high)
kzHiLine0.set_xy2(time, high)
kzLoLine0 = kz._lo_line.get(0)
kzLoLine0.set_x2(time)
if low < kzLoLine0.get_y1()
kzLoLine0.set_xy1(time, low)
kzLoLine0.set_xy2(time, low)
if show_midpoints
kzMidLine0 = kz._md_line.get(0)
kzMidLine0.set_x2(time)
kzMidLine0.set_xy1(time, math.avg(kzHiLine0.get_y2(), kzLoLine0.get_y2()))
kzMidLine0.set_xy2(time, math.avg(kzHiLine0.get_y2(), kzLoLine0.get_y2()))
if show_labels and kz._hi_label.size() > 0
if label_right
kz._hi_label.get(0).set_x(time)
kz._lo_label.get(0).set_x(time)
if high > kz._hi_label.get(0).get_y()
kz._hi_label.get(0).set_xy(time, high)
if label_price
update_price_string(kz._hi_label.get(0), high)
if low < kz._lo_label.get(0).get_y()
kz._lo_label.get(0).set_xy(time, low)
if label_price
update_price_string(kz._lo_label.get(0), low)
adjust_out_kz(kz kz, bool t, bool t_prev) =>
boxCount = kz._box.size()
if not t and boxCount > 0
if t_prev
array.unshift(kz._range_store, kz._range_current)
if kz._range_store.size() > range_avg
kz._range_store.pop()
if show_pivots and boxCount > 0
for i = 0 to boxCount - 1 by 1
if not ext_current or i == 0
kzHiValid = kz._hi_valid.get(i)
if ext_past or kzHiValid
kz._hi_line.get(i).set_x2(time)
if show_labels and label_right
kz._hi_label.get(i).set_x(time)
if kzHiValid and high > kz._hi_line.get(i).get_y1()
if use_alerts and i == 0
alert('Broke ' + kz._title + ' High', alert.freq_once_per_bar)
kz._hi_valid.set(i, false)
if show_labels and label_right
kz._hi_label.get(i).set_style(label.style_label_down)
else if use_cutoff ? t_co : false
kz._hi_valid.set(i, false)
kzLoValid = kz._lo_valid.get(i)
if ext_past or kzLoValid
kz._lo_line.get(i).set_x2(time)
if show_labels and label_right
kz._lo_label.get(i).set_x(time)
if kzLoValid and low < kz._lo_line.get(i).get_y1()
if use_alerts and i == 0
alert("Broke " + kz._title + " Low", alert.freq_once_per_bar)
kz._lo_valid.set(i, false)
if show_labels and label_right
kz._lo_label.get(i).set_style(label.style_label_up)
else if use_cutoff ? t_co : false
kz._lo_valid.set(i, false)
if show_midpoints and not t
if stop_midpoints ? kz._md_valid.get(i) : true
kz._md_line.get(i).set_x2(time)
if kz._md_valid.get(i) and low <= kz._md_line.get(i).get_y1() and high >= kz._md_line.get(i).get_y1()
kz._md_valid.set(i, false)
else
break
method manage_kz(kz_helper this) =>
kz kz = this._kz
c = this.c
string box_txt = this.box_txt
string hi_txt = this.hi_txt
string lo_txt = this.lo_txt
if tf_limit_is_equal_or_more_chart_tf
t = not na(time("", this.session, gmt_tz))
t_prev = not na(time("", this.session, gmt_tz, bars_back = 1))
if t and not t_prev
_c = get_box_color(c)
_t = get_text_color(c)
kz._box.unshift(box.new(time, high, time, low, xloc = xloc.bar_time, border_color = show_kz ? _c : na, bgcolor = show_kz ? _c : na, text = show_kz and show_kz_text ? box_txt : na, text_color = _t))
if show_pivots
kz._hi_line.unshift(line.new(time, high, time, high, xloc = xloc.bar_time, style = kzp_style, color = c, width = kzp_width))
kz._lo_line.unshift(line.new(time, low, time, low, xloc = xloc.bar_time, style = kzp_style, color = c, width = kzp_width))
if show_midpoints
kz._md_line.unshift(line.new(time, math.avg(high, low), time, math.avg(high, low), xloc = xloc.bar_time, style = kzm_style, color = c, width = kzm_width))
array.unshift(kz._md_valid, true)
array.unshift(kz._hi_valid, true)
array.unshift(kz._lo_valid, true)
if show_labels
_hi_txt = label_price ? str.format('{0} ({1})', hi_txt, high) : hi_txt
_lo_txt = label_price ? str.format('{0} ({1})', lo_txt, low) : lo_txt
if label_right
kz._hi_label.unshift(label.new(time, high, _hi_txt, xloc = xloc.bar_time, color = transparent, textcolor = txt_color, style = label.style_label_left, size = lbl_size))
kz._lo_label.unshift(label.new(time, low, _lo_txt, xloc = xloc.bar_time, color = transparent, textcolor = txt_color, style = label.style_label_left, size = lbl_size))
else
kz._hi_label.unshift(label.new(time, high, _hi_txt, xloc = xloc.bar_time, color = transparent, textcolor = txt_color, style = label.style_label_down, size = lbl_size))
kz._lo_label.unshift(label.new(time, low, _lo_txt, xloc = xloc.bar_time, color = transparent, textcolor = txt_color, style = label.style_label_up, size = lbl_size))
del_kz(kz)
adjust_in_kz(kz, t)
adjust_out_kz(kz, t, t_prev)
for in _kz
manage_kz(value)
dwm()
vlines()
hz_lines()
new_dow_time = dow_xloc == 'Midday' ? time - timeframe.in_seconds("D") / 2 * 1000 : time
new_day = dayofweek(new_dow_time, gmt_tz) != dayofweek(new_dow_time, gmt_tz)
var dow_top = dow_yloc == 'Top'
var saturday = "SATURDAY"
var sunday = "SUNDAY"
var monday = "MONDAY"
var tuesday = "TUESDAY"
var wednesday = "WEDNESDAY"
var thursday = "THURSDAY"
var friday = "FRIDAY"
plotchar(dow_labels and timeframe.isintraday and dayofweek(new_dow_time, gmt_tz) == 1 and new_day and not dow_hide_wknd, location = dow_top ? location.top : location.bottom, char = '', textcolor = txt_color, text = sunday)
plotchar(dow_labels and timeframe.isintraday and dayofweek(new_dow_time, gmt_tz) == 2 and new_day, location = dow_top ? location.top : location.bottom, char = '', textcolor = txt_color, text = monday)
plotchar(dow_labels and timeframe.isintraday and dayofweek(new_dow_time, gmt_tz) == 3 and new_day, location = dow_top ? location.top : location.bottom, char = '', textcolor = txt_color, text = tuesday)
plotchar(dow_labels and timeframe.isintraday and dayofweek(new_dow_time, gmt_tz) == 4 and new_day, location = dow_top ? location.top : location.bottom, char = '', textcolor = txt_color, text = wednesday)
plotchar(dow_labels and timeframe.isintraday and dayofweek(new_dow_time, gmt_tz) == 5 and new_day, location = dow_top ? location.top : location.bottom, char = '', textcolor = txt_color, text = thursday)
plotchar(dow_labels and timeframe.isintraday and dayofweek(new_dow_time, gmt_tz) == 6 and new_day, location = dow_top ? location.top : location.bottom, char = '', textcolor = txt_color, text = friday)
plotchar(dow_labels and timeframe.isintraday and dayofweek(new_dow_time, gmt_tz) == 7 and new_day and not dow_hide_wknd, location = dow_top ? location.top : location.bottom, char = '', textcolor = txt_color, text = saturday)
get_min_days_stored() =>
store = array.new_int()
for in _kz
int tmpStoreSize = value._kz._range_store.size()
if tmpStoreSize > 0
store.push(tmpStoreSize)
store.min()
method set_table(table tbl, kz kz, int row, string txt, bool t, color col) =>
table.cell(tbl, 0, row, txt, text_size = range_size, bgcolor = get_box_color(col), text_color = txt_color)
table.cell(tbl, 1, row, str.tostring(kz._range_current), text_size = range_size, bgcolor = t ? get_box_color(col) : na, text_color = txt_color)
if show_range_avg
table.cell(tbl, 2, row, str.tostring(kz._range_store.avg()), text_size = range_size, text_color = txt_color)
if show_range and barstate.islast
var tbl = table.new(range_pos, 10, 10, chart.bg_color, chart.fg_color, 2, chart.fg_color, 1)
table.cell(tbl, 0, 0, "Killzone", text_size = range_size, text_color = txt_color)
table.cell(tbl, 1, 0, "Range", text_size = range_size, text_color = txt_color)
if show_range_avg
table.cell(tbl, 2, 0, "Avg (" + str.tostring(get_min_days_stored()) + ")", text_size = range_size, text_color = txt_color)
for in _kz
set_table(tbl, value._kz, index + 1, value.box_txt, not na(time("", value.session, gmt_tz)), value.c)
// ---------------------------------------- Core Logic --------------------------------------------------
Indicator

Killzones US100/SP500 - Manuel De Jesus Leiva// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org
// © tradeforopp
//@version=6
indicator("Killzones US100/SP500 - Manuel De Jesus Leiva", "Killzones US100/SP500 - Manuel De Jesus Leiva", true, max_labels_count = 500, max_lines_count = 500, max_boxes_count = 500)
// ---------------------------------------- Constant Functions --------------------------------------------------
get_line_type(_style) =>
switch _style
"Solid" => line.style_solid
"Dotted" => line.style_dotted
"Dashed" => line.style_dashed
get_size(x) =>
switch x
"Auto" => size.auto
"Tiny" => size.tiny
"Small" => size.small
"Normal" => size.normal
"Large" => size.large
"Huge" => size.huge
get_table_pos(pos) =>
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
// ---------------------------------------- Constant Functions --------------------------------------------------
// ---------------------------------------- Inputs --------------------------------------------------
var g_SETTINGS = "Settings"
max_days = input.int(1000, "Session Drawing Limit", 1, tooltip = "Only this many drawings will be kept on the chart, for each selected drawing type (killzone boxes, pivot lines, open lines, etc.). Set to 200 for ~6 months of sessions.", group = g_SETTINGS)
tf_limit = input.timeframe("60", "Timeframe Limit", tooltip = "Drawings will not appear on timeframes greater than or equal to this", group = g_SETTINGS)
gmt_tz = input.string('America/New_York', "Timezone", options = , tooltip = "Note GMT is not adjusted to reflect Daylight Saving Time changes", group = g_SETTINGS)
lbl_size = get_size(input.string('Normal', "Label Size", options = , tooltip = "The size of all labels", group = g_SETTINGS))
txt_color = input.color(color.black, "Text Color", tooltip = "The color of all label and table text", group = g_SETTINGS)
use_cutoff = input.bool(false, "Drawing Cutoff Time", inline = "CO", tooltip = "When enabled, all pivots and open price lines will stop extending at this time", group = g_SETTINGS)
cutoff = input.session("1800-1801", "", inline = "CO", group = g_SETTINGS)
var tf_limit_is_equal_or_more_chart_tf = timeframe.in_seconds('') <= timeframe.in_seconds(tf_limit)
var g_KZ = "Killzones"
// General Killzone Settings
show_kz = input.bool(true, "Show Killzone Boxes", inline = "KZ", group = g_KZ)
show_kz_text = input.bool(false, "Display Text", inline = "KZ", group = g_KZ)
box_transparency = input.int(70, "Box Transparency", 0, 100, group = g_KZ)
text_transparency = input.int(50, "Text Transparency", 0, 100, group = g_KZ)
// ==================== KILLZONE 01 ====================
use_kz01 = input.bool(true, "00:00-01:00", inline = "KZ01", group = g_KZ)
kz01_txt = input.string("00-01", "", inline = "KZ01", group = g_KZ)
kz01 = input.session("0000-0100", "", inline = "KZ01", group = g_KZ)
kz01_color = input.color(color.blue, "", inline = "KZ01", group = g_KZ)
// ==================== KILLZONE 02 ====================
use_kz02 = input.bool(true, "01:00-02:00", inline = "KZ02", group = g_KZ)
kz02_txt = input.string("01-02", "", inline = "KZ02", group = g_KZ)
kz02 = input.session("0100-0200", "", inline = "KZ02", group = g_KZ)
kz02_color = input.color(color.blue, "", inline = "KZ02", group = g_KZ)
// ==================== KILLZONE 03 ====================
use_kz03 = input.bool(true, "02:00-03:00", inline = "KZ03", group = g_KZ)
kz03_txt = input.string("02-03", "", inline = "KZ03", group = g_KZ)
kz03 = input.session("0200-0300", "", inline = "KZ03", group = g_KZ)
kz03_color = input.color(color.blue, "", inline = "KZ03", group = g_KZ)
// ==================== KILLZONE 04 ====================
use_kz04 = input.bool(true, "03:00-04:00", inline = "KZ04", group = g_KZ)
kz04_txt = input.string("03-04", "", inline = "KZ04", group = g_KZ)
kz04 = input.session("0300-0400", "", inline = "KZ04", group = g_KZ)
kz04_color = input.color(color.blue, "", inline = "KZ04", group = g_KZ)
// ==================== KILLZONE 05 ====================
use_kz05 = input.bool(true, "04:00-05:00", inline = "KZ05", group = g_KZ)
kz05_txt = input.string("04-05", "", inline = "KZ05", group = g_KZ)
kz05 = input.session("0400-0500", "", inline = "KZ05", group = g_KZ)
kz05_color = input.color(color.blue, "", inline = "KZ05", group = g_KZ)
// ==================== KILLZONE 06 ====================
use_kz06 = input.bool(true, "05:00-06:00", inline = "KZ06", group = g_KZ)
kz06_txt = input.string("05-06", "", inline = "KZ06", group = g_KZ)
kz06 = input.session("0500-0600", "", inline = "KZ06", group = g_KZ)
kz06_color = input.color(color.blue, "", inline = "KZ06", group = g_KZ)
// ==================== KILLZONE 07 ====================
use_kz07 = input.bool(true, "06:00-07:00", inline = "KZ07", group = g_KZ)
kz07_txt = input.string("06-07", "", inline = "KZ07", group = g_KZ)
kz07 = input.session("0600-0700", "", inline = "KZ07", group = g_KZ)
kz07_color = input.color(color.blue, "", inline = "KZ07", group = g_KZ)
// ==================== KILLZONE 08 ====================
use_kz08 = input.bool(true, "07:00-08:00", inline = "KZ08", group = g_KZ)
kz08_txt = input.string("07-08", "", inline = "KZ08", group = g_KZ)
kz08 = input.session("0700-0800", "", inline = "KZ08", group = g_KZ)
kz08_color = input.color(color.blue, "", inline = "KZ08", group = g_KZ)
// ==================== KILLZONE 09 ====================
use_kz09 = input.bool(true, "08:00-09:00", inline = "KZ09", group = g_KZ)
kz09_txt = input.string("08-09", "", inline = "KZ09", group = g_KZ)
kz09 = input.session("0800-0900", "", inline = "KZ09", group = g_KZ)
kz09_color = input.color(color.blue, "", inline = "KZ09", group = g_KZ)
// ==================== KILLZONE 10 ====================
use_kz10 = input.bool(true, "09:00-10:00", inline = "KZ10", group = g_KZ)
kz10_txt = input.string("09-10", "", inline = "KZ10", group = g_KZ)
kz10 = input.session("0900-1000", "", inline = "KZ10", group = g_KZ)
kz10_color = input.color(color.blue, "", inline = "KZ10", group = g_KZ)
// ==================== KILLZONE 11 ====================
use_kz11 = input.bool(true, "10:00-11:00", inline = "KZ11", group = g_KZ)
kz11_txt = input.string("10-11", "", inline = "KZ11", group = g_KZ)
kz11 = input.session("1000-1100", "", inline = "KZ11", group = g_KZ)
kz11_color = input.color(color.blue, "", inline = "KZ11", group = g_KZ)
// ==================== KILLZONE 12 ====================
use_kz12 = input.bool(true, "11:00-12:00", inline = "KZ12", group = g_KZ)
kz12_txt = input.string("11-12", "", inline = "KZ12", group = g_KZ)
kz12 = input.session("1100-1200", "", inline = "KZ12", group = g_KZ)
kz12_color = input.color(color.blue, "", inline = "KZ12", group = g_KZ)
// ==================== KILLZONE 13 ====================
use_kz13 = input.bool(true, "12:00-13:00", inline = "KZ13", group = g_KZ)
kz13_txt = input.string("12-13", "", inline = "KZ13", group = g_KZ)
kz13 = input.session("1200-1300", "", inline = "KZ13", group = g_KZ)
kz13_color = input.color(color.blue, "", inline = "KZ13", group = g_KZ)
// ==================== KILLZONE 14 ====================
use_kz14 = input.bool(true, "13:00-14:00", inline = "KZ14", group = g_KZ)
kz14_txt = input.string("13-14", "", inline = "KZ14", group = g_KZ)
kz14 = input.session("1300-1400", "", inline = "KZ14", group = g_KZ)
kz14_color = input.color(color.blue, "", inline = "KZ14", group = g_KZ)
// ==================== KILLZONE 15 ====================
use_kz15 = input.bool(true, "14:00-15:00", inline = "KZ15", group = g_KZ)
kz15_txt = input.string("14-15", "", inline = "KZ15", group = g_KZ)
kz15 = input.session("1400-1500", "", inline = "KZ15", group = g_KZ)
kz15_color = input.color(color.blue, "", inline = "KZ15", group = g_KZ)
// ==================== KILLZONE 16 ====================
use_kz16 = input.bool(true, "15:00-16:00", inline = "KZ16", group = g_KZ)
kz16_txt = input.string("15-16", "", inline = "KZ16", group = g_KZ)
kz16 = input.session("1500-1600", "", inline = "KZ16", group = g_KZ)
kz16_color = input.color(color.blue, "", inline = "KZ16", group = g_KZ)
// ==================== KILLZONE 17 ====================
use_kz17 = input.bool(true, "16:00-17:00", inline = "KZ17", group = g_KZ)
kz17_txt = input.string("16-17", "", inline = "KZ17", group = g_KZ)
kz17 = input.session("1600-1700", "", inline = "KZ17", group = g_KZ)
kz17_color = input.color(color.blue, "", inline = "KZ17", group = g_KZ)
// ==================== KILLZONE 18 ====================
use_kz18 = input.bool(true, "17:00-18:00", inline = "KZ18", group = g_KZ)
kz18_txt = input.string("17-18", "", inline = "KZ18", group = g_KZ)
kz18 = input.session("1700-1800", "", inline = "KZ18", group = g_KZ)
kz18_color = input.color(color.blue, "", inline = "KZ18", group = g_KZ)
// ==================== KILLZONE 19 ====================
use_kz19 = input.bool(true, "18:00-19:00", inline = "KZ19", group = g_KZ)
kz19_txt = input.string("18-19", "", inline = "KZ19", group = g_KZ)
kz19 = input.session("1800-1900", "", inline = "KZ19", group = g_KZ)
kz19_color = input.color(color.blue, "", inline = "KZ19", group = g_KZ)
// ==================== KILLZONE 20 ====================
use_kz20 = input.bool(true, "19:00-20:00", inline = "KZ20", group = g_KZ)
kz20_txt = input.string("19-20", "", inline = "KZ20", group = g_KZ)
kz20 = input.session("1900-2000", "", inline = "KZ20", group = g_KZ)
kz20_color = input.color(color.blue, "", inline = "KZ20", group = g_KZ)
// ==================== KILLZONE 21 ====================
use_kz21 = input.bool(true, "20:00-21:00", inline = "KZ21", group = g_KZ)
kz21_txt = input.string("20-21", "", inline = "KZ21", group = g_KZ)
kz21 = input.session("2000-2100", "", inline = "KZ21", group = g_KZ)
kz21_color = input.color(color.blue, "", inline = "KZ21", group = g_KZ)
// ==================== KILLZONE 22 ====================
use_kz22 = input.bool(true, "21:00-22:00", inline = "KZ22", group = g_KZ)
kz22_txt = input.string("21-22", "", inline = "KZ22", group = g_KZ)
kz22 = input.session("2100-2200", "", inline = "KZ22", group = g_KZ)
kz22_color = input.color(color.blue, "", inline = "KZ22", group = g_KZ)
// ==================== KILLZONE 23 ====================
use_kz23 = input.bool(true, "22:00-23:00", inline = "KZ23", group = g_KZ)
kz23_txt = input.string("22-23", "", inline = "KZ23", group = g_KZ)
kz23 = input.session("2200-2300", "", inline = "KZ23", group = g_KZ)
kz23_color = input.color(color.blue, "", inline = "KZ23", group = g_KZ)
// ==================== KILLZONE 24 ====================
use_kz24 = input.bool(true, "23:00-00:00", inline = "KZ24", group = g_KZ)
kz24_txt = input.string("23-00", "", inline = "KZ24", group = g_KZ)
kz24 = input.session("2300-0000", "", inline = "KZ24", group = g_KZ)
kz24_color = input.color(color.blue, "", inline = "KZ24", group = g_KZ)
// ==================== KILLZONE 25 ====================
use_kz25 = input.bool(true, "17:00-21:00", inline = "KZ25", group = g_KZ)
kz25_txt = input.string("17-21", "", inline = "KZ25", group = g_KZ)
kz25 = input.session("1700-2100", "", inline = "KZ25", group = g_KZ)
kz25_color = input.color(color.orange, "", inline = "KZ25", group = g_KZ)
// ==================== KILLZONE 26 ====================
use_kz26 = input.bool(true, "21:00-01:00", inline = "KZ26", group = g_KZ)
kz26_txt = input.string("21-01", "", inline = "KZ26", group = g_KZ)
kz26 = input.session("2100-0100", "", inline = "KZ26", group = g_KZ)
kz26_color = input.color(color.aqua, "", inline = "KZ26", group = g_KZ)
// ==================== KILLZONE 27 ====================
use_kz27 = input.bool(true, "01:00-05:00", inline = "KZ27", group = g_KZ)
kz27_txt = input.string("01-05", "", inline = "KZ27", group = g_KZ)
kz27 = input.session("0100-0500", "", inline = "KZ27", group = g_KZ)
kz27_color = input.color(color.green, "", inline = "KZ27", group = g_KZ)
// ==================== KILLZONE 28 ====================
use_kz28 = input.bool(true, "05:00-09:00", inline = "KZ28", group = g_KZ)
kz28_txt = input.string("05-09", "", inline = "KZ28", group = g_KZ)
kz28 = input.session("0500-0900", "", inline = "KZ28", group = g_KZ)
kz28_color = input.color(color.yellow, "", inline = "KZ28", group = g_KZ)
// ==================== KILLZONE 29 ====================
use_kz29 = input.bool(true, "09:00-13:00", inline = "KZ29", group = g_KZ)
kz29_txt = input.string("09-13", "", inline = "KZ29", group = g_KZ)
kz29 = input.session("0900-1300", "", inline = "KZ29", group = g_KZ)
kz29_color = input.color(color.red, "", inline = "KZ29", group = g_KZ)
// ==================== KILLZONE 30 ====================
use_kz30 = input.bool(true, "13:00-17:00", inline = "KZ30", group = g_KZ)
kz30_txt = input.string("13-17", "", inline = "KZ30", group = g_KZ)
kz30 = input.session("1300-1700", "", inline = "KZ30", group = g_KZ)
kz30_color = input.color(color.purple, "", inline = "KZ30", group = g_KZ)
var g_LABELS = "Killzone Pivots"
show_pivots = input.bool(false, "Show Pivots", inline = "PV", group = g_LABELS)
use_alerts = input.bool(false, "Alert Broken Pivots", inline = "PV", tooltip = "The desired killzones must be enabled at the time that an alert is created, along with the show pivots option, in order for alerts to work", group = g_LABELS)
show_midpoints = input.bool(false, "Show Pivot Midpoints", inline = "mp", group = g_LABELS)
stop_midpoints = input.bool(false, "Stop Once Mitigated", inline = "mp", group = g_LABELS)
show_labels = input.bool(false, "Show Pivot Labels", inline = "LB", tooltip = "Show labels denoting each killzone's high and low. Optionally choose to show the price of each level. Right side will show labels on the right-hand side of the chart until they are reached", group = g_LABELS)
label_price = input.bool(false, "Display Price", inline = "LB", group = g_LABELS)
label_right = input.bool(false, "Right Side", inline = "LB", group = g_LABELS)
ext_pivots = input.string("Until Mitigated", "Extend Pivots...", options = , group = g_LABELS)
ext_which = input.string("All", "...From Which Sessions", options = , group = g_LABELS)
ash_str = input.string("AS.H", "Killzone 1 Labels", inline = "L_AS", group = g_LABELS)
asl_str = input.string("AS.L", "", inline = "L_AS", group = g_LABELS)
loh_str = input.string("LO.H", "Killzone 2 Labels", inline = "L_LO", group = g_LABELS)
lol_str = input.string("LO.L", "", inline = "L_LO", group = g_LABELS)
nah_str = input.string("NYAM.H", "Killzone 3 Labels", inline = "L_NA", group = g_LABELS)
nal_str = input.string("NYAM.L", "", inline = "L_NA", group = g_LABELS)
nlh_str = input.string("NYL.H", "Killzone 4 Labels", inline = "L_NL", group = g_LABELS)
nll_str = input.string("NYL.L", "", inline = "L_NL", group = g_LABELS)
nph_str = input.string("NYPM.H", "Killzone 5 Labels", inline = "L_NP", group = g_LABELS)
npl_str = input.string("NYPM.L", "", inline = "L_NP", group = g_LABELS)
kzp_style = get_line_type(input.string(defval = 'Solid', title = "Pivot Style", options = , inline = "KZP", group = g_LABELS))
kzp_width = input.int(1, "", inline = "KZP", group = g_LABELS)
kzm_style = get_line_type(input.string(defval = 'Dotted', title = "Midpoint Style", options = , inline = "KZM", group = g_LABELS))
kzm_width = input.int(1, "", inline = "KZM", group = g_LABELS)
var g_RNG = "Killzone Range"
show_range = input.bool(false, "Show Killzone Range", tooltip = "Show the most recent ranges of each selected killzone, from high to low", group = g_RNG)
show_range_avg = input.bool(false, "Show Average", tooltip = "Show the average range of each selected killzone", group = g_RNG)
range_avg = input.int(5, "Average Length", 0, tooltip = "This many previous sessions will be used to calculate the average. If there isn't enough data on the current chart, it will use as many sessions as possible", group = g_RNG)
range_pos = get_table_pos(input.string('Top Right', "Table Position", options = , group = g_RNG))
range_size = get_size(input.string('Normal', "Table Size", options = , group = g_RNG))
var g_DWM = "Day - Week - Month"
sep_unlimited = input.bool(false, "Unlimited", tooltip = "Unlimited will show as many of the selected lines as possible. Otherwise, the session drawing limit will be used", group = g_DWM)
alert_HL = input.bool(false, "Alert High/Low Break", tooltip = "Alert when any selected highs and lows are traded through. The desired timeframe's high/low option must be enabled at the time that an alert is created", group = g_DWM)
show_d_open = input.bool(false, "D Open", inline = "DO", group = g_DWM)
dhl = input.bool(false, "High/Low", inline = "DO", tooltip = "", group = g_DWM)
ds = input.bool(false, "Separators", inline = "DO", tooltip = "Mark where a new day begins", group = g_DWM)
d_color = input.color(color.blue, "", inline = "DO", group = g_DWM)
show_w_open = input.bool(false, "W Open", inline = "WO", group = g_DWM)
whl = input.bool(false, "High/Low", inline = "WO", tooltip = "", group = g_DWM)
ws = input.bool(false, "Separators", inline = "WO", tooltip = "Mark where a new week begins", group = g_DWM)
w_color = input.color(#089981, "", inline = "WO", group = g_DWM)
show_m_open = input.bool(false, "M Open", inline = "MO", group = g_DWM)
mhl = input.bool(false, "High/Low", inline = "MO", tooltip = "", group = g_DWM)
ms = input.bool(false, "Separators", inline = "MO", tooltip = "Mark where a new month begins", group = g_DWM)
m_color = input.color(color.red, "", inline = "MO", group = g_DWM)
htf_style = get_line_type(input.string(defval = 'Solid', title = "Style", options = , inline = "D0", group = g_DWM))
htf_width = input.int(1, "", inline = "D0", group = g_DWM)
dow_labels = input.bool(false, "Day of Week Labels", inline = "DOW", group = g_DWM)
dow_yloc = input.string('Bottom', "", options = , inline = "DOW", group = g_DWM)
dow_xloc = input.string('Midnight', "", options = , inline = "DOW", group = g_DWM)
dow_hide_wknd = input.bool(false, "Hide Weekend Labels", group = g_DWM)
var g_OPEN = "Opening Prices"
open_unlimited = input.bool(false, "Unlimited", tooltip = "Unlimited will show as many of the selected lines as possible. Otherwise, the session drawing limit will be used", group = g_OPEN)
use_h1 = input.bool(false, "", inline = "H1", group = g_OPEN)
h1_text = input.string("18:00 H12/H8/H6/H4", "", inline = "H1", group = g_OPEN)
h1 = input.session("1800-1801", "", inline = "H1", group = g_OPEN)
h1_color = input.color(color.black, "", inline = "H1", group = g_OPEN)
use_h2 = input.bool(false, "", inline = "H2", group = g_OPEN)
h2_text = input.string("06:00 H12/H6/H4", "", inline = "H2", group = g_OPEN)
h2 = input.session("0600-0601", "", inline = "H2", group = g_OPEN)
h2_color = input.color(color.black, "", inline = "H2", group = g_OPEN)
use_h3 = input.bool(false, "", inline = "H3", group = g_OPEN)
h3_text = input.string("10:00 H8/H4", "", inline = "H3", group = g_OPEN)
h3 = input.session("1000-1001", "", inline = "H3", group = g_OPEN)
h3_color = input.color(color.black, "", inline = "H3", group = g_OPEN)
use_h4 = input.bool(false, "", inline = "H4", group = g_OPEN)
h4_text = input.string("02:00 H8/H4", "", inline = "H4", group = g_OPEN)
h4 = input.session("0200-0201", "", inline = "H4", group = g_OPEN)
h4_color = input.color(color.black, "", inline = "H4", group = g_OPEN)
use_h5 = input.bool(false, "", inline = "H5", group = g_OPEN)
h5_text = input.string("00:00 H6", "", inline = "H5", group = g_OPEN)
h5 = input.session("0000-0001", "", inline = "H5", group = g_OPEN)
h5_color = input.color(color.black, "", inline = "H5", group = g_OPEN)
use_h6 = input.bool(false, "", inline = "H6", group = g_OPEN)
h6_text = input.string("12:00 H6", "", inline = "H6", group = g_OPEN)
h6 = input.session("1200-1201", "", inline = "H6", group = g_OPEN)
h6_color = input.color(color.black, "", inline = "H6", group = g_OPEN)
use_h7 = input.bool(false, "", inline = "H7", group = g_OPEN)
h7_text = input.string("22:00 H4", "", inline = "H7", group = g_OPEN)
h7 = input.session("2200-2201", "", inline = "H7", group = g_OPEN)
h7_color = input.color(color.black, "", inline = "H7", group = g_OPEN)
use_h8 = input.bool(false, "", inline = "H8", group = g_OPEN)
h8_text = input.string("14:00 H4", "", inline = "H8", group = g_OPEN)
h8 = input.session("1400-1401", "", inline = "H8", group = g_OPEN)
h8_color = input.color(color.black, "", inline = "H8", group = g_OPEN)
hz_style = get_line_type(input.string(defval = 'Dotted', title = "Style", options = , inline = "H0", group = g_OPEN))
hz_width = input.int(1, "", inline = "H0", group = g_OPEN)
var g_VERTICAL = "Timestamps"
v_unlimited = input.bool(false, "Unlimited", tooltip = "Unlimited will show as many of the selected lines as possible. Otherwise, the session drawing limit will be used", group = g_VERTICAL)
use_v1 = input.bool(false, "", inline = "V1", group = g_VERTICAL)
v1 = input.session("0000-0001", "", inline = "V1", group = g_VERTICAL)
v1_color = input.color(color.black, "", inline = "V1", group = g_VERTICAL)
use_v2 = input.bool(false, "", inline = "V2", group = g_VERTICAL)
v2 = input.session("0800-0801", "", inline = "V2", group = g_VERTICAL)
v2_color = input.color(color.black, "", inline = "V2", group = g_VERTICAL)
use_v3 = input.bool(false, "", inline = "V3", group = g_VERTICAL)
v3 = input.session("1000-1001", "", inline = "V3", group = g_VERTICAL)
v3_color = input.color(color.black, "", inline = "V3", group = g_VERTICAL)
use_v4 = input.bool(false, "", inline = "V4", group = g_VERTICAL)
v4 = input.session("1200-1201", "", inline = "V4", group = g_VERTICAL)
v4_color = input.color(color.black, "", inline = "V4", group = g_VERTICAL)
vl_style = get_line_type(input.string(defval = 'Dotted', title = "Style", options = , inline = "V0", group = g_VERTICAL))
vl_width = input.int(1, "", inline = "V0", group = g_VERTICAL)
// ---------------------------------------- Inputs --------------------------------------------------
// ---------------------------------------- Variables & Constants --------------------------------------------------
type kz
string _title
array _box
array _hi_line
array _md_line
array _lo_line
array _hi_label
array _lo_label
array _hi_valid
array _md_valid
array _lo_valid
array _range_store
float _range_current
type hz
array LN
array LB
array CO
type dwm_hl
array hi_line
array lo_line
array hi_label
array lo_label
bool hit_high = false
bool hit_low = false
type dwm_info
string tf
float o = na
float h = na
float l = na
float ph = na
float pl = na
type lines_helper
hz _hz
string h
string h_text
color h_color
initLines() =>
array res = array.new()
if use_h1
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h1, h1_text, h1_color))
if use_h2
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h2, h2_text, h2_color))
if use_h3
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h3, h3_text, h3_color))
if use_h4
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h4, h4_text, h4_color))
if use_h5
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h5, h5_text, h5_color))
if use_h6
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h6, h6_text, h6_color))
if use_h7
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h7, h7_text, h7_color))
if use_h8
res.push(lines_helper.new(hz.new(array.new_line(), array.new_label(), array.new_bool()), h8, h8_text, h8_color))
res
var array lines = initLines()
type kz_helper
kz _kz
string session
color c
string box_txt
string hi_txt
string lo_txt
initKZ() =>
array res = array.new()
if use_kz01
res.push(kz_helper.new(
kz.new(kz01_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz01, kz01_color, kz01_txt, "KZ01.H", "KZ01.L"
))
if use_kz02
res.push(kz_helper.new(
kz.new(kz02_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz02, kz02_color, kz02_txt, "KZ02.H", "KZ02.L"
))
if use_kz03
res.push(kz_helper.new(
kz.new(kz03_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz03, kz03_color, kz03_txt, "KZ03.H", "KZ03.L"
))
if use_kz04
res.push(kz_helper.new(
kz.new(kz04_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz04, kz04_color, kz04_txt, "KZ04.H", "KZ04.L"
))
if use_kz05
res.push(kz_helper.new(
kz.new(kz05_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz05, kz05_color, kz05_txt, "KZ05.H", "KZ05.L"
))
if use_kz06
res.push(kz_helper.new(
kz.new(kz06_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz06, kz06_color, kz06_txt, "KZ06.H", "KZ06.L"
))
if use_kz07
res.push(kz_helper.new(
kz.new(kz07_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz07, kz07_color, kz07_txt, "KZ07.H", "KZ07.L"
))
if use_kz08
res.push(kz_helper.new(
kz.new(kz08_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz08, kz08_color, kz08_txt, "KZ08.H", "KZ08.L"
))
if use_kz09
res.push(kz_helper.new(
kz.new(kz09_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz09, kz09_color, kz09_txt, "KZ09.H", "KZ09.L"
))
if use_kz10
res.push(kz_helper.new(
kz.new(kz10_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz10, kz10_color, kz10_txt, "KZ10.H", "KZ10.L"
))
if use_kz11
res.push(kz_helper.new(
kz.new(kz11_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz11, kz11_color, kz11_txt, "KZ11.H", "KZ11.L"
))
if use_kz12
res.push(kz_helper.new(
kz.new(kz12_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz12, kz12_color, kz12_txt, "KZ12.H", "KZ12.L"
))
if use_kz13
res.push(kz_helper.new(
kz.new(kz13_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz13, kz13_color, kz13_txt, "KZ13.H", "KZ13.L"
))
if use_kz14
res.push(kz_helper.new(
kz.new(kz14_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz14, kz14_color, kz14_txt, "KZ14.H", "KZ14.L"
))
if use_kz15
res.push(kz_helper.new(
kz.new(kz15_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz15, kz15_color, kz15_txt, "KZ15.H", "KZ15.L"
))
if use_kz16
res.push(kz_helper.new(
kz.new(kz16_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz16, kz16_color, kz16_txt, "KZ16.H", "KZ16.L"
))
if use_kz17
res.push(kz_helper.new(
kz.new(kz17_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz17, kz17_color, kz17_txt, "KZ17.H", "KZ17.L"
))
if use_kz18
res.push(kz_helper.new(
kz.new(kz18_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz18, kz18_color, kz18_txt, "KZ18.H", "KZ18.L"
))
if use_kz19
res.push(kz_helper.new(
kz.new(kz19_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz19, kz19_color, kz19_txt, "KZ19.H", "KZ19.L"
))
if use_kz20
res.push(kz_helper.new(
kz.new(kz20_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz20, kz20_color, kz20_txt, "KZ20.H", "KZ20.L"
))
if use_kz21
res.push(kz_helper.new(
kz.new(kz21_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz21, kz21_color, kz21_txt, "KZ21.H", "KZ21.L"
))
if use_kz22
res.push(kz_helper.new(
kz.new(kz22_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz22, kz22_color, kz22_txt, "KZ22.H", "KZ22.L"
))
if use_kz23
res.push(kz_helper.new(
kz.new(kz23_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz23, kz23_color, kz23_txt, "KZ23.H", "KZ23.L"
))
if use_kz24
res.push(kz_helper.new(
kz.new(kz24_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz24, kz24_color, kz24_txt, "KZ24.H", "KZ24.L"
))
if use_kz25
res.push(kz_helper.new(
kz.new(kz25_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz25, kz25_color, kz25_txt, "KZ25.H", "KZ25.L"
))
if use_kz26
res.push(kz_helper.new(
kz.new(kz26_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz26, kz26_color, kz26_txt, "KZ26.H", "KZ26.L"
))
if use_kz27
res.push(kz_helper.new(
kz.new(kz27_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz27, kz27_color, kz27_txt, "KZ27.H", "KZ27.L"
))
if use_kz28
res.push(kz_helper.new(
kz.new(kz28_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz28, kz28_color, kz28_txt, "KZ28.H", "KZ28.L"
))
if use_kz29
res.push(kz_helper.new(
kz.new(kz29_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz29, kz29_color, kz29_txt, "KZ29.H", "KZ29.L"
))
if use_kz30
res.push(kz_helper.new(
kz.new(kz30_txt, array.new_box(), array.new_line(), array.new_line(), array.new_line(), array.new_label(), array.new_label(), array.new_bool(), array.new_bool(), array.new_bool(), array.new_float()),
kz30, kz30_color, kz30_txt, "KZ30.H", "KZ30.L"
))
res
var array _kz = initKZ()
var d_hl = dwm_hl.new(array.new_line(), array.new_line(), array.new_label(), array.new_label())
var w_hl = dwm_hl.new(array.new_line(), array.new_line(), array.new_label(), array.new_label())
var m_hl = dwm_hl.new(array.new_line(), array.new_line(), array.new_label(), array.new_label())
var d_info = dwm_info.new("D")
var w_info = dwm_info.new("W")
var m_info = dwm_info.new("M")
t_co = not na(time("", cutoff, gmt_tz))
type ts_helper
string session
array lines
color c
initTS() =>
array res = array.new()
if use_v1
res.push(ts_helper.new(v1, array.new_line(), v1_color))
if use_v2
res.push(ts_helper.new(v2, array.new_line(), v2_color))
if use_v3
res.push(ts_helper.new(v3, array.new_line(), v3_color))
if use_v4
res.push(ts_helper.new(v4, array.new_line(), v4_color))
res
var array ts_data = initTS()
var d_sep_line = array.new_line()
var w_sep_line = array.new_line()
var m_sep_line = array.new_line()
var d_line = array.new_line()
var w_line = array.new_line()
var m_line = array.new_line()
var d_label = array.new_label()
var w_label = array.new_label()
var m_label = array.new_label()
var transparent = #ffffff00
var ext_current = ext_which == 'Most Recent'
var ext_past = ext_pivots == 'Past Mitigation'
update_dwm_info(dwm_info n) =>
if timeframe.change(n.tf)
n.ph := n.h
n.pl := n.l
n.o := open
n.h := high
n.l := low
else
n.h := math.max(high, n.h)
n.l := math.min(low, n.l)
if dhl or show_d_open
update_dwm_info(d_info)
if whl or show_w_open
update_dwm_info(w_info)
if mhl or show_m_open
update_dwm_info(m_info)
// ---------------------------------------- Variables & Constants --------------------------------------------------
// ---------------------------------------- Functions --------------------------------------------------
get_box_color(color c) =>
color.new(c, box_transparency)
get_text_color(color c) =>
color.new(c, text_transparency)
// ---------------------------------------- Functions --------------------------------------------------
// ---------------------------------------- Core Logic --------------------------------------------------
dwm_sep(string tf, bool use, array arr, color col) =>
if use
if timeframe.change(tf)
arr.unshift(line.new(bar_index, high * 1.0001, bar_index, low, style = htf_style, width = htf_width, extend = extend.both, color = col))
if not sep_unlimited and arr.size() > max_days
arr.pop().delete()
dwm_open(string tf, bool use, array lns, array lbls, dwm_info n, color col) =>
if use
if lns.size() > 0
lns.get(0).set_x2(time)
lbls.get(0).set_x(time)
if timeframe.change(tf)
lns.unshift(line.new(time, n.o, time, n.o, xloc = xloc.bar_time, style = htf_style, width = htf_width, color = col))
lbls.unshift(label.new(time, n.o, tf + " OPEN", xloc = xloc.bar_time, style = label.style_label_left, color = transparent, textcolor = txt_color, size = lbl_size))
if not sep_unlimited and lns.size() > max_days
lns.pop().delete()
lbls.pop().delete()
dwm_hl(string tf, bool use, dwm_hl hl, dwm_info n, color col) =>
if use
if hl.hi_line.size() > 0
hl.hi_line.get(0).set_x2(time)
hl.lo_line.get(0).set_x2(time)
hl.hi_label.get(0).set_x(time)
hl.lo_label.get(0).set_x(time)
if timeframe.change(tf)
hl.hi_line.unshift(line.new(time, n.ph, time, n.ph, xloc = xloc.bar_time, style = htf_style, width = htf_width, color = col))
hl.lo_line.unshift(line.new(time, n.pl, time, n.pl, xloc = xloc.bar_time, style = htf_style, width = htf_width, color = col))
hl.hi_label.unshift(label.new(time, n.ph, "P" + tf + "H", xloc = xloc.bar_time, style = label.style_label_left, color = transparent, textcolor = txt_color, size = lbl_size))
hl.lo_label.unshift(label.new(time, n.pl, "P" + tf + "L", xloc = xloc.bar_time, style = label.style_label_left, color = transparent, textcolor = txt_color, size = lbl_size))
hl.hit_high := false
hl.hit_low := false
if not sep_unlimited and hl.hi_line.size() > max_days
hl.hi_line.pop().delete()
hl.lo_line.pop().delete()
hl.hi_label.pop().delete()
hl.lo_label.pop().delete()
if hl.hi_line.size() > 0 and alert_HL
if not hl.hit_high and high > hl.hi_line.get(0).get_y1()
hl.hit_high := true
alert(str.format("Hit P{0}H", tf))
if not hl.hit_low and low < hl.lo_line.get(0).get_y1()
hl.hit_low := true
alert(str.format("Hit P{0}L", tf))
dwm() =>
if tf_limit_is_equal_or_more_chart_tf
// DWM - Separators
dwm_sep("D", ds, d_sep_line, d_color)
dwm_sep("W", ws, w_sep_line, w_color)
dwm_sep("M", ms, m_sep_line, m_color)
// DWM - Open Lines
dwm_open("D", show_d_open, d_line, d_label, d_info, d_color)
dwm_open("W", show_w_open, w_line, w_label, w_info, w_color)
dwm_open("M", show_m_open, m_line, m_label, m_info, m_color)
// DWM - Highs and Lows
dwm_hl("D", dhl, d_hl, d_info, d_color)
dwm_hl("W", whl, w_hl, w_info, w_color)
dwm_hl("M", mhl, m_hl, m_info, m_color)
method vline(ts_helper this) =>
bool t = not na(time("", this.session, gmt_tz))
bool t_prev = not na(time("", this.session, gmt_tz, bars_back = 1))
array arr = this.lines
color col = this.c
if t and not t_prev
arr.unshift(line.new(bar_index, high * 1.0001, bar_index, low, style = vl_style, width = vl_width, extend = extend.both, color = col))
if not v_unlimited
if arr.size() > max_days
arr.pop().delete()
vlines() =>
if tf_limit_is_equal_or_more_chart_tf
for in ts_data
vline(value)
method hz_line(lines_helper this) =>
bool t = not na(time("", this.h, gmt_tz))
bool t_prev = not na(time("", this.h, gmt_tz, bars_back = 1))
hz hz = this._hz
string txt = this.h_text
color col = this.h_color
if t and not t_prev
hz.LN.unshift(line.new(bar_index, open, bar_index, open, style = hz_style, width = hz_width, color = col))
hz.LB.unshift(label.new(bar_index, open, txt, style = label.style_label_left, color = transparent, textcolor = txt_color, size = lbl_size))
array.unshift(hz.CO, false)
if not open_unlimited and hz.LN.size() > max_days
hz.LN.pop().delete()
hz.LB.pop().delete()
hz.CO.pop()
if not t and hz.CO.size() > 0
if not hz.CO.get(0)
hz.LN.get(0).set_x2(bar_index)
hz.LB.get(0).set_x(bar_index)
if (use_cutoff ? t_co : false)
hz.CO.set(0, true)
hz_lines() =>
if tf_limit_is_equal_or_more_chart_tf
for in lines
hz_line(value)
del_kz(kz k) =>
if k._box.size() > max_days
k._box.pop().delete()
if k._hi_line.size() > max_days
k._hi_line.pop().delete()
k._lo_line.pop().delete()
k._hi_valid.pop()
k._lo_valid.pop()
if show_midpoints
k._md_line.pop().delete()
k._md_valid.pop()
if k._hi_label.size() > max_days
k._hi_label.pop().delete()
k._lo_label.pop().delete()
update_price_string(label L, float P) =>
S = L.get_text()
pre = str.substring(S, 0, str.pos(S, " "))
str.trim(pre)
L.set_text(str.format("{0} ({1})", pre, P))
adjust_in_kz(kz kz, bool t) =>
if t
kzBox0 = kz._box.get(0)
kzBox0.set_right(time)
newTop = math.max(kzBox0.get_top(), high)
kzBox0.set_top(newTop)
newBottom = math.min(kzBox0.get_bottom(), low)
kzBox0.set_bottom(newBottom)
kz._range_current := newTop - newBottom
if show_pivots and kz._hi_line.size() > 0
kzHiLine0 = kz._hi_line.get(0)
kzHiLine0.set_x2(time)
if high > kzHiLine0.get_y1()
kzHiLine0.set_xy1(time, high)
kzHiLine0.set_xy2(time, high)
kzLoLine0 = kz._lo_line.get(0)
kzLoLine0.set_x2(time)
if low < kzLoLine0.get_y1()
kzLoLine0.set_xy1(time, low)
kzLoLine0.set_xy2(time, low)
if show_midpoints
kzMidLine0 = kz._md_line.get(0)
kzMidLine0.set_x2(time)
kzMidLine0.set_xy1(time, math.avg(kzHiLine0.get_y2(), kzLoLine0.get_y2()))
kzMidLine0.set_xy2(time, math.avg(kzHiLine0.get_y2(), kzLoLine0.get_y2()))
if show_labels and kz._hi_label.size() > 0
if label_right
kz._hi_label.get(0).set_x(time)
kz._lo_label.get(0).set_x(time)
if high > kz._hi_label.get(0).get_y()
kz._hi_label.get(0).set_xy(time, high)
if label_price
update_price_string(kz._hi_label.get(0), high)
if low < kz._lo_label.get(0).get_y()
kz._lo_label.get(0).set_xy(time, low)
if label_price
update_price_string(kz._lo_label.get(0), low)
adjust_out_kz(kz kz, bool t, bool t_prev) =>
boxCount = kz._box.size()
if not t and boxCount > 0
if t_prev
array.unshift(kz._range_store, kz._range_current)
if kz._range_store.size() > range_avg
kz._range_store.pop()
if show_pivots and boxCount > 0
for i = 0 to boxCount - 1 by 1
if not ext_current or i == 0
kzHiValid = kz._hi_valid.get(i)
if ext_past or kzHiValid
kz._hi_line.get(i).set_x2(time)
if show_labels and label_right
kz._hi_label.get(i).set_x(time)
if kzHiValid and high > kz._hi_line.get(i).get_y1()
if use_alerts and i == 0
alert('Broke ' + kz._title + ' High', alert.freq_once_per_bar)
kz._hi_valid.set(i, false)
if show_labels and label_right
kz._hi_label.get(i).set_style(label.style_label_down)
else if use_cutoff ? t_co : false
kz._hi_valid.set(i, false)
kzLoValid = kz._lo_valid.get(i)
if ext_past or kzLoValid
kz._lo_line.get(i).set_x2(time)
if show_labels and label_right
kz._lo_label.get(i).set_x(time)
if kzLoValid and low < kz._lo_line.get(i).get_y1()
if use_alerts and i == 0
alert("Broke " + kz._title + " Low", alert.freq_once_per_bar)
kz._lo_valid.set(i, false)
if show_labels and label_right
kz._lo_label.get(i).set_style(label.style_label_up)
else if use_cutoff ? t_co : false
kz._lo_valid.set(i, false)
if show_midpoints and not t
if stop_midpoints ? kz._md_valid.get(i) : true
kz._md_line.get(i).set_x2(time)
if kz._md_valid.get(i) and low <= kz._md_line.get(i).get_y1() and high >= kz._md_line.get(i).get_y1()
kz._md_valid.set(i, false)
else
break
method manage_kz(kz_helper this) =>
kz kz = this._kz
c = this.c
string box_txt = this.box_txt
string hi_txt = this.hi_txt
string lo_txt = this.lo_txt
if tf_limit_is_equal_or_more_chart_tf
t = not na(time("", this.session, gmt_tz))
t_prev = not na(time("", this.session, gmt_tz, bars_back = 1))
if t and not t_prev
_c = get_box_color(c)
_t = get_text_color(c)
kz._box.unshift(box.new(time, high, time, low, xloc = xloc.bar_time, border_color = show_kz ? _c : na, bgcolor = show_kz ? _c : na, text = show_kz and show_kz_text ? box_txt : na, text_color = _t))
if show_pivots
kz._hi_line.unshift(line.new(time, high, time, high, xloc = xloc.bar_time, style = kzp_style, color = c, width = kzp_width))
kz._lo_line.unshift(line.new(time, low, time, low, xloc = xloc.bar_time, style = kzp_style, color = c, width = kzp_width))
if show_midpoints
kz._md_line.unshift(line.new(time, math.avg(high, low), time, math.avg(high, low), xloc = xloc.bar_time, style = kzm_style, color = c, width = kzm_width))
array.unshift(kz._md_valid, true)
array.unshift(kz._hi_valid, true)
array.unshift(kz._lo_valid, true)
if show_labels
_hi_txt = label_price ? str.format('{0} ({1})', hi_txt, high) : hi_txt
_lo_txt = label_price ? str.format('{0} ({1})', lo_txt, low) : lo_txt
if label_right
kz._hi_label.unshift(label.new(time, high, _hi_txt, xloc = xloc.bar_time, color = transparent, textcolor = txt_color, style = label.style_label_left, size = lbl_size))
kz._lo_label.unshift(label.new(time, low, _lo_txt, xloc = xloc.bar_time, color = transparent, textcolor = txt_color, style = label.style_label_left, size = lbl_size))
else
kz._hi_label.unshift(label.new(time, high, _hi_txt, xloc = xloc.bar_time, color = transparent, textcolor = txt_color, style = label.style_label_down, size = lbl_size))
kz._lo_label.unshift(label.new(time, low, _lo_txt, xloc = xloc.bar_time, color = transparent, textcolor = txt_color, style = label.style_label_up, size = lbl_size))
del_kz(kz)
adjust_in_kz(kz, t)
adjust_out_kz(kz, t, t_prev)
for in _kz
manage_kz(value)
dwm()
vlines()
hz_lines()
new_dow_time = dow_xloc == 'Midday' ? time - timeframe.in_seconds("D") / 2 * 1000 : time
new_day = dayofweek(new_dow_time, gmt_tz) != dayofweek(new_dow_time, gmt_tz)
var dow_top = dow_yloc == 'Top'
var saturday = "SATURDAY"
var sunday = "SUNDAY"
var monday = "MONDAY"
var tuesday = "TUESDAY"
var wednesday = "WEDNESDAY"
var thursday = "THURSDAY"
var friday = "FRIDAY"
plotchar(dow_labels and timeframe.isintraday and dayofweek(new_dow_time, gmt_tz) == 1 and new_day and not dow_hide_wknd, location = dow_top ? location.top : location.bottom, char = '', textcolor = txt_color, text = sunday)
plotchar(dow_labels and timeframe.isintraday and dayofweek(new_dow_time, gmt_tz) == 2 and new_day, location = dow_top ? location.top : location.bottom, char = '', textcolor = txt_color, text = monday)
plotchar(dow_labels and timeframe.isintraday and dayofweek(new_dow_time, gmt_tz) == 3 and new_day, location = dow_top ? location.top : location.bottom, char = '', textcolor = txt_color, text = tuesday)
plotchar(dow_labels and timeframe.isintraday and dayofweek(new_dow_time, gmt_tz) == 4 and new_day, location = dow_top ? location.top : location.bottom, char = '', textcolor = txt_color, text = wednesday)
plotchar(dow_labels and timeframe.isintraday and dayofweek(new_dow_time, gmt_tz) == 5 and new_day, location = dow_top ? location.top : location.bottom, char = '', textcolor = txt_color, text = thursday)
plotchar(dow_labels and timeframe.isintraday and dayofweek(new_dow_time, gmt_tz) == 6 and new_day, location = dow_top ? location.top : location.bottom, char = '', textcolor = txt_color, text = friday)
plotchar(dow_labels and timeframe.isintraday and dayofweek(new_dow_time, gmt_tz) == 7 and new_day and not dow_hide_wknd, location = dow_top ? location.top : location.bottom, char = '', textcolor = txt_color, text = saturday)
get_min_days_stored() =>
store = array.new_int()
for in _kz
int tmpStoreSize = value._kz._range_store.size()
if tmpStoreSize > 0
store.push(tmpStoreSize)
store.min()
method set_table(table tbl, kz kz, int row, string txt, bool t, color col) =>
table.cell(tbl, 0, row, txt, text_size = range_size, bgcolor = get_box_color(col), text_color = txt_color)
table.cell(tbl, 1, row, str.tostring(kz._range_current), text_size = range_size, bgcolor = t ? get_box_color(col) : na, text_color = txt_color)
if show_range_avg
table.cell(tbl, 2, row, str.tostring(kz._range_store.avg()), text_size = range_size, text_color = txt_color)
if show_range and barstate.islast
var tbl = table.new(range_pos, 10, 10, chart.bg_color, chart.fg_color, 2, chart.fg_color, 1)
table.cell(tbl, 0, 0, "Killzone", text_size = range_size, text_color = txt_color)
table.cell(tbl, 1, 0, "Range", text_size = range_size, text_color = txt_color)
if show_range_avg
table.cell(tbl, 2, 0, "Avg (" + str.tostring(get_min_days_stored()) + ")", text_size = range_size, text_color = txt_color)
for in _kz
set_table(tbl, value._kz, index + 1, value.box_txt, not na(time("", value.session, gmt_tz)), value.c)
// ---------------------------------------- Core Logic --------------------------------------------------
Indicator

Indicator

Asian Range Liquidity Sweep - Kill Zone ReversalASIAN RANGE LIQUIDITY SWEEP — the complete ICT Asian Range liquidity model in one indicator
The Asia session builds a small, quiet range. London opens, runs the stops sitting above or below that range, and then walks the price the other way. That single move is one of the most repeatable things in FX, and this indicator is the full rule set for it: the range, the liquidity raid, the higher-timeframe point of interest that makes the raid tradeable, the entry, the stop, the targets — and, just as important, the days on which the raid will NOT happen.
Everything is drawn in New York time, the way the model is defined.
━━━ WHAT IT DOES ━━━
① ASIAN RANGE (20:00 – 00:00 New York)
A time based range, not a structural one. The box, its high, its low and its 50 % are projected forward into the whole trading day. The high is buy side liquidity, the low is sell side liquidity. Direction is mechanical and never inverts: above the range this model only sells, below the range it only buys.
② HIGHER TIMEFRAME POI ENGINE — the filter that decides everything
A raid of the Asian high on its own is, most of the time, a trap. The raid only becomes high probability when it lands inside a higher-timeframe point of interest. The indicator scans three timeframes at once (15m / 1h / 4h by default) for
· Fair Value Gaps
· Order Blocks
· Breaker Blocks (a demand block that price closed through and that now acts as resistance)
· Inverse Fair Value Gaps (a bullish gap that got closed through and flipped bearish)
Every zone is anchored to the exact candles that built it, is extended while it is alive, and is dropped once it is used up or once it sits too far from the daily range to matter. On top of that, the higher-timeframe structure itself has to agree: bearish structure for shorts, bullish for longs.
③ LONDON KILL ZONE (02:00 – 05:00, optional 01:30 start) — Trade 1
Between those hours the indicator waits for price to raid the Asian high (or low) INTO one of those zones. A raid is not even accepted as valid until price has traded back into a fair value gap. Then it waits for a lower-timeframe confirmation and enters at a point of interest — never at market:
· MSS + FVG — market structure shift, entry on the retracement into the gap
· CISD — change in state of delivery, entry back at the CISD level itself
· FVG tap — proximal edge on small gaps, 50 % on big ones
· HIDDEN ORDER BLOCK — the opposite-colour candle trapped between two same-direction fair value gaps. The block almost nobody marks, and the sharpest entry in the whole model
That list is a risk ladder: 1m MSS+FVG is the most aggressive and pays the most, 15m FVG is the safest, wins most often and pays the least. Pick the timeframe you actually want to trade and run the indicator there.
Stop goes on the protective structure that belongs to the entry zone. Target 1 is always the opposite side of the Asian range. Target 2 extends to the next inducement swing — the draw for the day.
④ NEW YORK KILL ZONE (07:00 – 10:00) — Trade 2, the continuation
When the London raid then breaks the OPPOSITE side of the Asian range with displacement, the London extreme is very likely the high or the low of the day. The indicator draws the optimal trade entry fibonacci over that impulse — 0.5 / 0.618 / 0.705 / 0.79 — and takes the continuation from the retracement into it, with the stop beyond 0.79 or 1.0. The setup is strongest when the origin zone was a 4h zone, because the whole day is then a 4h market-maker model running internal to external. If the draw on liquidity was already reached before New York opens, the day is flagged as low probability and skipped.
⑤ THE NO-SWEEP FILTERS — the part almost nobody explains
Two situations mean the raid you are waiting for will never come:
· HTF POI ALREADY TAPPED IN ASIA — price worked into the zone during the Asian session and then broke structure against the range. The Asian high is now protected. The indicator says so on the chart and points you at the fallbacks instead: the 50 % of the range, an internal range high (trend line liquidity), or a fair value gap built inside the Asian session.
· STRONG HIGH / STRONG LOW INSIDE THE RANGE — a sweep immediately followed by a break of structure. That extreme is protected. What looks like equal highs later on is a rejection-block reversal, not a raid. Wait for the sweep and you miss the trade.
⑥ NEWS FILTER
High-impact US news in the New York session turns London into a range or a one-way run with no reversal. Pine cannot read a news feed, so paste the dates and those days are skipped.
━━━ WHY EVERY SIGNAL EXPLAINS ITSELF ━━━
Hover any signal pill and you get the full reasoning, not a label:
the range and its size, the exact price the liquidity was raided at, which point of interest it landed in, what the higher timeframe structure was doing, which confirmation fired, whether the raid was validated by a fair value gap, plus entry, stop, both targets, risk in pips, reward in pips and the R multiple.
Setups that were found but rejected are explained too. A "NO TRADE" tag tells you the raid, the zone and the confirmation were all there but the reward did not pay for the stop — so you learn the filter instead of wondering why nothing fired.
Every zone, every structure event, the range lines, the OTE levels and both education cards carry the same kind of tooltip. There is a HOW TO READ THIS card and an honest BEFORE YOU TRADE THIS card on the chart.
━━━ COCKPIT PANEL ━━━
Live session state, symbol, chart timeframe, higher-timeframe bias, the full Asian range with a PROTECTED / OPEN flag on each side, an eight-step checklist that fills in as the setup builds, the open position with stop and target, a large status line, a rough win / loss / break-even tracker and the timestamp of the last signal.
━━━ ALERTS AND AUTOMATION ━━━
Every event fires a clean JSON payload ready for a webhook — entry, stop, both targets, the range boundaries, the point of interest that produced the signal, symbol, exchange, timeframe, volume and an optional account field. Events: ENTRY, TP1, SL, BE, SWEEP, RANGE. Five plain-language alertconditions are included as well for anybody who just wants a notification.
━━━ SETTINGS WORTH KNOWING ━━━
· Sessions are fully configurable if your broker feed needs a different reference
· Turn individual POI types and POI timeframes on and off
· Choose one confirmation model or let it take the first valid trigger
· Four stop modes, two-target management, break-even at a chosen R
· Full chart theme with navy background, mint / red candles and session shading — or switch it off and keep your own
━━━ HONEST NOTES ━━━
This model is mechanical up to the trigger. Direction is fixed and never inverts, the windows are fixed, the filters are fixed — but the final judgement, is this really the high of the session, stays discretionary. Anybody telling you a setup is 100 % mechanical is selling you something.
Expect zero to four setups a day across two pairs, roughly 20 pips average per trade, and losing days. Judge it weekly and monthly, never daily. The safest entry model fires rarely by design; the aggressive ones fire more and stop out more.
The win / loss counter in the panel is a rough on-chart tracker that assumes a fill at the marked price and resolves target before stop within the same bar. It is not a backtest and it is not a performance claim.
This indicator is a study tool. It is not financial advice.
━━━ CREDIT ━━━
The rule set follows the well-known ICT Asian-sweep model as it is taught publicly in the ICT community. The implementation, the point-of-interest engine, the no-sweep filters, the panel and the design are original work.
Open source — read it, change it, learn from it.
WHY THESE PARTS BELONG TOGETHER
The session range, the higher-timeframe point of interest and the lower-timeframe confirmation form
a single filter chain, and the model does not work with any link missing. The range supplies the
liquidity pool that is going to be raided, the higher-timeframe zone decides whether that raid is a
reversal or a trap, and the lower-timeframe trigger decides when. A raid without a zone is noise,
a zone without a raid has nothing to react to, and both without a trigger have no entry.
Indicator

Intraday Price Path Signature - London New York Tokyo WindowsOverview
Intraday Price Path Signature is a time-window price-action study for traders who want to examine how price movement develops inside selected intraday focus periods, including windows commonly monitored around the Tokyo/Asia, London and New York opens.
A conventional session highlighter mainly answers when a regional session is active. This indicator addresses a different question: how was price travel distributed and directed inside the selected window?
Each enabled window is divided into four equal clock-time phases, P1 through P4. The script measures the amount, direction and efficiency of price travel in each phase, classifies the completed sequence, and compares its phase concentration with prior occurrences of the same named window.
The result is a compact price-path signature rather than a broad session background, a set of session levels, or a buy/sell signal. It can be used to research London, New York, Tokyo/Asia or custom focus windows sometimes described by traders as kill zones, without assuming that any time window guarantees a particular outcome.
What makes this different
Most session tools focus on time identification through background shading, open/close markers, session ranges or active-session status. This script focuses on the internal formation of price movement inside a narrower research window.
Its main analytical differences are:
- Four-phase decomposition of every enabled window.
- True-range-style gross price travel that includes gaps between consecutive sampled bars.
- Directional-efficiency filtering so a phase is not called upward or downward merely because it finishes slightly above or below its start.
- A deterministic completed-window classification based on path efficiency, direction alignment, phase concentration and direction changes.
- Independent rolling comparisons for each named window and each matching phase.
- A completed phase strip that states the full P1-P4 sequence directly on the chart.
- A fixed panel that keeps live analytical context away from the candle area.
Core calculation
For each bar inside a focus window, gross bar travel is calculated as:
Gross bar travel = max(high - low, abs(high - previous sampled close), abs(low - previous sampled close))
The first sampled bar uses its own high-low range. This is a bar-based, true-range-style approximation of movement. It includes gaps, but it does not reconstruct the exact tick-by-tick path inside a candle.
The accumulated travel is divided among four equal clock-time phases:
Phase share = phase gross travel / completed-window gross travel
A phase share identifies which quarter of the configured time window contained the greatest portion of measured price travel. It is not a volume measure.
Phase direction is filtered by directional efficiency:
Phase directional efficiency = abs(phase close - phase open) / phase gross travel
When efficiency reaches the configurable threshold, the phase is classified as upward or downward according to its net displacement. When it does not, the phase is classified as rotational. This distinguishes an efficient directional move from a phase that travels extensively but finishes near its starting point.
The completed window also receives a path-efficiency value:
Window path efficiency = abs(window close - window open) / completed-window gross travel
Completed path classifications
A completed window is assigned one descriptive classification. When more than one condition is true, the first matching classification in the following priority order is used:
- Persistent rise or Persistent fall: sufficient window path efficiency and enough phase travel aligned with the completed direction.
- Rotational path: the phase sequence contains the configured number of directional changes and does not qualify as persistent.
- Front-loaded rise or Front-loaded fall: the first two phases contain the configured share of total travel.
- Late acceleration up or Late acceleration down: the final two phases contain the configured share of total travel.
- Phase concentration: one phase contains the configured dominant share of total travel.
- Evenly distributed: the difference between the largest and smallest phase shares remains within the configured tolerance.
- Mixed path: no earlier classification is satisfied.
These labels describe the completed structure under the selected thresholds. They are not forecasts, probabilities or trade recommendations.
Reading the completed phase strip
The default chart annotation is a two-line phase strip for each completed focus window. An example is:
● ASIA P1↑ P2↔ P3↓ P4↑
Front-loaded rise · Peak P2 35.8%
The first line shows the phase sequence:
- P1 through P4 identify the four equal clock-time phases.
- ↑ means the phase completed with sufficient upward directional efficiency.
- ↓ means the phase completed with sufficient downward directional efficiency.
- ↔ means the phase was rotational or did not meet the directional-efficiency threshold.
- · means the phase was not sufficiently observed.
The second line states the completed path classification and identifies the phase containing the largest share of gross price travel. The strip color identifies the configured window. By default, Asia is cyan, London is amber and New York is pink.
Completed strips are anchored to the final bar of their own window and rendered in front of the price chart. Their bodies extend to the left of the anchor so later bars to the right are less likely to pass underneath a historical strip.
The default Auto opposite close placement puts an upward-closing window below its protected price envelope and a downward-closing window above it. Automatic clearance considers the completed-window range, twelve preceding bars, opening and closing gaps, sampled internal gaps, the first bar after completion, local bar range, ATR and a small window-specific lane offset.
This system is designed to reduce candle overlap during normal chart use, including gap conditions. Because labels have a fixed screen-space size while chart scale and zoom remain user-controlled, extreme chart compression can still change the apparent distance between a label and nearby bars. Additional clearance is available in the settings.
Reading the fixed panel
The default bottom-left panel displays only enabled windows and keeps live detail away from the candles.
FOCUS shows the window icon, short code and configured local hours.
STATUS shows whether the window is live, closed or waiting. A live row also shows current completion progress.
PATH identifies the current phase and developing direction sequence while a window is live. After completion, it shows the most recent path classification.
PULSE shows four activity blocks representing the relative gross-price-travel share of P1 through P4. Taller block characters indicate a larger share. PULSE is a price-travel distribution, not volume or order flow.
CTX shows the developing price range during a live window. After completion, it shows the peak phase, its share and, when available, its empirical percentile. A diamond followed by a number is the percentile rank of that peak phase against the same phase of earlier occurrences of the same named window.
Independent historical comparison
Asia P1 is compared only with earlier Asia P1 observations. London P3 is compared only with earlier London P3 observations. New York, London Close and Custom maintain their own independent histories. Data from different named windows or different phase positions is not mixed.
The default rolling baseline contains 24 eligible completed windows and requires at least six prior samples before displaying percentiles. The current completed observation is ranked before it is added to its own history, so it does not inflate its own percentile. Tied values use a mid-rank treatment.
These percentiles are descriptive empirical ranks from the available rolling sample. They are not probabilities of future direction, continuation or reversal.
The following observations are excluded from the rolling baseline:
- A window first encountered after its configured start time because chart history began partway through it.
- A completed window with fewer than the required number of observed phases.
- A window with no measurable gross price travel.
- A window sampled on a chart environment that does not meet the selected timeframe or chart-type requirements.
Default focus windows
Asia Open: 09:00-10:00, Asia/Tokyo, enabled.
London Open: 08:00-10:00, Europe/London, enabled.
New York Open: 09:30-11:00, America/New_York, enabled.
London Close: 15:00-16:30, Europe/London, disabled by default.
Custom Focus: 12:00-13:00, Etc/UTC, disabled by default.
The default day mask is Monday through Friday. Each window has its own IANA timezone, so London and New York follow their selected local daylight-saving rules. These times are configurable research references, not universal exchange, broker or instrument schedules.
Display modes and customization
Phase strip is the publication default. It shows completed phase strips and the fixed panel without broad session shading.
Phase strip + adaptive lens adds a very light live background lens whose hue and transparency respond to the current phase direction and concentration.
Research detail enables optional legacy pulse blocks, block captions and larger research summaries.
Panel only removes bar-anchored chart annotations and leaves the fixed panel.
Users can adjust window names, codes, icons, hours, days, timezones, colors, panel placement, strip clearance, retention limits, analytical thresholds, historical lookback, minimum sample count, visual modes and alerts.
Suggested use
This indicator is intended for intraday research. Five-minute charts generally provide the clearest balance between phase detail and readability. The default maximum timeframe is 15 minutes and can be changed by the user.
Possible research questions include:
- Did most movement occur early or late in the selected window?
- Was the path persistent, rotational, evenly distributed or dominated by one phase?
- Did the largest phase have an ordinary or unusual share relative to recent matching windows?
- Do different instruments show different path signatures around the same local open?
- Does a custom focus period behave differently from the standard Asia, London or New York defaults?
The study can be applied to liquid intraday markets where time-of-day behavior is relevant, including FX, index products, futures, equities and cryptocurrencies. Users should adapt the configured times to the instrument and data feed being studied.
Alerts
Optional informational alerts are available for focus-window start, focus-window completion and unusually high phase concentration relative to the selected historical percentile threshold. Alerts describe an observed state. They are not entry or exit signals.
Limitations and data behavior
- The calculation uses chart bars, not tick data, and cannot reconstruct the exact intrabar route taken by price.
- PULSE measures price travel, not traded volume, liquidity or order flow.
- Historical percentiles depend on the amount and quality of chart history currently available.
- Missing bars, illiquid periods and data-feed differences can change phase sampling.
- Holidays, early closes, exchange-specific breaks and broker-specific schedules are not detected automatically.
- Live panel values develop as new bars arrive and are not final until the window completes.
- Completed phase strips are created from information available when the window ends. The script does not use future bars or lookahead data.
- No higher-timeframe price request is used; calculations are based on the current chart bars and configured local times.
- A standard chart type is required by default. Transformed chart types can alter measured paths and are therefore disabled unless the user overrides the requirement.
- Classification results depend on the selected thresholds. Changing inputs recalculates historical results under the new configuration.
- Automatic label clearance reduces overlap but cannot control every possible screen layout, zoom level or manual chart-scale compression.
What this indicator does not do
- It does not generate buy or sell signals.
- It does not provide entries, exits, targets, stops or position sizing.
- It does not predict the next phase or the next session.
- It does not claim a win rate, accuracy rate or profitability improvement.
- It is not a strategy or a backtest system.
- It is not financial advice.
Use the output as descriptive context alongside independent analysis and risk management. Indicator

ICT Macros & Killzones & Clock [D4A]ICT Macros
According to ICT (Inner Circle Trader) and his SMC framework, a macro is a small program or set of instructions that runs within an algorithm, which influences price movements in the market. These macros operate at specific times and can be related to price movements from one level to another or certain market behaviours during specific time intervals. They help traders anticipate market movements and potential setups during specific times of the day.
To trade these effectively, it is important to understand the time of day when certain macros run, and understand the concept of market liquidity. The theory behind this - is that the market will either seek buy side or sell side liquidity, or seek to rebalance price at a point of interest in between the open and close of the macro. Traders who follow this theory can use that information to anticipate how price might behave.
This script allows traders to visualize the time when a macro will likely occur in the market. As per ICT, most macros run at every hour from x:50 till x:10. The script draws boxes and lines representing a period of time when a macro runs. Additionally, a label is placed next to the line indicating Macro Open (MO). The script includes alerts that can notify traders when a macro starts.
The following Macros are displayed by the script:
London KZ
02:30 - 03:00 (London Legacy)
04:00 - 04:30 (London Legacy)
01:50 - 02:10
02:50 - 03:10
03:50 - 04:10
04:50 - 05:10
05:50 - 06:10
NY AM KZ
06:50 - 07:10
07:50 - 08:10
08:50 - 09:10
09:50 - 10:10
10:50 - 11:10
11:50 - 12:10
12:50 - 13:10
NY PM KZ
13:50 - 14:10
14:50 - 15:10
15:15 - 15:45
15:50 - 16:10
KZ - Killzones
Apart from displaying the macros, the script visualizes another ICT concept - Killzones. The killzone is a time period when there is an increased market participation from major institutions and big traders who are able to influence price movement. According to ICT this is a good time to participate in the market, as the price will move much quicker than outside of killzone times, allowing for more trading opportunities. The macros that run during killzone may have more weight and importance to macros running outside of a killzone.
How to spot a killzone
The script draws small dots either at the top or the bottom of the screen during the time the killzone is in play. There are three major killzones, pertaining to futures market which have been pre-defined in the script, but each user can modify the times to reflect their own understanding and specific instrument they are trading. The script can display small circle next to the clock which symbolizes that we are in a killzone period.
The following killzones are pre-defined:
London KZ 02:00 - 5:00
NY AM KZ 07:00 - 11:30
NY PM KZ 13:30 - 16:00
The Clock
When the market is open the script displays a digital clock which can also show when a specific macro is running by displaying macro time. The clock is also able to display when we are in a period of active killzone, which is symbolized by small circle next to the clock.
The script is intended to run on 1m timeframe, but it can also run up to 15m and on sub 1m charts. On higher timeframes it's not practical to display macro information.
SETTINGS:
- KZ Killzones - enable display of killzones
- Timezone - set by default to New York timezone
- Lookback - how many past bars are used for computation
- London KZ, NY AM KZ, NY PM KZ - here the user can define exact times for a killzone
- KZ Markers - the script displays small dot (marker) to represent killzone period
- Location - the location of killzone markers on the charts
- Hide Above - hide KZ markers above certain timeframe
- Macros - enable the display of elements representing a macro on the charts
- Hide Above - hide all macro drawings above certain timeframe
- Fill - the background of the box representing a macro
- Highlight - the box representing a macro can be highlighted
- Label - displays macro header containing either MACRO or the time the macro runs
- Hour - displays the time when a macro runs (Label must be enabled for this to work)
- MO - Macro Open line
- Hide Above - hides macro box and MO line above certain timeframe
- Macro pre-defined times - here the user can enable or disable specific macros
- Box/Fill/Border/Highlight - define macro box background, border and highlight transparency
- Label - defines macro header colors
- MO - Macro Open line - defines macro open line style and color
- Show Clock - enables the display of a digital clock
- Background - the background of the clock
- Position - the location of the Clock in the chart
- Time - enable 24h or 12h clock and define the size of the clock when outside of macro and when in macro period
- Macro - define colors of displayed macro time information in the Clock
- Colorize - changes the background of displayed macro information
- KZ Marker in Clock - displays circle next to the clock when we are in active killzone
- Enable Alert at Macro Start - enables elerts when specific macro starts. You still need to add alert for the script in PulseWire to make it work.
NOTE
The script has been preconfigured for dark background in PulseWire. You may need to tune up the colors to satisfy your own PulseWire setup.
-----------------
Disclaimer
The content provided in this script is for educational and informational purposes only. It does not constitute financial advice, investment recommendations, or a solicitation to buy or sell any financial instruments. I will not accept liability for any loss or damage, including without limitation any loss of profit, which may arise directly or indirectly from the use of or reliance on such information.
All investments involve risk, and the past performance of a security, industry, sector, market, financial product, trading strategy, backtest, or individual's trading does not guarantee future results or returns. Investors are fully responsible for any investment decisions they make. Such decisions should be based solely on an evaluation of their financial circumstances, investment objectives, risk tolerance, and liquidity needs. Indicator

ICT Kill Zone Sniper [JOAT]═══ ICT KILL ZONE SNIPER ⚡ ═══
A session-aware sniper tool that paints every candle by its active kill zone, tracks the liquidity pool each session leaves behind, and fires a single clean BUY or SELL only after price sweeps the prior pool and reverses back inside the current kill zone. Built for traders who wait for the liquidity grab, not the breakout.
▎ WHAT IT DOES
It splits the trading day into four classic kill zones — Asia , London , NY-AM and NY-PM — colors the candles inside each one, and records the high and low that every finished session builds. Those prior highs/lows become the liquidity pools hunted in the next window. When the current kill zone reaches into one of those pools and then closes back through it, the tool marks the sweep and projects a full trade: entry, ATR stop, and an R-based target zone.
▎ HOW IT WORKS
• Kill-zone clock — each session window is evaluated in a chosen wall-clock timezone (New York by default). Membership is na-guarded, so it behaves correctly on any intraday timeframe and simply idles on higher timeframes.
• Session state machine — while a kill zone is live, the tool expands that session's running high and low. When the session ends, that high/low is frozen as the prior liquidity pool and drawn as dashed projection lines carried into the next window.
• Sweep + reversal detection — a high sweep needs price to trade above the prior pool high yet close back below it; a low sweep needs a dip below the prior pool low with a close back above. A Min Sweep Depth (× ATR) filter rejects micro-penetrations caused by spread and tick noise.
• Confirmation — sweeps can be evaluated on confirmed bar close only, so signals do not repaint intrabar. At most one long and one short can print per kill-zone occurrence when the one-per-side lock is on.
• Optional HTF bias — a higher-timeframe EMA (requested with lookahead off) can gate direction: longs only above it, shorts only below it.
• Trade projection — on a valid signal the stop is placed beyond the swept extreme plus an ATR buffer, risk is measured from entry to stop, and the target is set at your chosen R multiple. Reward and risk are drawn as tinted zone boxes with entry/SL/TP lines and level labels.
• Optional VWAP — a session-anchored VWAP with a ±σ band is available as extra context.
▎ HOW TO USE IT
• Wait for a BUY or SELL pill to print inside a colored kill zone — it means the prior pool was swept and price reversed back through it.
• The green zone box is the reward leg toward the R-target; the red zone box is the risk leg to the stop. The label pill shows the session and the R multiple.
• Use the dashed prior high/low lines as the liquidity being hunted this session — signals cluster around them.
• Treat the HTF bias as a directional filter and the sweep tags as confirmation that liquidity was actually taken before you commit.
• Combine with your own structure read; the tool marks the setup, you manage the trade.
▎ KEY SETTINGS
• Kill Zones — timezone plus editable session windows for Asia, London, NY-AM and NY-PM.
• Signal Engine — ATR length, confirm-on-close, one-signal-per-side lock, and minimum sweep depth.
• HTF Bias — toggle, higher timeframe, and EMA length.
• Trade Model — stop buffer beyond the sweep, risk/reward target in R, projection length, and how many past signals to keep.
• Visuals — candle tinting and transparency, session boxes, pools, sweep tags, signal labels, SL/TP lines and zone boxes, VWAP bands, and label size.
• Dashboard — show/hide, position, and text size.
▎ DASHBOARD
A cyberpunk chrome-gradient panel reporting the active session , current session high/low , a countdown to the next kill zone , the HTF bias state, the last liquidity grab side, the active signal with bars-since, the last entry , its stop / target , the current ATR , and a running long / short signal tally .
▎ ALERTS
• KZ Sniper Long — prior-pool low sweep plus bullish reversal inside a kill zone.
• KZ Sniper Short — prior-pool high sweep plus bearish reversal inside a kill zone.
▎ NOTES
• Works across assets; the session logic is intended for intraday timeframes and idles on higher ones.
• Confirm-on-close keeps signals non-repainting; the HTF EMA is requested with lookahead off.
• Nearly every visual has a toggle, so you can strip it down to just the candles and signals for a clean chart.
• Any on-chart tallies reflect historical signals only.
For research and education only. This is not financial advice. No indicator can predict the future, and past behavior does not guarantee future results. Always manage your own risk.
Made with passion by JackOfAllTrades ⚡ Indicator

ICT Sessions & Killzones [JOAT]ICT Sessions and Killzones
Maps the trading day into sessions and killzones, then shows where each session's liquidity rests and when the next session raids it.
What it is
Intraday price is organised by time: different sessions have different behaviour, and each one leaves liquidity that the next session hunts. This indicator frames when the market is active and where that liquidity sits, so the raids become obvious in advance. It is an original session-mapping tool built around the widely-taught concept of session killzones and inter-session liquidity.
How it works
• Session boxes — Asia, London, New York AM and New York PM are each boxed from their own high to their own low across their clock window. The box is that session's realised range, and its edges are the liquidity the following sessions tend to seek.
• Liquidity lines — every completed session leaves its high and low as thin levels extended to the right. Resting buy-side liquidity sits at the highs, sell-side at the lows, each labelled.
• Sweeps — when a later session trades through a prior session's high or low, that raid is tagged, marking where stops were likely taken.
• Classic reference levels — the previous day's high and low and the midnight open are drawn as the anchor points this style of analysis leans on.
• Bias read — a simple, transparent read from the midnight open and the most recent killzone sweep-and-reclaim prints an understated directional tag. This tool is about mapping context and timing; it deliberately shows direction rather than full trade management.
The dashboard
An adjustable session-clock panel shows which session is currently active, the countdown context of the day, the most recent liquidity event, the current bias, and the reference levels in play, so the state of the day is readable at a glance.
How to use it
• Set the session windows and timezone to your market.
• Watch for a session to sweep the prior session's high or low and then reclaim — that is the timing this map is built to highlight.
• Use it as a context and timing layer beneath your own entry method, or alongside a structure or entry tool.
Settings
Session windows and timezone, which sessions and reference levels to display, sweep marking, bias options, plus full visual and dashboard controls.
Originality and usefulness
The contribution is a single, coherent map of session ranges, inter-session liquidity, sweeps and classic reference levels, with a transparent bias read — assembled so a trader can see the day's liquidity structure and timing without cluttering the chart. Everything evaluates on confirmed bars and does not repaint.
Notes and limitations
• Session times depend on the timezone and the instrument's trading hours; set them correctly for your market.
• The bias read is intentionally simple context, not a standalone trade signal.
• This tool maps liquidity and timing; it does not place stops or targets for you.
• Educational and analytical tool, not financial advice.
— made with passion by officialjackofalltrades
Indicator

Session Kill Zone Volume Map [StrixEDGE]Session Kill Zone Volume Map
A session-aware overlay that maps institutional kill zones — London, New York, and Asia — directly onto your chart with volume-weighted session boxes, Opening Range Breakout levels, and a unified analytics dashboard. Built to give intraday traders immediate visual context on where volume clusters, how sessions develop relative to their historical norms, and when a confirmed breakout is underway.
🔍 What This Indicator Does
The indicator automatically detects the three major forex/futures sessions based on UTC time and draws color-coded session boxes whose fill intensity scales dynamically with real-time volume. High-volume sessions appear visually heavier; low-volume sessions fade into the background. This gives you an instant read on whether today's session is running hotter or cooler than average — without checking a single number.
On top of each session, it tracks the Opening Range (first 15, 30, or 60 minutes) and plots ORB-High and ORB-Low levels as dashed reference lines extending through the session. When price breaks an ORB level with volume confirmation, a directional marker (▲ or ▼) prints on the chart and an alert fires.
▲
▼
A single unified dashboard panel consolidates everything: live session volume, percentage distribution with a visual bar, historical average range, ORB win rate, and session sample count — all in one clean table.
⚡ Key Features
Session Auto-Detection
London (08:00–17:00 UTC)
New York (13:00–22:00 UTC)
Asia (00:00–09:00 UTC)
are detected automatically. All session start and end times are fully customizable down to the minute, so you can adjust for DST shifts or align to your broker's server time.
Volume-Weighted Session Boxes
Each session box fills with the session's assigned color at a transparency that adjusts in real time based on cumulative volume relative to the historical session average. A session running at 2× its normal volume will render noticeably more vivid than one at 0.5×. The base transparency is user-controlled.
Opening Range Breakout (ORB) Levels
The indicator captures the high and low of the first N minutes of each session (configurable: 15 / 30 / 60 min) and draws them as horizontal reference lines. These extend through the rest of the session, serving as the breakout thresholds traders watch for directional continuation.
Volume-Confirmed Breakout Signals
When price closes beyond an ORB level and the breakout bar's volume exceeds the 20-period SMA × a user-defined multiplier (default 1.5×), a directional triangle prints on the chart. No volume confirmation = no signal. This filters out low-conviction breaks.
Unified Session Dashboard
A single professional table displays all session data at a glance:
- Live session volume (absolute + percentage share)
- Volume distribution bar per session
- Historical average session range over your chosen lookback
- ORB win rate (percentage of confirmed breakouts that held direction through session close)
- Session sample count
Table position, text size, and visibility are all input-controlled.
Session High/Low Break Alerts
Separate alert conditions fire when price crosses the previous session's high or low with volume confirmation, giving you an additional layer of inter-session breakout detection.
9 Alert Conditions
Individual bull/bear ORB break alerts per session, a unified "any ORB break" alert, and session high/low break alerts — all configurable in PulseWire's alert manager.
⚙️ Inputs & Settings
| Group | Setting | Description |
|---|---|---|
| Session Times | Start/End Hour & Minute | Full control over each session's UTC boundaries |
| ORB Settings | Period (15/30/60 min) | Opening range duration |
| ORB Settings | Line Style / Width | Visual style of ORB levels |
| Display | Show/Hide Sessions | Toggle individual session boxes |
| Display | Base Box Transparency | Controls how transparent session boxes are at normal volume |
| Display | Dashboard Position | Table corner placement |
| Display | Dashboard Text Size | Tiny / Small / Normal / Large |
| Display | Stats Lookback | Number of past sessions for avg range and ORB win rate |
| Alerts | Volume Confirm Multiplier | How far above SMA(20) breakout volume must be |
| Colors | Session & Breakout Colors | Full color customization per session and direction |
📖 How To Use
Session Context
Load on a 5m–1H chart. The session boxes immediately frame where London, New York, and Asia operated. The fill intensity tells you which session carried the most conviction — use that to weight your analysis toward the active kill zone.
ORB Strategy
After the opening range completes, the ORB-H and ORB-L lines become your breakout thresholds. A volume-confirmed break (▲/▼ marker) signals directional intent. Traders often look for price to retest the broken ORB level as support/resistance before committing to a continuation trade.
▲
▼
Dashboard Read
Check the Vol % column to see which session is dominating flow. The ORB WR column tells you how reliable ORB breakouts have been historically for each session on the current instrument — if London shows 85% and Asia shows 50%, that's actionable edge for session selection.
Alerts
Set up any of the 9 alert conditions to get notified without watching the chart. Combine the unified "Any ORB Break" alert with a mobile notification for hands-free monitoring.
📋 Notes
- Designed for intraday timeframes (15m and below recommended for ORB accuracy). A warning displays if loaded on Daily or higher.
- During the London/NY overlap window (13:00–17:00 UTC by default), volume is attributed to both sessions. The percentage distribution shows relative contribution, not mutually exclusive slices.
- ORB win rate is a binary metric: did price close beyond the broken ORB level at session end? It does not measure how far price traveled.
- The volume gradient uses transparency modulation, not a multi-stop color gradient, due to Pine Script rendering constraints.
- Works on any instrument with volume data (forex via tick volume, futures, crypto, equities). Indicator

RPFXBYDAN Liquidity Sweep Cascade [SMC]# Publication settings
**Publish this open-source, not invite-only/closed-source.** Every concept used here (liquidity sweeps, CISD, FVG, order blocks, kill zones, SMT divergence) is public-domain ICT/SMC terminology, not proprietary logic — PulseWire's moderators specifically hold closed-source and invite-only scripts to a much higher bar (you have to justify what's unique enough to hide, and why it's worth paying for). Open-source sidesteps that requirement entirely and is the safer, more defensible choice for a script built from publicly-known building blocks combined in an original way.
# Title
RPFXBYDAN Liquidity Sweep Cascade
# Description
**Why these pieces are combined (not a mashup for its own sake)**
Each concept here exists to solve a specific failure mode of using it alone. A liquidity sweep by itself is noise — most swing highs/lows get taken out without reversing. Requiring a CISD (a shift in orderflow) after the sweep filters out sweeps that don't actually reverse. Requiring the entry to land inside a Fair Value Gap in the discount/premium half of the range filters out CISDs that reverse but leave a bad entry price. None of these three alone is a tradeable signal; the combination is the point.
The three-tier structure exists because a signal on one timeframe alone doesn't tell you if you're trading with or against the bigger picture. Tier 1 establishes the higher-timeframe liquidity/imbalance context. Tier 2 only starts hunting once Tier 1 completes, confirming the reaction on a mid-timeframe inside a session kill zone. Tier 3 only starts once Tier 2 completes, and is the only tier that produces a real stop/target — it's the culmination of the other two agreeing, not an independent signal. That sequential gating (each tier consumed by exactly one attempt from the tier above it) is the original mechanism in this script, not the individual concepts themselves.
SMT divergence and Inverse FVG tracking are optional add-ons layered on top of that same gated engine, off by default, for traders who already use those specific confluences.
**What this is**
A three-tier Smart Money Concepts checklist that only flags a setup once liquidity, structure, and risk all line up across three timeframes:
- **Tier 1 – HTF Context**: a higher-timeframe liquidity sweep reacting into an HTF imbalance (your Point of Interest).
- **Tier 2 – Mid Structure**: inside a session/kill-zone window, a mid-timeframe (default 15m) sweep, shift in orderflow (CISD), and Fair Value Gap / order block — only evaluated once Tier 1 has completed.
- **Tier 3 – Entry**: on your chart's own timeframe, a sweep, CISD, and FVG (or a confirmed Inverse FVG retest if no fresh FVG appears) — only evaluated once Tier 2 has completed. This is the only tier with a defined stop, a fixed R-multiple take-profit, and a Risk:Reward gate.
Optional confluence layers: SMT divergence against a correlated symbol (e.g. ES vs NQ), and an HTF directional bias readout.
A live table shows exactly which of the checklist items are satisfied, tier by tier, so you can see why a setup is or isn't "complete" instead of guessing.
**How to use it**
1. Set Tier 1's HTF input to something meaningfully higher than your chart (e.g. 4H/Daily if you trade 5m-15m).
2. Set Tier 2's mid-timeframe input (default 15m).
3. Enable the kill zone(s) you actually trade (New York AM is on by default).
4. Optionally set a correlated symbol for SMT divergence.
5. Watch the table: green checks across all three tiers plus R:R = a completed setup. Alerts fire automatically on completion (bullish and bearish are separate alert conditions).
**Limitations (read before trusting a green table)**
- This is a deterministic, rule-based approximation of a discretionary trading concept. Every judgment call in the code — how CISD is defined, where the 50% discount/premium line sits, how SMT divergence is measured — is this author's interpretation, not a universally agreed-upon standard.
- Higher-timeframe values only update when that HTF candle closes, by design, so they can lag price intentionally.
- Bar Replay does not render this script's drawings/table live (a PulseWire platform limitation with drawing objects, not a bug in the script) — use a live or normal historical chart to watch it work.
- No indicator predicts the future. Backtest and forward-test on your own instrument and timeframe before risking real money. Nothing here is financial advice.
Indicator

Indicator

ICT Killzones & Silver BulletEN: Highlights the key ICT time windows on your chart — Killzones and Silver Bullet
sessions — so you instantly see when institutional activity is most likely.
A clean time-window tool for ICT / Smart Money traders. It shades the key intraday
windows directly on the chart, in New York time, regardless of your local timezone:
• Killzones — 7 fully customizable time windows (on/off, start and end by hour and
minute). Defaults follow the high-activity ICT macro windows around session opens.
• Silver Bullet — the three classic one-hour ICT windows where setups are hunted:
London (03:00–04:00 NY), NY AM (10:00–11:00 NY), NY PM (14:00–15:00 NY).
Every window is editable, has its own toggle, color, border style and optional label.
The indicator only draws a window while price is inside it, keeping the chart clean.
raders waste focus tracking the clock — when is London, when is the Silver Bullet,
is price inside a high-probability window. This tool marks every key window
automatically in NY time, so you never miss a session and never miscount the hours.
WHAT IT SHOWS
Shaded boxes appear only while price is inside a time window. Killzones use one color,
Silver Bullet windows another, each with an optional label.
KILLZONES (group "Killzones")
- "Show Killzones" — turn the whole module on/off.
- Color, border style (Solid/Dotted/Dashed/No border), border transparency, labels.
- 7 zones (KZ1–KZ7): each row = , NY time.
- Defaults follow ICT macro windows. Edit any zone to your own times.
SILVER BULLET (group "Silver Bullet")
- "Show Silver Bullet" — on/off, plus color, border transparency, labels.
- 3 classic one-hour windows (editable by hour, NY time):
London SB: 03:00–04:00
NY AM SB: 10:00–11:00
NY PM SB: 14:00–15:00
HOW TO USE
1. All times are New York — no manual timezone conversion needed.
2. Best on M15 and lower, where the windows are clearly visible.
3. Look for entries / liquidity grabs INSIDE these windows — that is when
institutional activity is most likely.
4. Disable the windows you don't trade to keep the chart clean.
WANT CLASSIC KILLZONES INSTEAD OF MACROS?
Set wider windows, e.g. London 02:00–05:00, NY AM 07:00–10:00, NY PM 13:30–16:00.
NOTE: This is an analytical timing tool, not financial advice. Always confirm with
price action and risk management. Indicator

OHLC-OLHC [ARKN] ARKN combines three time-based analysis tools into a single overlay so that session context, higher-timeframe structure, and cross-asset divergence can be read together on one chart, without stacking three separate indicators.
What it does
Killzones — Draws up to four configurable session boxes (defaults: Asia, London, NY AM, NY PM) with optional session high/low pivot lines, midpoints, day-of-week labels, opening-price lines, and an "opening candle" marker. Pivots can extend until mitigated or past mitigation, with optional alerts when a session high or low is broken.
HTF Candles — Renders up to four higher-timeframe candle sets to the right of the live price, each with its own timeframe and display count. Optional Fair Value Gap and Volume Imbalance boxes, a remaining-time countdown, and interval labels are drawn directly on the projected candles.
Sequential SMT (SSMT) — Detects SMT-style divergence between correlated instruments across nested cycles (Micro, 90-minute, Daily, Weekly, Monthly). Triads can be set automatically for common groups (metals, indices, FX, crypto, futures) or defined manually, with an inverse option for negatively-correlated pairs. Both standard (wick-based) and hidden (body/close-based) divergences are supported.
Why these three together
The three modules answer three sequential questions a session-based trader asks in order: when (Killzones frame the active session), what structure (HTF Candles show the higher-timeframe bias forming in real time), and confirmation (SSMT flags when a correlated instrument fails to confirm the move). Combining them removes the need to switch layouts or sync timeframes manually, since all three share the same timezone and session logic.
How to use
Set your timezone under Settings; all sessions and cycles reference it.
Each module has a master ON/OFF toggle at the top of its settings group.
For SSMT, either leave Triad Selection on Auto (it picks correlated assets for the current symbol) or set Manual to define your own triad. Lower timeframes show Micro/90m cycles; higher timeframes show Daily/Weekly/Monthly.
HTF Candle timeframes must be higher than the chart timeframe to display.
Settings overview
Global: drawing limit, timeframe limit, timezone, label size, text color, cutoff time. Per module: session times and colors (Killzones), timeframe and candle count (HTF Candles), cycle visibility, line styles, and correlation triads (SSMT).
Note on originality
This script combines well-established, publicly-discussed ICT community concepts — session Killzones, projected higher-timeframe candles, and SMT/Sequential SMT divergence. These concepts are not original to this script; the contribution here is integrating all three into one configurable overlay with shared session and timezone handling. The script is published open-source so the implementation can be reviewed and reused. Indicator

Indicator

KillzonesPlots the major intraday killzones used in orderflow/ICT analysis as session
boxes. Up to five fully configurable sessions (Asian, London, NY AM, London
Close, NY PM by default) are drawn on the chart, so you instantly see the
windows where intraday liquidity is typically built and swept.
Each box automatically tracks the high and low of its session, giving you the
session range and its liquidity edges at a glance. All sessions are calculated
in a selectable timezone (default New York, with automatic DST handling so the
windows match ICT killzone times year-round). Optional vertical lines mark each
session's open and close, and labels name each zone.
Because the sessions are purely time-based, completed killzones are fixed and do
not repaint; only the active session updates in real time as price extends.
Use the killzones to frame WHEN you look for setups (e.g. sweeps and reversals
into London/NY after the Asian range), not as standalone signals.
Settings: enable/disable each session, custom times and timezone, weekdays-only
filter, per-session colors, optional open/close lines and labels, extend-after-
session, and a historical zone limit.
This tool is for visualization only. It issues no buy/sell signals and makes no
claim about future performance. Indicator

SmartFlow Kill ZoneSmartFlow Kill Zone highlights the three major trading sessions (Tokyo, London, New York) and their corresponding ICT Kill Zones directly on your chart. Designed for intraday traders who use session-based and Smart Money Concepts (SMC) strategies, this indicator gives you instant visual clarity on when high-probability trading windows are active.
█ WHAT IT DOES
This indicator identifies and displays the three global forex sessions and three ICT Kill Zones using distinct background colors. It also tracks the High and Low of each session in real time and draws horizontal reference lines that update as the session progresses.
A built-in dashboard provides a quick overview of which sessions and Kill Zones are currently active, along with each session's range in pips.
█ HOW IT WORKS
Session and Kill Zone detection is based on time-of-day logic using the user-selected timezone (default: America/New_York):
Sessions:
- Tokyo: 19:00 – 04:00 ET
- London: 03:00 – 12:00 ET
- New York: 08:00 – 17:00 ET
Kill Zones (ICT):
- London Kill Zone: 02:00 – 05:00 ET
- New York Kill Zone: 07:00 – 10:00 ET
- Asian Kill Zone: 20:00 – 00:00 ET (off by default)
Session High/Low lines are drawn from the session's opening bar and updated on every new bar during the session. When a session closes, lines optionally extend to the right until the next session of the same type begins. Previous sessions' High/Low lines are preserved across multiple days (configurable via "Days to Display").
The dashboard table uses the last bar's data to show open/closed status, the session's current range, and whether any Kill Zone is active.
█ HOW TO USE
- Apply the indicator to any intraday chart (1m to 1h recommended).
- Use the background shading to quickly identify which session you are trading in.
- The brighter Kill Zone overlay tells you when the highest-probability reversal windows are active — this is where ICT traders look for optimal trade entries.
- Session High/Low lines act as key reference levels. Price often reacts at these levels as they represent session-based liquidity.
- The dashboard gives you a heads-up display so you never miss a Kill Zone activation.
█ FEATURES
- Three session backgrounds with independent on/off toggles
- Three ICT Kill Zone backgrounds with independent on/off toggles
- Real-time Session High/Low tracking with configurable line style and width
- High/Low labels that update live during the session
- "Extend Lines Right" option for lines to project forward until the next session
- Multi-day history (up to 30 days of past session H/L lines)
- Dashboard with session status, range (pips), and Kill Zone status
- Dashboard position and size are fully customizable
- 9 alert conditions (session open/close and Kill Zone activation)
- Full timezone support (10 major timezones)
- Works on any symbol and any intraday timeframe
█ SETTINGS
Sessions — Toggle visibility for Tokyo, London, and New York sessions.
Kill Zones — Toggle each ICT Kill Zone independently. Asian KZ is off by default.
Colors — Customize background colors for each session and Kill Zone.
Session High/Low — Toggle H/L lines and labels, set line width, style, and right extension.
Dashboard — Toggle, reposition, and resize the info panel.
Timezone — Select the timezone used for session calculations.
History — Set how many days of past session H/L lines to display (1–30).
█ NOTES
- This indicator does not generate buy or sell signals. It provides session structure and timing context to support your own trading strategy and decision-making.
- Kill Zone times are based on the ICT (Inner Circle Trader) framework. Different educators may define slightly different windows.
- For best results, use on timeframes of 1 hour or lower where session boundaries are clearly visible. Indicator

Indicator

CandelaCharts - Killzone Supertrend📝 Overview
The CandelaCharts - Killzone Supertrend indicator integrates professional, noise-filtered Supertrend volatility-based trend-following logic within specific intraday sessions. By isolating trend analysis to key Killzones and providing advanced smoothing tools, traders can effectively filter out market noise and identify high-probability trend shifts during periods of peak institutional activity.
📦 Features
5 Customizable Sessions : Tracks trends across Asia, London, NY AM, NY Lunch, and NY PM sessions.
Continuous Detection : Unlike standard session indicators that reset, this logic runs continuously in the background. This ensures that the trend state is established accurately before the session begins, eliminating "initialization lag."
Full Session Backgrounds : Highlight the entire vertical pane for each session with customizable colors and transparency for maximum focus.
Source Smoothing : Smooth the price source (hl2) before calculation to filter out minor whipsaws and reduce false signals in choppy markets.
Multi-Method ATR : Choose between RMA, SMA, EMA, or WMA for volatility calculations based on your preferred responsiveness.
Visual Signal Markers : Clear Triangle Up/Down markers appear instantly when a trend flip occurs within an active session.
Trend Fill : Shaded backgrounds between the Supertrend line and price provide a visual "cushion" to assess trend strength.
Dynamic Session Labels : Centered labels that automatically adjust their position based on the session's price range.
Session Dividers : Clear vertical dividers to signal the transition between trading periods.
⚙️ Settings
ATR Period : Lookback period for the Average True Range calculation (default: 10).
Multiplier : Volatility multiplier for the trailing stop (default: 3.0).
Source Smoothing : EMA period to smooth price before detection (0 = off).
ATR Method : Choose the smoothing method (RMA, SMA, EMA, WMA).
Show Signals : Toggle Triangle Up/Down markers for trend changes.
Show Trend Fill : Toggle the shaded background between price and Supertrend.
Label Size : Customize the text size of session labels.
Timezone : Supports America/New_York, UTC, and Exchange time.
Divider Style : Style and color settings for vertical lines.
Show Session : Toggle the Supertrend logic and markers.
Background : Toggle the full vertical pane background color.
Session Name & Time : Define labels and time windows.
Session Color : Sets the theme for the labels and dividers.
Show Labels : Toggle the centered session identifiers.
Show Divider : Toggle vertical start/end lines.
⚡️ Showcase
Supertrend Lines & Signals
Session Boxes & Full Backgrounds
🚨 Alerts
Trend changes are visually indicated by line color shifts and Triangle markers (Buy/Sell) within each active session.
⚠️ Disclaimer
Trading involves significant risk, and many participants may incur losses. The content on this site is not intended as financial advice and should not be interpreted as such. Decisions to buy, sell, hold, or trade securities, commodities, or other financial instruments carry inherent risks and are best made with guidance from qualified financial professionals. Past performance is not indicative of future results.
Indicator

Session Killzones & Breakouts [BigBeluga]🔵 OVERVIEW
Session Killzones & Volume Flow Profile is a professional-grade market structure tool that merges time-based "Killzone" analysis with intraday volume distribution. This advanced version covers the full global trading cycle— Asia, London, and New York —and now includes a Performance Statistics Dashboard to track historical breakout success.
By visualizing the "Point of Control" (POC) and volume distribution, it helps traders understand institutional interest zones, while the new dashboard provides a quantitative edge by showing how often each session successfully hits its expansion targets.
🔵 CONCEPT
Three-Session Cycle — Automatically encapsulates the Asia, London, and New York sessions in dynamic, color-coded zones.
Real-Time Point of Control (POC) — Continuously calculates and plots the most traded price level during the session development, highlighting the current high-interest node as it forms.
Post-Session Volume Profile — Once a session ends, a high-resolution, stepped polyline profile is generated to visualize the final "Value Area."
Breakout Expansion — Projects three mathematical price targets (Deviations) once price escapes a session's range.
Performance Dashboard — A real-time table tracking the total number of bullish/bearish breakouts and successful target hits for every session.
🔵 HOW IT WORKS (IN-DEPTH)
1️⃣ Real-Time POC & Session Development
As each session develops, the indicator tracks every price tick and volume bar from the very first minute.
Live POC Tracking: While the session is active, the indicator plots a Real-Time POC box and extension line that shifts dynamically as new volume flows in. This identifies the "fairest price" exactly when it is being negotiated.
This allows traders to see the session's internal center of gravity before the final profile is even drawn.
2️⃣ Post-Session Volume Flow Profile
Immediately after a session concludes, the indicator finalizes the data and draws a high-resolution Polyline Profile.
Longer horizontal steps in the polyline represent "High Volume Nodes" where institutional accumulation or distribution was most intense.
The final POC is locked in, providing a permanent historical anchor for future support and resistance.
3️⃣ Breakout & Target Logic
Once a session ends, its High and Low act as structural boundaries.
A confirmed close outside these boundaries triggers a Breakout Signal (Triangle) and a dashed "Tether Line" connecting the move back to its source.
Three expansion targets (Dev 1, 2, and 3) are projected. These lines are "hit-aware," meaning they stop extending exactly when price reaches the target, providing a clean visual record of the move's completion.
4️⃣ The Performance Dashboard
The indicator maintains a global tally of all session events.
Break ▲ / ▼: Tracks how many times a session has broken out in either direction.
Hit |, ||, |||: Tracks how many times those breakouts successfully reached the first, second, and third deviation targets.
This allows traders to quickly see which session is currently providing the most reliable follow-through on the current asset.
🔵 KEY FEATURES
Global Session Coverage: Dedicated settings for Asia (Pink), London (Cyan), and New York (Orange).
Real-Time POC Visualization: A live-updating POC box and extension line that identifies high-interest levels as the session unfolds.
Finalized Volume Profile: A sleek, stepped polyline generated at session end for post-session structural analysis.
Statistics Dashboard: A customizable table (position and visibility) showing breakout and target hit counts.
"Hit-Aware" Targets: Target lines (marked |, ||, |||) stop automatically upon price contact to reduce chart clutter.
High-Resolution Polylines: Optimized volume visualization that provides granular detail without sacrificing chart performance.
🔵 HOW TO USE
Monitor the Live POC: During the session, watch where the POC box is located. Price often orbits this level as the "mean," and a strong move away from it often precedes a full session breakout.
Analyze the Final Profile: Once the session ends, use the Polyline Profile to identify the "Value Area." If price returns to the session range later, these high-volume nodes often act as strong support or resistance.
Consult the Dashboard: Use the performance table to identify which session has the highest win rate for breakouts on your specific timeframe.
Target Scaling: Use Deviation 1 (|) for high-probability scalps, Deviation 2 (||) for standard trend targets, and Deviation 3 (|||) for major institutional expansion points.
🔵 CONCLUSION
Session Killzones & Volume Flow Profile is a complete institutional roadmap. By combining the "When" (Sessions) with the "Where" (Live POC & Final Profile) and the "How Much" (Dashboard Stats), it provides a data-driven framework for navigating the most profitable hours of the trading day. Indicator

Multirange Indicator Highlighter: Days, Timezone, ColorMultirange Indicator Highlighter: Days, Timezone, Color
This indicator allows you to highlight up to 3 custom time ranges for every single day of the week (Monday–Sunday). It is perfect for marking Killzones, session opens, or specific volatility windows.
Key Features:
Daily Control: Separate toggles and settings for each day (Mon–Sun).
3 Ranges per Day: Independent start/end times and colors for each slot.
Flexible Format: Supports HH:MM input (e.g., 09:30-11:00).
Smart Timezones: Enter city names (e.g., America/New_York) or offsets (e.g., GMT+2) directly.
Compact UI: Clean, one-line settings for easy configuration.
How to use:
Set your timezone first, then enable the days and ranges you need. Adjust colors and transparency to keep your chart readable. Indicator

ICT Killzones & Pivots [TFO] - Traditional Chinese VersionICT 殺戮區與樞紐點 — 繁體中文版
ICT Killzones & Pivots — Traditional Chinese Edition
📌 概述 | Overview
本指標為廣受交易者使用的「ICT Killzones & Pivots 」之繁體中文本地化版本,完整保留原版所有功能,並將全部介面文字、設定選單、標籤與警報訊息翻譯為繁體中文,大幅降低中文使用者的操作門檻。
This is a Traditional Chinese localization of the well-known "ICT Killzones & Pivots " indicator. All original functionalities are fully preserved, with every interface element — including settings panels, labels, and alert messages — translated into Traditional Chinese to improve accessibility for Mandarin-speaking traders.
🕐 殺戮區(Killzones)| Session Killzones
根據 ICT(Inner Circle Trader)概念,機構資金最活躍的時段稱為「殺戮區」。本指標預設標記以下五個關鍵時段(以紐約時間為基準):
Based on ICT (Inner Circle Trader) concepts, the periods of highest institutional activity are known as "Killzones." The following five key sessions are marked by default (New York time):
時段 Session時間 Time (ET)🔵 亞洲盤 Asia20:00 – 00:00🔴 倫敦盤 London02:00 – 05:00🟢 紐約早盤 NY AM09:30 – 11:00🟡 紐約午休 NY Lunch12:00 – 13:00🟣 紐約下午盤 NY PM13:30 – 16:00
每個時段皆可個別啟用/停用,並自訂名稱與顏色。
Each session can be individually toggled, renamed, and color-customized.
📐 核心功能 | Core Features
殺戮區方塊 | Session Boxes
以半透明色塊標示各殺戮區範圍,清晰呈現每個時段的高低點震盪區間。
Translucent boxes highlight each killzone's high-to-low range, providing a clear visual of intraday price structure.
樞紐點線 | Pivot Lines
自動標記每個殺戮區結束後的最高點與最低點,並在未被突破前持續延伸,協助識別關鍵支撐與壓力位。
Automatically marks the high and low of each completed killzone session. Lines extend until the level is mitigated, helping identify key support and resistance.
中間點 | Midpoint Lines
可選擇顯示每個殺戮區的50%均衡價位,常作為潛在回撤目標。
An optional display of the 50% equilibrium level within each killzone, commonly used as a retracement target.
振幅統計表 | Range Table
即時顯示各殺戮區的當前振幅與歷史平均振幅,協助評估當日市場波動性。
A real-time table displaying the current and historical average range of each killzone, useful for assessing daily market volatility.
日/週/月開盤線與高低點 | D/W/M Open & High/Low Lines
標記日、週、月級別的開盤價、前高與前低,提供多時間框架的重要參考價位。
Marks the open price and prior high/low for daily, weekly, and monthly timeframes as key multi-timeframe reference levels.
開盤價格線 | Custom Opening Price Lines
最多支援8條自訂時間的水平開盤線,可自行設定任意時間點(如真實日開盤00:00、倫敦開盤等)。
Up to 8 custom horizontal open price lines, configurable for any time (e.g., True Day Open at 00:00, London open, etc.).
星期標籤 | Day-of-Week Labels
在圖表底部或頂部自動顯示星期幾標籤,輔助辨識每日結構。
Automatically displays day-of-week labels at the top or bottom of the chart to assist with daily structural analysis.
時間戳記線 | Timestamp Vertical Lines
最多可設定4條自訂垂直時間線,標記任意重要時間節點(如經濟數據公布時間、特定開盤時間等)。
Up to 4 custom vertical timestamp lines to mark important time events such as economic releases or specific session opens.
突破警報 | Break Alerts
當價格突破殺戮區樞紐高低點,或日/週/月高低點時,自動觸發 PulseWire 警報通知。
Automatically triggers PulseWire alerts when price breaks through killzone pivot levels or D/W/M high/low levels.
⚙️ 主要設定 | Key Settings
繪圖保留天數:控制圖表上各類繪圖的最大顯示筆數
時間框架上限:超過指定時間框架後自動隱藏所有繪圖
時區:支援全球主要時區,預設為紐約時間
繪圖截止時間:可設定樞紐線與開盤線的自動停止延伸時間
樞紐延伸模式:「直到被突破」或「突破後繼續」兩種模式可選
Session Drawing Limit: Controls the maximum number of drawings retained on the chart
Timeframe Limit: Automatically hides all drawings above the specified timeframe
Timezone: Supports all major global timezones, defaulting to New York (ET)
Drawing Cutoff Time: Optionally stops pivot and open lines from extending at a set time
Pivot Extension Mode: Choose between "Until Mitigated" or "Past Mitigation"
🌐 本地化說明 | Localization Notes
本版本為原作者 @tradeforopp 所著「ICT Killzones & Pivots 」之繁體中文翻譯版,依據 Mozilla Public License 2.0 授權發佈。所有交易邏輯、核心演算法與功能設計之著作權均歸屬於原作者。本版本僅對使用者介面文字進行在地化處理,未更動任何核心程式邏輯。
This is a Traditional Chinese translation of "ICT Killzones & Pivots " originally authored by @tradeforopp, published under the Mozilla Public License 2.0. All trading logic, core algorithms, and functional design remain the intellectual property of the original author. This version only localizes the user interface text without modifying any core logic.
⚠️ 免責聲明 | Disclaimer
本指標僅供技術分析參考用途,不構成任何投資建議。交易涉及風險,請依據個人風險承受能力審慎決策。
This indicator is provided for technical analysis reference purposes only and does not constitute investment advice. Trading involves risk; please make decisions according to your own risk tolerance.
原始腳本 Original Script:ICT Killzones & Pivots by @tradeforopp
授權 License:Mozilla Public License 2.0 Indicator

Indicator

Killzones & Key LevelsThe ICT Killzones + Key Levels indicator is a comprehensive technical analysis tool that consolidates institutional trading logic and ICT (Inner Circle Trader) concepts into a single interface. Its primary distinction lies in optimizing all calculations based on actual market opening times—specifically the New York 18:00 session rollover—rather than the standard midnight (00:00) reset.
It visually represents critical Killzone regions, such as Asia, London, New York AM/PM, and New York Lunch, using dynamic boxes on the chart. These zones highlight periods of peak volatility and liquidity, clarifying areas where price is most likely to react. Additionally, it calculates session-based Daily, Weekly, and Monthly (DWM) open levels to align with institutional data, making intraday bias much easier to determine.
The indicator provides a True Day Open (TDO => NYMO) level as a vital reference point throughout the day while automatically tracking Previous Day, Week, and Month Highs and Lows (H/L). By drawing vertical day-divider lines at 18:00, it allows traders to see the "true" trading day. This enables Futures and Forex traders to analyze market cycles based on institutional liquidity flow rather than just calendar hours.
Finally, it includes a volatility analysis table that displays the current price range for each session. With a fully customizable structure, you can adjust sessions, colors, and timeframes to fit your specific strategy. In essence, this tool serves as a professional roadmap for Smart Money Concepts (SMC) traders who prioritize session structure over traditional timekeeping. Indicator
