// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.
0/
// © J_asper, credit to Patek Fynnip for the strategy
//@version=5
indicator("ICT Daily Bias", overlay = true, shorttitle = "[Daily Bias]")
dashboardInput = input.bool(true, "Dashboard", group = "⋯⋯⋯───────────── Settings
─────────────⋯⋯⋯")
simpleDashboard = input.bool(false, "Simplified Dashboard", group = "⋯⋯⋯───────────── Settings
─────────────⋯⋯⋯")
colorDashboard = input.bool(false, "Match Dashboard Color to Box Color", group =
"⋯⋯⋯───────────── Settings ─────────────⋯⋯⋯")
bullishColor = input.color(#37894990, "Bullish Color", group="⋯⋯⋯───────────── Box Colors
─────────────⋯⋯⋯")
bearishColor = input.color(#80192290, "Bearish Color", group="⋯⋯⋯───────────── Box Colors
─────────────⋯⋯⋯")
borderBullishColor = input.color(color.black, "Bullish Border Color", group = "⋯⋯⋯──────────── Border
Colors ────────────⋯⋯⋯")
borderBearishColor = input.color(color.black, "Bearish Border Color", group = "⋯⋯⋯────────────
Border Colors ────────────⋯⋯⋯")
bullishText = input.string("Bullish", title="Bullish Text", group = "⋯⋯⋯────────────── Box Text
──────────────⋯⋯⋯")
bearishText = input.string("Bearish", title="Bearish Text", group = "⋯⋯⋯────────────── Box Text
──────────────⋯⋯⋯")
matchBoxColorBullish = input.bool(true, "Match Box Color? |", group = "⋯⋯⋯───────────── Text
Colors ─────────────⋯⋯⋯", inline = "1")
matchBoxColorBearish = input.bool(true, "Match Box Color? |", group = "⋯⋯⋯───────────── Text
Colors ─────────────⋯⋯⋯", inline = "2")
bullishTextColor = input.color(#37894990, "Bullish ", group = "⋯⋯⋯───────────── Text Colors
─────────────⋯⋯⋯", inline = "1")
bearishTextColor = input.color(#80192290, "Bearish ", group = "⋯⋯⋯───────────── Text Colors
─────────────⋯⋯⋯", inline = "2")
high5 = request.security(syminfo.tickerid, "5", high)
low5 = request.security(syminfo.tickerid, "5", low)
close5 = request.security(syminfo.tickerid, "5", close)
timeinrange(res, sess) => not na(time(res, sess, "America/New_York")) ? 1 : 0
isTargetTime1 = timeinrange("5", "1400-1449")
isTargetTime2 = timeinrange("5", "2000-2049")
var float highestHigh = na
var float lowestLow = na
var float firstClose = na
var int startBar = na
var box b = na
var box textBox = na
var label textLabel = na
var int centerBarIndex = na
offset = ta.atr(20)/5
var bool isFirstBearOrBull = na
var bool isSecondBearOrBull = na
var color boxColor = na
var string firstBias = na
var string secondBias = na
if (isTargetTime1 or isTargetTime2)
if (na(b))
b := box.new(na, na, na, na)
textBox := box.new(na, na, na, na)
highestHigh := high5
lowestLow := low5
firstClose := close5
startBar := bar_index
highestHigh := math.max(highestHigh, high5)
lowestLow := math.min(lowestLow, low5)
box.set_left(b, startBar)
box.set_right(b, bar_index)
box.set_top(b, highestHigh)
box.set_bottom(b, lowestLow)
boxColor := close5 > firstClose ? bullishColor : bearishColor
borderColor = close5 > firstClose ? borderBullishColor : borderBearishColor
box.set_bgcolor(b, boxColor)
box.set_border_color(b, borderColor)
boxText = close5 > firstClose ? bullishText : bearishText
box.set_text(textBox, boxText)
centerBarIndex := box.get_left(b) + math.round((box.get_right(b) - box.get_left(b)) / 2)
if (na(textLabel))
textLabel := label.new(x = centerBarIndex, y = box.get_top(b), text = boxText)
label.set_x(textLabel, centerBarIndex)
label.set_y(textLabel, box.get_top(b)+offset)
label.set_text(textLabel, boxText)
label.set_style(textLabel, label.style_none)
textColor = close5 > firstClose ? (matchBoxColorBullish ? color.new(bullishColor, transp=0) :
bullishTextColor) : (matchBoxColorBearish ? color.new(bearishColor, transp=0) : bearishTextColor)
label.set_textcolor(textLabel, textColor)
label.set_size(textLabel, size.small)
box.set_bgcolor(b, boxColor)
box.set_border_color(b, borderColor)
else
b := na
textBox := na
highestHigh := na
lowestLow := na
firstClose := na
startBar := na
textLabel := na
if (isTargetTime1)
firstBias := close5 > firstClose ? "Bullish" : "Bearish"
if (isTargetTime2)
secondBias := close5 > firstClose ? "Bullish" : "Bearish"
var color londonTableColor = na
var color newyorkTableColor = na
if (firstBias == "Bullish")
if (colorDashboard)
londonTableColor := bullishColor
else
londonTableColor := color.rgb(44, 109, 58)
if (firstBias == "Bearish")
if (colorDashboard)
londonTableColor := bearishColor
else
londonTableColor := color.rgb(117, 38, 45)
if (secondBias == "Bullish")
if (colorDashboard)
newyorkTableColor := bullishColor
else
newyorkTableColor := color.rgb(44, 109, 58)
if (secondBias == "Bearish")
if (colorDashboard)
newyorkTableColor := bearishColor
else
newyorkTableColor := color.rgb(117, 38, 45)
if (dashboardInput and simpleDashboard == false)
var dBoard = table.new(position = position.top_right, columns = 2, rows = 2, bgcolor = color.rgb(24, 24,
24),
border_width = 3, border_color = color.rgb(41, 41, 41), frame_color = color.rgb(41, 41, 41), frame_width
= 5)
table.cell(table_id = dBoard, column = 0, row = 0, text = "London Bias", text_color = color.white,
text_valign = text.align_center, text_halign = text.align_center, tooltip = "Expected Bias For London
Session", text_size = size.normal)
table.cell(table_id = dBoard, column = 1, row = 0, text = "New-York Bias", text_color = color.white,
text_valign = text.align_center, text_halign = text.align_center, tooltip = "Expected Bias For New-York
Session", text_size = size.normal)
table.cell(table_id = dBoard, column = 0, row = 1, text = firstBias, text_color = color.white,
text_valign = text.align_center, text_halign = text.align_center, bgcolor = londonTableColor, text_size =
size.small)
table.cell(table_id = dBoard, column = 1, row = 1, text = secondBias, text_color = color.white,
text_valign = text.align_center, text_halign = text.align_center, bgcolor = newyorkTableColor, text_size =
size.small)
if (dashboardInput and simpleDashboard)
var dBoard = table.new(position = position.top_right, columns = 2, rows = 2, bgcolor = color.rgb(24, 24,
24),
border_width = 3, border_color = color.rgb(41, 41, 41), frame_color = color.rgb(41, 41, 41), frame_width
= 5)
table.cell(table_id = dBoard, column = 0, row = 1, text = "London: " + firstBias, text_color = color.white,
text_valign = text.align_center, text_halign = text.align_center, bgcolor = londonTableColor, text_size =
size.small)
table.cell(table_id = dBoard, column = 1, row = 1, text = "New-York: " + secondBias, text_color =
color.white,
text_valign = text.align_center, text_halign = text.align_center, bgcolor = newyorkTableColor, text_size =
size.small)