[Scanner] ICT Mitigation Block Scanner
[Scanner] ICT Mitigation Block Scanner
0
at https://mozilla.org/MPL/2.0/
// © Arun_K_Bhaskar
//@version=5
indicator(title='ICT Mitigation Block Scanner', shorttitle='ICT MB Scan',
overlay=true, max_bars_back=500, max_lines_count=500, max_boxes_count=500)
defval="NSE:ASHOKA,NSE:BEPL,NSE:BIOCON,NSE:BLS,NSE:CAMPUS,NSE:CASTROLIND,NSE:CESC,N
SE:EDELWEISS,NSE:EMBDL,NSE:ENGINERSIN,NSE:EPL,NSE:FSL,NSE:GAEL,NSE:GREAVESCOT,NSE:G
SPL,NSE:HFCL,NSE:HONASA,NSE:HUDCO,NSE:INDUSTOWER,NSE:INOXWIND,NSE:IOLCP,NSE:JAMNAAU
TO,NSE:JMFINANCIL,NSE:JTLIND,NSE:KALAMANDIR,NSE:LTFOODS,NSE:LXCHEM,NSE:MARKSANS,NSE
:NFL,NSE:NLCINDIA,NSE:ORIENTCEM,NSE:PPLPHARMA,NSE:RAIN,NSE:RELIGARE,NSE:SAMMAANCAP,
NSE:SEQUENT,NSE:TI,NSE:TRIVENI,NSE:TVSSCS,NSE:ZOMATO",
title="Paste Symbols", tooltip=tt_is, group=g_scrtb)
if ta.change(time('D')) != 0
prev_cum_vol := current_cum_vol
current_cum_vol := volume
else
current_cum_vol += volume
// % Change Filter
bool pchg_above_filter = true
bool pchg_below_filter = true
if i_pchg_filter
pchg_above_filter := cum_pchg > i_pchg_above_below
pchg_below_filter := cum_pchg < -i_pchg_above_below
// Volume Filter
bool vol_filter = true
if i_vol_filter
vol_filter := current_cum_vol >= i_vol_above
// ATR Filter
bool atr_filter = true
if i_atr_filter
atr_filter := (high - low) > ta.atr(i_atr_length) * i_atr_multi
// Date Filter
bool date_filter = true
if i_date_filter
date_filter := (year == i_year and month == i_month and dayofmonth == i_day)
float _high =
i_zz_source == 'Open/Close' ? math.max(open, close) :
i_zz_source == 'Close' ? close :
high
float _low =
i_zz_source == 'Open/Close' ? math.max(open, close) :
i_zz_source == 'Close' ? close :
low
//============================== 1. Variables
//============================== 4. Calculations
dirchanged = ta.change(dir)
if ph or pl
if dirchanged
add_to_zigzag(zigzag, dir == 1 ? ph : pl, bar_index)
else
update_zigzag(zigzag, dir == 1 ? ph : pl, bar_index, dir)
//============================== 5. Constructs
if array.size(zigzag) >= 9
if array.get(zigzag, 0) != array.get(oldzigzag, 0) or array.get(zigzag, 1) !=
array.get(oldzigzag, 1)
if array.get(zigzag, 2) == array.get(oldzigzag, 2) and array.get(zigzag, 3)
== array.get(oldzigzag, 3)
line.delete(line_zz)
if i_zz_display
line_zz := line.new(x1 = math.round(array.get(zigzag, 1)), y1 =
array.get(zigzag, 0), x2 = math.round(array.get(zigzag, 3)), y2 = array.get(zigzag,
2), color = dir == 1 ? i_zz_bull_color : i_zz_bear_color, width=1)
// Create a single label for the last five zigzag values and their corresponding
bar index
//label_text = str.tostring(zz_0) + "\n" + str.tostring(bi_0) + "\n" +
str.tostring(zz_1) + "\n" + str.tostring(bi_1) + "\n" + str.tostring(zz_2) +
// "\n" + str.tostring(bi_2) + "\n" + str.tostring(zz_3) + "\n" +
str.tostring(bi_3) + "\n" + str.tostring(zz_4) + "\n" + str.tostring(bi_4)
//if barstate.islast
// label.new(x = bar_index, y = high, text = label_text, color=color.white)
// Short Condition 1
short_ret_cont_1 =
zz_1 > zz_2 and
zz_1 < zz_3 and
pchg_above_filter and
pchg_below_filter and
vol_filter and
vol_pchg_filter and
atr_filter and
body_filter and
body_size_filter and
volume_filter and
rel_vol_filter and
time_filter and
date_filter and
barstate.isconfirmed
// Short Condition 2
bool short_ret_cont_2 =
ta.crossover(high, short_break_price) and
high[1] < short_break_price and
pchg_above_filter and
pchg_below_filter and
vol_filter and
vol_pchg_filter and
atr_filter and
body_filter and
body_size_filter and
volume_filter and
rel_vol_filter and
time_filter and
date_filter and
barstate.isconfirmed
// Long Condition 1
long_ret_cont_1 =
zz_1 < zz_2 and
zz_1 > zz_3 and
pchg_above_filter and
pchg_below_filter and
vol_filter and
vol_pchg_filter and
atr_filter and
body_filter and
body_size_filter and
volume_filter and
rel_vol_filter and
time_filter and
date_filter and
barstate.isconfirmed
// Long Condition 2
bool long_ret_cont_2 =
ta.crossunder(low, long_break_price) and
low[1] > long_break_price and
pchg_above_filter and
pchg_below_filter and
vol_filter and
vol_pchg_filter and
atr_filter and
body_filter and
body_size_filter and
volume_filter and
rel_vol_filter and
time_filter and
date_filter and
barstate.isconfirmed
//_____________________________ Plot
// To String
day_pchg_str = str.tostring(cum_pchg,"#.##") + ' %'
volume_pchg_str = str.tostring(cum_vol_pchg,"#.##") + ' %'
day_volume_str = str.tostring(current_cum_vol/100000,"#.##") + ' L'
prev_day_volume_str = str.tostring(prev_cum_vol/100000,"#.##") + ' L'
// Color
bgcolor_1 = i_neu_dark_color
bgcolor_2 = i_neu_mid_color
// Plot Table
var table tbl_data = table.new(position=i_tbl_data_pos, columns=2, rows=4,
border_width=1, force_overlay=true)
long_cond =
i_scr_choose == 'Mitigation Block' ? long_ret_cont_1 :
long_ret_trigger
if barstate.isconfirmed
// Check for Short Momentum Candle and conditions (Modify here to customize
indicators)
if i_scr_show_long and long_cond
signal := 1
// Check for Long Momentum Candle and conditions (Modify here to customize
indicators)
else if i_scr_show_short and short_cond
signal := -1
// Matrix setup
var matrix = matrix.new<string>(0, 6, na)
// Plot Table
// Create table with specified properties
var table scr_tbl = table.new(position=i_scr_tbl_position, columns=5, rows=102,
border_width=1, force_overlay=true)
scr_cell_title(0, 0, i_scr_choose)
table.merge_cells(table_id=scr_tbl, start_column=0, start_row=0, end_column=4,
end_row=0)
scr_cell_title(0, 1, "Symbol")
scr_cell_title(1, 1, "Time")
scr_cell_title(2, 1, "Price")
scr_cell_title(3, 1, "%Chg")
scr_cell_title(4, 1, "V %Chg")
j = 4
// Populate table with matrix data
if matrix.rows(matrix) > 0
for i = 0 to matrix.rows(matrix) - 1
// Determine color based on the signal
_textcolor =
matrix.get(matrix, i, 5) == "1" ? i_pos_color :
matrix.get(matrix, i, 5) == "-1" ? i_neg_color : i_neu_color
_bg_color =
matrix.get(matrix, i, 5) == "1" ? i_pos_dark_color :
matrix.get(matrix, i, 5) == "-1" ? i_neg_dark_color : i_neu_color
j += 1