ICT Liquidity Void Screener.txt
Copy
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Arun_K_Bhaskar
//@version=5
indicator(title="ICT Liquidity Void Screener", shorttitle="ICT LV Scr", overlay=true)
//_____________________________ Menu Screener Start
g_tb = '█████████████████ Screener █████████████████'
tt_is = "• Input exactly 40 symbols, nothing more or less." +
"\n• Total characters cannot exceed 4096." +
"\n• Use comma as delimiter without any space." +
"\n• Eg: EXCHANGE:SYMBOL_A,EXCHANGE:SYMBOL_B"
string i_symbols = input.text_area(
defval="NSE:AEGISCHEM,NSE:BANKINDIA,NSE:BHEL,NSE:BLS,NSE:CASTROLIND,NSE:CESC,NSE:CGPOWER,NSE:CHAMBLFERT,NSE:DELTACORP,NSE:DEVYANI,NSE:EQUITASBNK,NSE:GAEL,NSE:GPPL,NSE:GSFC,NSE:HUDCO,NSE:IBULHSGFIN,NSE:INDIACEM,NSE:INDUSTOWER,NSE:IRCON,NSE:JKPAPER,NSE:JMFINANCIL,NSE:JYOTHYLAB,NSE:KARURVYSYA,NSE:NAM_INDIA,NSE:NATIONALUM,NSE:NCC,NSE:NETWORK18,NSE:NYKAA,NSE:PNB,NSE:RAIN,NSE:RALLIS,NSE:RBA,NSE:RBLBANK,NSE:RCF,NSE:REDINGTON,NSE:TRITURBINE,NSE:UNIONBANK,NSE:VAIBHAVGBL,NSE:WELSPUNLIV,NSE:ZEEL",
title="Paste Symbols", tooltip=tt_is, group=g_tb)
string i_scr_direction = input.string(defval='Both', title='Direction', options=['Both', 'Bullish', 'Bearish'], inline='tb_1', group=g_tb)
bool i_scr_show_bull = input.bool(defval=true, title='Only Bullish', inline='tb_2', group=g_tb)
bool i_scr_show_bear = input.bool(defval=true, title='Only Bearish', inline='tb_2', group=g_tb)
int i_scr_disp_rows = input.int(defval=16, title='Display Rows', minval=0, maxval=100, group=g_tb)
string i_scr_position = input.string(defval=position.bottom_left, title='Table Position', options=[position.top_left, position.top_center, position.top_right, position.middle_left, position.middle_center, position.middle_right, position.bottom_left, position.bottom_center, position.bottom_right], group=g_tb)
string i_scr_text_size = input.string(defval=size.small, title='Table Size', options=[size.auto, size.tiny, size.small, size.normal, size.large, size.huge], group=g_tb)
color i_scr_neg_col = input.color(defval=#F7525F, title='-', inline='c', group=g_tb)
color i_scr_pos_col = input.color(defval=#22AB94, title='+', inline='c', group=g_tb)
color i_scr_neu_col = input.color(defval=#B2B5BE, title='0', inline='c', group=g_tb)
//_____________________________ Menu Screener End
//_____________________________ Menu Liquidity Void Start
g_lv = '███████████████ Liquidity Void ███████████████'
int i_lv_show_last = input.int(defval=2, title='Show Last', minval=0, group=g_lv)
string i_lv_line = input.string(defval='High/Low', title='Source', options=['High/Low', 'OTE 0.79%', '50%'], group=g_lv)
bool i_lv_bear_show = input.bool(defval=true, title='Bearish', group=g_lv)
bool i_lv_bull_show = input.bool(defval=true, title='Bullish', group=g_lv)
bool i_lv_hide_crossed = input.bool(defval=false, title='Hide Crossed', group=g_lv)
g_lv_f = "Void Height Filter"
tt_lv_f = "• Filters remove narrow liquidity voids." +
"\n• ATR filtering adjusts automatically when the timeframe changes." +
"\n• Percentage filter will be constant across all timeframes." +
"\n• If you don't want any filtering, choose 'Percentage' and then change Percentage to 0."
string i_lv_additional = input.string(defval='ATR', title='Filter Using', options=['ATR', 'Percentage'], tooltip=tt_lv_f, group=g_lv_f)
tt_lv_atr = "Applicable only if 'Filter Using' is 'ATR'"
int i_lv_atr_length = input.int(defval=14, minval=1, title='ATR Period', tooltip=tt_lv_atr, group=g_lv_f)
tt_lv_atr_m = "Higher the number, filters higher void height."
float i_lv_atr_multi = input.float(defval=4, minval=1, title='ATR Multiplier', tooltip=tt_lv_atr_m, group=g_lv_f)
tt_lv_p = "Filters liquidity void above the given percentage."
float i_lv_percentage = input.float(defval=2.5, minval=0, step=0.1, title='Percentage Above', tooltip=tt_lv_p, group=g_lv_f)
g_lv_ds = "Display Settings"
color i_lv_bear_color = input.color(defval=#F7525F, title='Bearish Color', group=g_lv_ds)
color i_lv_bull_color = input.color(defval=#22AB94, title='Bullish Color', group=g_lv_ds)
string i_lv_ln_style = input.string(defval=line.style_solid, title="Line Style", options=[line.style_solid, line.style_dashed, line.style_dotted], group=g_lv_ds)
int i_lv_ln_width = input.int(defval=2, title='Width', group=g_lv_ds)
int i_lv_box_trans = input.int(defval=75, title='Box Transparency', group=g_lv_ds)
//_____________________________ Menu Liquidity Void End
//_____________________________ Functions Start
// Function to calculate filter based on ATR or percentage
filter(prev_value, other_value, _atr_htf, _atr_multi, _percentage, _additional) =>
filter_atr = math.abs(prev_value - other_value) > _atr_htf * _atr_multi
filter_percent = math.abs((prev_value - other_value) / prev_value * 100) > _percentage
_additional == 'ATR' ? filter_atr : filter_percent
// Function to determine line type
price_source(float prev_value, float other_value, string price_source) =>
price_source == 'High/Low' ? prev_value :
price_source == 'OTE 0.79%' ? other_value + ((prev_value - other_value) * 0.79) :
price_source == 'OTE 0.79%' ? other_value - ((prev_value - other_value) * 0.79) :
math.avg(prev_value, other_value)
draw_line(int x1_time, float y1_price, color _color)=>
line.new(x1=x1_time, y1=y1_price, x2=time, y2=y1_price, xloc=xloc.bar_time, color=_color, style=i_lv_ln_style, width=i_lv_ln_width)
draw_box(int left_time, float top_price, float bottom_price, color _color)=>
box.new(left=left_time, top=top_price, right=time, bottom=bottom_price, xloc=xloc.bar_time, border_color=color.new(_color, i_lv_box_trans), bgcolor=color.new(_color, i_lv_box_trans))
// Function to handle array operations and cleanup
clean_arrays(_all_lines, _keep_lines, _all_boxes, _keep_boxes, _lv_line, _lv_box) =>
array.push(_all_lines, _lv_line)
array.push(_all_boxes, _lv_box)
if array.size(_all_lines) > i_lv_show_last
removed_line = array.shift(_all_lines)
if array.includes(_keep_lines, removed_line)
index_of_removed_line = array.indexof(_keep_lines, removed_line)
array.remove(_keep_lines, index_of_removed_line)
line.delete(removed_line)
if array.size(_all_boxes) > i_lv_show_last
removed_box = array.shift(_all_boxes)
if array.includes(_keep_boxes, removed_box)
index_of_removed_box = array.indexof(_keep_boxes, removed_box)
array.remove(_keep_boxes, index_of_removed_box)
box.delete(removed_box)
break_object(float price) =>
high >= price and low <= price
update_lines(lines, keep_lines, int _time) =>
for current_line in lines
if not array.includes(keep_lines, current_line)
line.set_x2(current_line, _time)
line_price = line.get_y1(current_line)
if break_object(line_price)
array.push(keep_lines, current_line)
update_boxes(boxes, keep_boxes, int _time) =>
for current_box in boxes
if not array.includes(keep_boxes, current_box)
box.set_right(current_box, _time)
box_price = box.get_top(current_box)
if break_object(box_price)
array.push(keep_boxes, current_box)
clean_lines(keep_lines, all_lines) =>
for keep_line in keep_lines
line_price = line.get_y1(keep_line)
if i_lv_hide_crossed and break_object(line_price)
line.delete(keep_line)
index = array.indexof(all_lines, keep_line)
if not na(index)
array.remove(all_lines, index)
clean_boxes(keep_boxes, all_boxes) =>
for keep_box in keep_boxes
box_price = box.get_bottom(keep_box)
if i_lv_hide_crossed and break_object(box_price)
box.delete(keep_box)
index = array.indexof(all_boxes, keep_box)
if not na(index)
array.remove(all_boxes, index)
//_____________________________ Functions End
//_____________________________ Liquidity Void Bearish Start
var float bear_prev_low = na, var int bear_prev_low_time = na
var float bear_price_source_val = na, var float bear_high_val = na
var bear_keep_lines = array.new_line(), var bear_all_lines = array.new_line()
var bear_keep_boxes = array.new_box(), var bear_all_boxes = array.new_box()
if i_lv_bear_show and barstate.isconfirmed and (close > open)
bear_filter = filter(bear_prev_low, high, ta.atr(i_lv_atr_length), i_lv_atr_multi, i_lv_percentage, i_lv_additional)
bear_price_source = price_source(bear_prev_low, high, i_lv_line)
if (na(bear_prev_low) or high <= bear_prev_low) and bear_filter
lv_bear_line = draw_line(bear_prev_low_time, bear_price_source, i_lv_bear_color)
lv_bear_box = draw_box(bear_prev_low_time, high, bear_prev_low, i_lv_bear_color)
clean_arrays(bear_all_lines, bear_keep_lines, bear_all_boxes, bear_keep_boxes, lv_bear_line, lv_bear_box)
bear_high_val := high
bear_price_source_val := bear_price_source
bear_prev_low := low
bear_prev_low_time := time
// Update
update_lines(bear_all_lines, bear_keep_lines, time)
update_boxes(bear_all_boxes, bear_keep_boxes, time)
// Clean
clean_lines(bear_keep_lines, bear_all_lines)
clean_boxes(bear_keep_boxes, bear_all_boxes)
//_____________________________ Liquidity Void Bearish End
//_____________________________ Liquidity Void Bullish Start
var float bull_prev_high = na, var int bull_prev_high_time = na
var float bull_price_source_val = na, var float bull_low_val = na
var bull_keep_lines = array.new_line(), var bull_all_lines = array.new_line()
var bull_keep_boxes = array.new_box(), var bull_all_boxes = array.new_box()
if i_lv_bull_show and barstate.isconfirmed and (close < open)
bull_filter = filter(bull_prev_high, low, ta.atr(i_lv_atr_length), i_lv_atr_multi, i_lv_percentage, i_lv_additional)
bull_price_source = price_source(bull_prev_high, low, i_lv_line)
if (na(bull_prev_high) or low >= bull_prev_high) and bull_filter
lv_bull_line = draw_line(bull_prev_high_time, bull_price_source, i_lv_bull_color)
lv_bull_box = draw_box(bull_prev_high_time, low, bull_prev_high, i_lv_bull_color)
clean_arrays(bull_all_lines, bull_keep_lines, bull_all_boxes, bull_keep_boxes, lv_bull_line, lv_bull_box)
bull_low_val := high
bull_price_source_val := bull_price_source
bull_prev_high := high
bull_prev_high_time := time
// Update
update_lines(bull_all_lines, bull_keep_lines, time)
update_boxes(bull_all_boxes, bull_keep_boxes, time)
// Clean
clean_lines(bull_keep_lines, bull_all_lines)
clean_boxes(bull_keep_boxes, bull_all_boxes)
//_____________________________ Liquidity Void Bullish End
//____________________________ Get Symbols for Screener Start
// Acknowledgement & Reference
// Trader: 'allanster'
// Indicator Title: 'How To Input CSV List Of Symbol Data Used For Screener'
// Indicator Link: 'https://www.tradingview.com/script/KfqHqHUH-How-To-Input-CSV-List-Of-Symbol-Data-Used-For-Screener/'
feed(back) => // extract tickerid and decrement list of ticker IDs
loop = back // declare string variable to hold content list
getT = string(na) // declare string variable to hold tickerid
if str.length(loop) == 0 // if list is empty
getT := string(na) // assign na to tickerid variable
loop := string(na) // assign na to list of ticker Ids variable
else // else extract first tickerid
getP = nz(str.pos(loop, ','), str.length(loop)) // get position of first comma or last character
getT := str.substring(loop, 0, getP) // get tickerid in first position of list
loop := str.replace(loop, getT + ',', '') // clear tickerid + delimiter character from list
[getT, loop] // return tickerid in first position & truncated list
[tid_01, out_01] = feed(i_symbols), [tid_02, out_02] = feed(out_01), [tid_03, out_03] = feed(out_02), [tid_04, out_04] = feed(out_03),
[tid_05, out_05] = feed(out_04), [tid_06, out_06] = feed(out_05), [tid_07, out_07] = feed(out_06), [tid_08, out_08] = feed(out_07),
[tid_09, out_09] = feed(out_08), [tid_10, out_10] = feed(out_09), [tid_11, out_11] = feed(out_10), [tid_12, out_12] = feed(out_11),
[tid_13, out_13] = feed(out_12), [tid_14, out_14] = feed(out_13), [tid_15, out_15] = feed(out_14), [tid_16, out_16] = feed(out_15),
[tid_17, out_17] = feed(out_16), [tid_18, out_18] = feed(out_17), [tid_19, out_19] = feed(out_18), [tid_20, out_20] = feed(out_19),
[tid_21, out_21] = feed(out_20), [tid_22, out_22] = feed(out_21), [tid_23, out_23] = feed(out_22), [tid_24, out_24] = feed(out_23),
[tid_25, out_25] = feed(out_24), [tid_26, out_26] = feed(out_25), [tid_27, out_27] = feed(out_26), [tid_28, out_28] = feed(out_27),
[tid_29, out_29] = feed(out_28), [tid_30, out_30] = feed(out_29), [tid_31, out_31] = feed(out_30), [tid_32, out_32] = feed(out_31),
[tid_33, out_33] = feed(out_32), [tid_34, out_34] = feed(out_33), [tid_35, out_35] = feed(out_34), [tid_36, out_36] = feed(out_35),
[tid_37, out_37] = feed(out_36), [tid_38, out_38] = feed(out_37), [tid_39, out_39] = feed(out_38), [tid_40, out_40] = feed(out_39)
//____________________________ Get Symbols for Screener End
// _____________________________ Screener Start
// Acknowledgement & Reference
// Trader: 'MUQWISHI'
// Indicator Title: 'Candlestick Patterns Screener [By MUQWISHI]'
// Indicator Link: 'https://www.tradingview.com/script/xiWQuGOq-Candlestick-Patterns-Screener-By-MUQWISHI/'
// Screener Conditions
bearish_cond = ta.crossunder(low, bull_price_source_val) and barstate.isconfirmed
bullish_cond = ta.crossover(high, bear_price_source_val) and barstate.isconfirmed
// Define Bull and Bear Conditions
bull = not(i_scr_direction == "Bearish")
bear = not(i_scr_direction == "Bullish")
// Function for Screener Indicator Calculation
indicator_calculation() =>
// Initialize variables
price = float(na)
_time = int(na)
indicator = ""
signal = int(na)
if barstate.isconfirmed
// Check for Bearish Momentum Candle and conditions (Modify here to customize indicators)
if i_scr_show_bull and bearish_cond and bear
indicator := "L"
signal := -1
// Check for Bullish Momentum Candle and conditions (Modify here to customize indicators)
else if i_scr_show_bear and bullish_cond and bull
indicator := "H"
signal := 1
// Update price and time if signal is not null
if not na(signal)
price := math.round_to_mintick(close)
_time := time
[_time, indicator, price, signal]
// Function to format time
format_time(x) =>
timezone = syminfo.timezone
timeframe.isintraday ? str.format_time(x, "HH:mm dd-MM-yyyy", timezone) : str.format_time(x, "dd-MM-yyyy", timezone)
// Function to extract symbol name
symbol(s) =>
array.get(str.split(s, ":"), 1)
// Matrix setup
var matrix = matrix.new<string>(0, 5, na)
// Function to add rows to the matrix
mtxFun(symbol, _time, indicator, price, signal) =>
matrix.add_row(matrix, 0, array.from(symbol, _time, indicator, price, signal))
// Screener function to collect data
screener(s) =>
sym = ticker.modify(s, syminfo.session)
[_time, indicator, price, signal] = request.security(sym, timeframe.period, indicator_calculation())
// Check if the signal is not na and the time matches
if not na(signal) and _time == time
symbolName = symbol(s)
formattedTime = format_time(_time)
strPrice = str.tostring(price)
strSignal = str.tostring(signal)
// Add data to the matrix
mtxFun(symbolName, formattedTime, indicator, strPrice, strSignal)
// Call Screener function for multiple symbols
screener(tid_01), screener(tid_02), screener(tid_03), screener(tid_04), screener(tid_05), screener(tid_06), screener(tid_07),
screener(tid_08), screener(tid_09), screener(tid_10), screener(tid_11), screener(tid_12), screener(tid_13), screener(tid_14),
screener(tid_15), screener(tid_16), screener(tid_17), screener(tid_18), screener(tid_19), screener(tid_20), screener(tid_21),
screener(tid_22), screener(tid_23), screener(tid_24), screener(tid_25), screener(tid_26), screener(tid_27), screener(tid_28),
screener(tid_29), screener(tid_30), screener(tid_31), screener(tid_32), screener(tid_33), screener(tid_34), screener(tid_35),
screener(tid_36), screener(tid_37), screener(tid_38), screener(tid_39), screener(tid_40)
// Trim excess rows in the matrix
if matrix.rows(matrix) > i_scr_disp_rows
while matrix.rows(matrix) > i_scr_disp_rows
matrix.remove_row(matrix, matrix.rows(matrix)-1)
// Plot Table
// Create table with specified properties
var table tbl = table.new(position=i_scr_position, columns=4, rows=102, border_width=1)
// Function to populate cells in the table
cell(col, row, txt, color) =>
table.cell(tbl, col, row, text = txt, text_color = color, text_halign=text.align_left, bgcolor = color.new(color, 90), text_size=i_scr_text_size)
// Check if it's the last bar
if barstate.islast
// Clear existing data in the table
table.clear(tbl, 0, 0, 3, 101)
// Set headers for the table
cell(0, 0, "Symbol", i_scr_neu_col)
cell(1, 0, "Time", i_scr_neu_col)
cell(2, 0, "Dir" , i_scr_neu_col)
cell(3, 0, "Price", i_scr_neu_col)
j = 1
// Populate table with matrix data
if matrix.rows(matrix) > 0
for i = 0 to matrix.rows(matrix) - 1
// Determine color based on the signal
col = matrix.get(matrix, i, 4) == "1" ? i_scr_neg_col :
matrix.get(matrix, i, 4) == "-1" ? i_scr_pos_col : i_scr_neu_col
// Populate cells in the table
cell(0, j, matrix.get(matrix, i, 0), col)
cell(1, j, matrix.get(matrix, i, 1), col)
cell(2, j, matrix.get(matrix, i, 2), col)
cell(3, j, matrix.get(matrix, i, 3), col)
j += 1
// _____________________________ Screener End
// _____________________________ Code End
Show all 363 lines