Remove Hodler [5ema]
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// Reused some functions from (I believe made by ©paaax, @QuantNomad)
// ©paaax: The table position function (https://www.tradingview.com/script/Jp37jHwT-PX-MTF-Overview/).
// @QuantNomad: The function calculated value and array screener for 40+ instruments (https://www.tradingview.com/script/zN8rwPFF-Screener-for-40-instruments/).
// © vn-5ema

//@version=5
indicator('Remove Hodler [5ema]', overlay = true)
// Timeframe
itimeframe = input.timeframe(defval = "D", title = "Time frame", tooltip = "By defaul, flowing the current chart. Can select another to only flowing.")
// Look back day 
ilookback = input.int(defval = 30, title = "Number of bars", minval = 1, tooltip = "By befaul, choose 30 days.")
// Input changingpercent 
iRange = input.float(defval = 50, title = "Change percentage (%)", minval = 10, tooltip = "The maximum Price changed.")
// Input number of shooting bar 
iShooting = input.int(defval = 9, title = "Number of Shooting bars", minval = 1, tooltip = "Should follow minimum 9 shootting bars.")
ipercent = input.int(defval = 25, title = "Percent of Shooting", minval = 1, tooltip = "By defaut, price of (close + open) = 0.25*(high + low).")

// Set up table
pTable = input.string("Bottom Left", title="Show tables at", options=["Top Left", "Top Center", "Top Right", "Middle Left", "Middle Center", "Middle Right", "Bottom Left", "Bottom Center", "Bottom Right"], group="Set up table")
// Set up table
/////// This function reused from ©paaax /////
getPosition(pTable) =>
    ret = position.top_left
    if pTable == "Top Center"
        ret := position.top_center
    if pTable == "Top Right"
        ret := position.top_right
    if pTable == "Middle Left"
        ret := position.middle_left
    if pTable == "Middle Center"
        ret := position.middle_center
    if pTable == "Middle Right"
        ret := position.middle_right
    if pTable == "Bottom Left"
        ret := position.bottom_left
    if pTable == "Bottom Center"
        ret := position.bottom_center
    if pTable == "Bottom Right"
        ret := position.bottom_right
    ret
/////////
// Set up color of table
table_boder = input(color.new(color.white, 100), group = "Set up table", title = "Boder Color ")
table_frame = input(#151715, group = "Set up table", title ="Frame Color ")
table_bg = input(color.black, group = "Set up table", title ="Back Color ")
table_text = input(color.white, group = "Set up table", title ="Text Color ")
boolTbale = input.bool(defval = true,  title = "Show tables", group = "Set up table")
boolalltable = input.bool(defval = false,  title = "Show all symbols on table", group = "Set up table")
boolshooting = input.bool(defval = true, title = "Show shooting bars", group = "Set up table")
boolrange = input.bool(defval = true, title = "Show checking ranges", group = "Set up table")

// Bool Symbols
/////// This bool symbool refer from @QuantNomad /////
u01 = input.bool(true,  title = "", group = 'Symbols following (maximum 40)', inline = 's01')
u02 = input.bool(true,  title = "", group = 'Symbols following (maximum 40)', inline = 's02')
u03 = input.bool(true,  title = "", group = 'Symbols following (maximum 40)', inline = 's03')
u04 = input.bool(true,  title = "", group = 'Symbols following (maximum 40)', inline = 's04')
u05 = input.bool(true,  title = "", group = 'Symbols following (maximum 40)', inline = 's05')
u06 = input.bool(true,  title = "", group = 'Symbols following (maximum 40)', inline = 's06')
u07 = input.bool(true,  title = "", group = 'Symbols following (maximum 40)', inline = 's07')
u08 = input.bool(true,  title = "", group = 'Symbols following (maximum 40)', inline = 's08')
u09 = input.bool(true,  title = "", group = 'Symbols following (maximum 40)', inline = 's09')
u10 = input.bool(true,  title = "", group = 'Symbols following (maximum 40)', inline = 's10')
u11 = input.bool(true,  title = "", group = 'Symbols following (maximum 40)', inline = 's11')
u12 = input.bool(true,  title = "", group = 'Symbols following (maximum 40)', inline = 's12')
u13 = input.bool(true,  title = "", group = 'Symbols following (maximum 40)', inline = 's13')
u14 = input.bool(true,  title = "", group = 'Symbols following (maximum 40)', inline = 's14')
u15 = input.bool(true,  title = "", group = 'Symbols following (maximum 40)', inline = 's15')
u16 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's16')
u17 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's17')
u18 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's18')
u19 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's19')
u20 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's20')
u21 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's21')
u22 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's22')
u23 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's23')
u24 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's24')
u25 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's25')
u26 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's26')
u27 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's27')
u28 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's28')
u29 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's29')
u30 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's30')
u31 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's31')
u32 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's32')
u33 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's33')
u34 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's34')
u35 = input.bool(false,  title = "", group = 'Symbols following (maximum 40)', inline = 's35')
u36 = input.bool(false, title = "", group = 'Symbols following (maximum 40)', inline = 's36')
u37 = input.bool(false, title = "", group = 'Symbols following (maximum 40)', inline = 's37')
u38 = input.bool(false, title = "", group = 'Symbols following (maximum 40)', inline = 's38')
u39 = input.bool(false, title = "", group = 'Symbols following (maximum 40)', inline = 's39')
//u40 = input.bool(false, title = "", group = 'Symbols following (maximum 40)', inline = 's40')
// Input Symbols
s01 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's01')
s02 = input.symbol('ETHUSDT',  group = 'Symbols following (maximum 40)', inline = 's02')
s03 = input.symbol('BNBUSDT', group = 'Symbols following (maximum 40)', inline = 's03')
s04 = input.symbol('SOLUSDT',  group = 'Symbols following (maximum 40)', inline = 's04')
s05 = input.symbol('ADAUSDT',  group = 'Symbols following (maximum 40)', inline = 's05')
s06 = input.symbol('NEARUSDT',  group = 'Symbols following (maximum 40)', inline = 's06')
s07 = input.symbol('DOTUSDT',   group = 'Symbols following (maximum 40)', inline = 's07')
s08 = input.symbol('LINKUSDT',  group = 'Symbols following (maximum 40)', inline = 's08')
s09 = input.symbol('TRXUSDT',  group = 'Symbols following (maximum 40)', inline = 's09')
s10 = input.symbol('AVAXUSDT',  group = 'Symbols following (maximum 40)', inline = 's10')
s11 = input.symbol('FTMUSDT',  group = 'Symbols following (maximum 40)', inline = 's11')
s12 = input.symbol('CELOUSDT',  group = 'Symbols following (maximum 40)', inline = 's12')
s13 = input.symbol('ATOMUSDT',  group = 'Symbols following (maximum 40)', inline = 's13')
s14 = input.symbol('MATICUSDT',   group = 'Symbols following (maximum 40)', inline = 's14')
s15 = input.symbol('LTCUSDT',   group = 'Symbols following (maximum 40)', inline = 's15')
s16 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's16')
s17 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's17')
s18 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's18')
s19 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's19')
s20 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's20')
s21 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's21')
s22 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's22')
s23 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's23')
s24 = input.symbol('BTCUSDT',   group = 'Symbols following (maximum 40)', inline = 's24')
s25 = input.symbol('BTCUSDT', group = 'Symbols following (maximum 40)', inline = 's25')
s26 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's26')
s27 = input.symbol('BTCUSDT', group = 'Symbols following (maximum 40)', inline = 's27')
s28 = input.symbol('BTCUSDT',   group = 'Symbols following (maximum 40)', inline = 's28')
s29 = input.symbol('BTCUSDT', group = 'Symbols following (maximum 40)', inline = 's29')
s30 = input.symbol('BTCUSDT',   group = 'Symbols following (maximum 40)', inline = 's30')
s31 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's31')
s32 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's32')
s33 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's33')
s34 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's34')
s35 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's35')
s36 = input.symbol('BTCUSDT', group = 'Symbols following (maximum 40)', inline = 's36')
s37 = input.symbol('BTCUSDT',   group = 'Symbols following (maximum 40)', inline = 's37')
s38 = input.symbol('BTCUSDT',   group = 'Symbols following (maximum 40)', inline = 's38')
s39 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's39')
//s40 = input.symbol('BTCUSDT',  group = 'Symbols following (maximum 40)', inline = 's40')
/////////
// Get only symbol
only_symbol(s) =>
    array.get(str.split(s, ":"), 1)

// Calculate min max Price
rangePrice_func()=> 
    hPrice = ta.highest(high, ilookback)
    lPrice = ta.lowest(low, ilookback)
    rangePrice = ((hPrice - lPrice) / lPrice) * 100

// Calculate shooting bar
nshooting_func()=> 
    // Count shooting bar
    shooting = low  + ipercent/100 * math.abs(high - low) > math.max(open, close)
    nshooting = math.sum(shooting ? 1 : 0, ilookback)
// Screener
screener_func() =>
    rangePrice = rangePrice_func()
    nshooting = nshooting_func()
    // Alert Condition
    signalBUY = rangePrice < iRange and nshooting >= iShooting
    [rangePrice, nshooting, signalBUY]
// Display checking range
range_check() =>
    top_range = ta.highest(high, ilookback)
    bottom_range = ta.lowest(low, ilookback)
    [top_range,bottom_range]
[top_range,bottom_range] = request.security(syminfo.tickerid, itimeframe, range_check())
timeframe_request = timeframe.in_seconds(itimeframe)
timeframe_current = timeframe.in_seconds(timeframe.period)
comvert_timeframe = timeframe_request / timeframe_current
rangecheck = boolrange ? box.new(left = bar_index[ilookback * comvert_timeframe] , top = top_range, right = bar_index, bottom = bottom_range, border_color = color.new(#d1d4dc, 75), bgcolor = color.new(#d1d4dc, 95)) : na
box.delete(rangecheck[1])
// Security call
/////// This bool symbool refer from @QuantNomad /////
[rangePrice01, nshooting01, signalBUY01] = request.security(s01, itimeframe, screener_func())
[rangePrice02, nshooting02, signalBUY02] = request.security(s02, itimeframe, screener_func())
[rangePrice03, nshooting03, signalBUY03] = request.security(s03, itimeframe, screener_func())
[rangePrice04, nshooting04, signalBUY04] = request.security(s04, itimeframe, screener_func())
[rangePrice05, nshooting05, signalBUY05] = request.security(s05, itimeframe, screener_func())
[rangePrice06, nshooting06, signalBUY06] = request.security(s06, itimeframe, screener_func())
[rangePrice07, nshooting07, signalBUY07] = request.security(s07, itimeframe, screener_func())
[rangePrice08, nshooting08, signalBUY08] = request.security(s08, itimeframe, screener_func())
[rangePrice09, nshooting09, signalBUY09] = request.security(s09, itimeframe, screener_func())
[rangePrice10, nshooting10, signalBUY10] = request.security(s10, itimeframe, screener_func())
[rangePrice11, nshooting11, signalBUY11] = request.security(s11, itimeframe, screener_func())
[rangePrice12, nshooting12, signalBUY12] = request.security(s12, itimeframe, screener_func())
[rangePrice13, nshooting13, signalBUY13] = request.security(s13, itimeframe, screener_func())
[rangePrice14, nshooting14, signalBUY14] = request.security(s14, itimeframe, screener_func())
[rangePrice15, nshooting15, signalBUY15] = request.security(s15, itimeframe, screener_func())
[rangePrice16, nshooting16, signalBUY16] = request.security(s16, itimeframe, screener_func())
[rangePrice17, nshooting17, signalBUY17] = request.security(s17, itimeframe, screener_func())
[rangePrice18, nshooting18, signalBUY18] = request.security(s18, itimeframe, screener_func())
[rangePrice19, nshooting19, signalBUY19] = request.security(s19, itimeframe, screener_func())
[rangePrice20, nshooting20, signalBUY20] = request.security(s20, itimeframe, screener_func())
[rangePrice21, nshooting21, signalBUY21] = request.security(s21, itimeframe, screener_func())
[rangePrice22, nshooting22, signalBUY22] = request.security(s22, itimeframe, screener_func())
[rangePrice23, nshooting23, signalBUY23] = request.security(s23, itimeframe, screener_func())
[rangePrice24, nshooting24, signalBUY24] = request.security(s24, itimeframe, screener_func())
[rangePrice25, nshooting25, signalBUY25] = request.security(s25, itimeframe, screener_func())
[rangePrice26, nshooting26, signalBUY26] = request.security(s26, itimeframe, screener_func())
[rangePrice27, nshooting27, signalBUY27] = request.security(s27, itimeframe, screener_func())
[rangePrice28, nshooting28, signalBUY28] = request.security(s28, itimeframe, screener_func())
[rangePrice29, nshooting29, signalBUY29] = request.security(s29, itimeframe, screener_func())
[rangePrice30, nshooting30, signalBUY30] = request.security(s30, itimeframe, screener_func())
[rangePrice31, nshooting31, signalBUY31] = request.security(s31, itimeframe, screener_func())
[rangePrice32, nshooting32, signalBUY32] = request.security(s32, itimeframe, screener_func())
[rangePrice33, nshooting33, signalBUY33] = request.security(s33, itimeframe, screener_func())
[rangePrice34, nshooting34, signalBUY34] = request.security(s34, itimeframe, screener_func())
[rangePrice35, nshooting35, signalBUY35] = request.security(s35, itimeframe, screener_func())
[rangePrice36, nshooting36, signalBUY36] = request.security(s36, itimeframe, screener_func())
[rangePrice37, nshooting37, signalBUY37] = request.security(s37, itimeframe, screener_func())
[rangePrice38, nshooting38, signalBUY38] = request.security(s38, itimeframe, screener_func())
[rangePrice39, nshooting39, signalBUY39] = request.security(s39, itimeframe, screener_func())
//[rangePrice40, nshooting40, signalBUY40] = request.security(s40, itimeframe, screener_func())

// For table
// Arrays //
s_arr   = array.new_string(0)
u_arr   = array.new_bool(0)
rangePrice_arr  = array.new_float(0)
nshooting_arr   = array.new_float(0)
// Add Symbols 
array.push(s_arr, only_symbol(s01))
array.push(s_arr, only_symbol(s02))
array.push(s_arr, only_symbol(s03))
array.push(s_arr, only_symbol(s04))
array.push(s_arr, only_symbol(s05))
array.push(s_arr, only_symbol(s06))
array.push(s_arr, only_symbol(s07))
array.push(s_arr, only_symbol(s08))
array.push(s_arr, only_symbol(s09))
array.push(s_arr, only_symbol(s10))
array.push(s_arr, only_symbol(s11))
array.push(s_arr, only_symbol(s12))
array.push(s_arr, only_symbol(s13))
array.push(s_arr, only_symbol(s14))
array.push(s_arr, only_symbol(s15))
array.push(s_arr, only_symbol(s16))
array.push(s_arr, only_symbol(s17))
array.push(s_arr, only_symbol(s18))
array.push(s_arr, only_symbol(s19))
array.push(s_arr, only_symbol(s20))
array.push(s_arr, only_symbol(s21))
array.push(s_arr, only_symbol(s22))
array.push(s_arr, only_symbol(s23))
array.push(s_arr, only_symbol(s24))
array.push(s_arr, only_symbol(s25))
array.push(s_arr, only_symbol(s26))
array.push(s_arr, only_symbol(s27))
array.push(s_arr, only_symbol(s28))
array.push(s_arr, only_symbol(s29))
array.push(s_arr, only_symbol(s30))
array.push(s_arr, only_symbol(s31))
array.push(s_arr, only_symbol(s32))
array.push(s_arr, only_symbol(s33))
array.push(s_arr, only_symbol(s34))
array.push(s_arr, only_symbol(s35))
array.push(s_arr, only_symbol(s36))
array.push(s_arr, only_symbol(s37))
array.push(s_arr, only_symbol(s38))
array.push(s_arr, only_symbol(s39))
//array.push(s_arr, only_symbol(s40))

// Flags //
array.push(u_arr, u01)
array.push(u_arr, u02)
array.push(u_arr, u03)
array.push(u_arr, u04)
array.push(u_arr, u05)
array.push(u_arr, u06)
array.push(u_arr, u07)
array.push(u_arr, u08)
array.push(u_arr, u09)
array.push(u_arr, u10)
array.push(u_arr, u11)
array.push(u_arr, u12)
array.push(u_arr, u13)
array.push(u_arr, u14)
array.push(u_arr, u15)
array.push(u_arr, u16)
array.push(u_arr, u17)
array.push(u_arr, u18)
array.push(u_arr, u19)
array.push(u_arr, u20)
array.push(u_arr, u21)
array.push(u_arr, u22)
array.push(u_arr, u23)
array.push(u_arr, u24)
array.push(u_arr, u25)
array.push(u_arr, u26)
array.push(u_arr, u27)
array.push(u_arr, u28)
array.push(u_arr, u29)
array.push(u_arr, u30)
array.push(u_arr, u31)
array.push(u_arr, u32)
array.push(u_arr, u33)
array.push(u_arr, u34)
array.push(u_arr, u35)
array.push(u_arr, u36)
array.push(u_arr, u37)
array.push(u_arr, u38)
array.push(u_arr, u39)
//array.push(u_arr, u40)

array.push(rangePrice_arr, rangePrice01)
array.push(rangePrice_arr, rangePrice02)
array.push(rangePrice_arr, rangePrice03)
array.push(rangePrice_arr, rangePrice04)
array.push(rangePrice_arr, rangePrice05)
array.push(rangePrice_arr, rangePrice06)
array.push(rangePrice_arr, rangePrice07)
array.push(rangePrice_arr, rangePrice08)
array.push(rangePrice_arr, rangePrice09)
array.push(rangePrice_arr, rangePrice10)
array.push(rangePrice_arr, rangePrice11)
array.push(rangePrice_arr, rangePrice12)
array.push(rangePrice_arr, rangePrice13)
array.push(rangePrice_arr, rangePrice14)
array.push(rangePrice_arr, rangePrice15)
array.push(rangePrice_arr, rangePrice16)
array.push(rangePrice_arr, rangePrice17)
array.push(rangePrice_arr, rangePrice18)
array.push(rangePrice_arr, rangePrice19)
array.push(rangePrice_arr, rangePrice20)
array.push(rangePrice_arr, rangePrice21)
array.push(rangePrice_arr, rangePrice22)
array.push(rangePrice_arr, rangePrice23)
array.push(rangePrice_arr, rangePrice24)
array.push(rangePrice_arr, rangePrice25)
array.push(rangePrice_arr, rangePrice26)
array.push(rangePrice_arr, rangePrice27)
array.push(rangePrice_arr, rangePrice28)
array.push(rangePrice_arr, rangePrice29)
array.push(rangePrice_arr, rangePrice30)
array.push(rangePrice_arr, rangePrice31)
array.push(rangePrice_arr, rangePrice32)
array.push(rangePrice_arr, rangePrice33)
array.push(rangePrice_arr, rangePrice34)
array.push(rangePrice_arr, rangePrice35)
array.push(rangePrice_arr, rangePrice36)
array.push(rangePrice_arr, rangePrice37)
array.push(rangePrice_arr, rangePrice38)
array.push(rangePrice_arr, rangePrice39)
//array.push(rangePrice_arr, rangePrice40)

array.push(nshooting_arr, nshooting01)
array.push(nshooting_arr, nshooting02)
array.push(nshooting_arr, nshooting03)
array.push(nshooting_arr, nshooting04)
array.push(nshooting_arr, nshooting05)
array.push(nshooting_arr, nshooting06)
array.push(nshooting_arr, nshooting07)
array.push(nshooting_arr, nshooting08)
array.push(nshooting_arr, nshooting09)
array.push(nshooting_arr, nshooting10)
array.push(nshooting_arr, nshooting11)
array.push(nshooting_arr, nshooting12)
array.push(nshooting_arr, nshooting13)
array.push(nshooting_arr, nshooting14)
array.push(nshooting_arr, nshooting15)
array.push(nshooting_arr, nshooting16)
array.push(nshooting_arr, nshooting17)
array.push(nshooting_arr, nshooting18)
array.push(nshooting_arr, nshooting19)
array.push(nshooting_arr, nshooting20)
array.push(nshooting_arr, nshooting21)
array.push(nshooting_arr, nshooting22)
array.push(nshooting_arr, nshooting23)
array.push(nshooting_arr, nshooting24)
array.push(nshooting_arr, nshooting25)
array.push(nshooting_arr, nshooting26)
array.push(nshooting_arr, nshooting27)
array.push(nshooting_arr, nshooting28)
array.push(nshooting_arr, nshooting29)
array.push(nshooting_arr, nshooting30)
array.push(nshooting_arr, nshooting31)
array.push(nshooting_arr, nshooting32)
array.push(nshooting_arr, nshooting33)
array.push(nshooting_arr, nshooting34)
array.push(nshooting_arr, nshooting35)
array.push(nshooting_arr, nshooting36)
array.push(nshooting_arr, nshooting37)
array.push(nshooting_arr, nshooting38)
array.push(nshooting_arr, nshooting39)
//array.push(nshooting_arr, nshooting40)
//////////

// Plot Shooting
if barstate.islast
    for i = 0 to ilookback
        if  low[i] + ipercent/100 * math.abs(high[i] - low[i]) > math.max(open[i], close[i])
            lbl = boolshooting == false ? na : label.new(bar_index[i], high[i] + 2, "Shooting", yloc = yloc.abovebar, color = color.black, textcolor = color.white)

// Calculate for current symbol
rangePrice_current = ((ta.highest(high, ilookback) - ta.lowest(low, ilookback)) / ta.lowest(low, ilookback)) * 100
nshooting_current = math.sum(low  + ipercent/100 * math.abs(high - low) > math.max(open, close) ? 1 : 0, ilookback)
rangePrice_col_current  = rangePrice_current < iRange     ? #04D204 : color.white
nshooting_col_current  = nshooting_current >= iShooting ? #04D204 : color.white         
signal_text_current = rangePrice_current < iRange and nshooting_current >= iShooting ? "⦿" : ""
signal_color_current = rangePrice_current < iRange and nshooting_current >= iShooting ? #04D204 : color.white   
// Plot table//
/////// This bool symbool refer from @QuantNomad /////
var tbl = table.new(getPosition(pTable), 5, 41, frame_color=table_frame, frame_width=1, border_width=2, border_color= table_boder)
if barstate.islast and boolTbale
    table.cell(tbl, 0, 0, "TFr",     text_halign = text.align_center, bgcolor = table_bg, text_color = table_text, text_size = size.small)
    table.cell(tbl, 1, 0, 'Symbol',     text_halign = text.align_center, bgcolor = table_bg, text_color = table_text, text_size = size.small)
    table.cell(tbl, 2, 0, 'Range',      text_halign = text.align_center, bgcolor = table_bg, text_color = table_text, text_size = size.small)
    table.cell(tbl, 3, 0, 'Shooting',        text_halign = text.align_center, bgcolor = table_bg, text_color = table_text, text_size = size.small)
    table.cell(tbl, 4, 0, 'Signal',        text_halign = text.align_center, bgcolor = #fd7600, text_color = table_text, text_size = size.small)
    table.cell(tbl, 0, 1, itimeframe,                                 text_halign = text.align_center,   bgcolor = table_bg, text_color = table_text, text_size = size.small)
    table.cell(tbl, 1, 1, syminfo.ticker,                                 text_halign = text.align_center,   bgcolor = table_bg, text_color = table_text, text_size = size.small)
    table.cell(tbl, 2, 1, str.tostring(rangePrice_current, "#.##")+"%",                  text_halign = text.align_center, bgcolor = table_bg, text_color = rangePrice_col_current, text_size = size.small)
    table.cell(tbl, 3, 1, str.tostring(nshooting_current),         text_halign = text.align_center, bgcolor = table_bg,    text_color =nshooting_col_current, text_size = size.small)
    table.cell(tbl, 4, 1, signal_text_current,                                          text_halign = text.align_center, bgcolor = table_bg, text_size = size.small, text_color = signal_color_current)
    if boolalltable
        for i = 0 to 38
            if array.get(u_arr, i)
                rangePrice_col   = array.get(rangePrice_arr, i) < iRange     ? #04D204 : color.white
                nshooting_col  = array.get(nshooting_arr, i) >= iShooting ? #04D204 : color.white         
                signal_text = array.get(rangePrice_arr, i) < iRange and array.get(nshooting_arr, i) >= iShooting ? "⦿" : ""  
                signal_color =   array.get(rangePrice_arr, i) < iRange and array.get(nshooting_arr, i) >= iShooting ? #04D204 : color.white
                table.cell(tbl, 0, i + 2, itimeframe,                                 text_halign = text.align_center,   bgcolor = table_bg, text_color = table_text, text_size = size.small)
                table.cell(tbl, 1, i + 2, array.get(s_arr, i),                                 text_halign = text.align_center,   bgcolor = table_bg, text_color = table_text, text_size = size.small)
                table.cell(tbl, 2, i + 2, str.tostring(array.get(rangePrice_arr, i), "#.##")+"%",                  text_halign = text.align_center, bgcolor = table_bg, text_color =rangePrice_col, text_size = size.small)
                table.cell(tbl, 3, i + 2, str.tostring(array.get(nshooting_arr, i)),         text_halign = text.align_center, bgcolor = table_bg,    text_color = nshooting_col, text_size = size.small)
                table.cell(tbl, 4, i + 2, signal_text,                                          text_halign = text.align_center, bgcolor = table_bg, text_size = size.small, text_color = signal_color)
//////////
// For Alert
crh_alert = ''
//Signal BUY
crh_alert := u01 != false and signalBUY01 ? crh_alert + s01 + ' - BUY' + '\n' : crh_alert 
crh_alert := u02 != false and signalBUY02 ? crh_alert + s02 + ' - BUY' + '\n' : crh_alert 
crh_alert := u03 != false and signalBUY03 ? crh_alert + s03 + ' - BUY' + '\n' : crh_alert 
crh_alert := u04 != false and signalBUY04 ? crh_alert + s04 + ' - BUY' + '\n' : crh_alert 
crh_alert := u05 != false and signalBUY05 ? crh_alert + s05 + ' - BUY' + '\n' : crh_alert 
crh_alert := u06 != false and signalBUY06 ? crh_alert + s06 + ' - BUY' + '\n' : crh_alert 
crh_alert := u07 != false and signalBUY07 ? crh_alert + s07 + ' - BUY' + '\n' : crh_alert 
crh_alert := u08 != false and signalBUY08 ? crh_alert + s08 + ' - BUY' + '\n' : crh_alert 
crh_alert := u09 != false and signalBUY09 ? crh_alert + s09 + ' - BUY' + '\n' : crh_alert 
crh_alert := u10 != false and signalBUY10 ? crh_alert + s10 + ' - BUY' + '\n' : crh_alert 
crh_alert := u11 != false and signalBUY11 ? crh_alert + s11 + ' - BUY' + '\n' : crh_alert 
crh_alert := u12 != false and signalBUY12 ? crh_alert + s12 + ' - BUY' + '\n' : crh_alert 
crh_alert := u13 != false and signalBUY13 ? crh_alert + s13 + ' - BUY' + '\n' : crh_alert 
crh_alert := u14 != false and signalBUY14 ? crh_alert + s14 + ' - BUY' + '\n' : crh_alert 
crh_alert := u15 != false and signalBUY15 ? crh_alert + s15 + ' - BUY' + '\n' : crh_alert 
crh_alert := u16 != false and signalBUY16 ? crh_alert + s16 + ' - BUY' + '\n' : crh_alert 
crh_alert := u17 != false and signalBUY17 ? crh_alert + s17 + ' - BUY' + '\n' : crh_alert 
crh_alert := u18 != false and signalBUY18 ? crh_alert + s18 + ' - BUY' + '\n' : crh_alert 
crh_alert := u19 != false and signalBUY19 ? crh_alert + s19 + ' - BUY' + '\n' : crh_alert 
crh_alert := u20 != false and signalBUY20 ? crh_alert + s20 + ' - BUY' + '\n' : crh_alert 
crh_alert := u21 != false and signalBUY21 ? crh_alert + s21 + ' - BUY' + '\n' : crh_alert 
crh_alert := u22 != false and signalBUY22 ? crh_alert + s22 + ' - BUY' + '\n' : crh_alert 
crh_alert := u23 != false and signalBUY23 ? crh_alert + s23 + ' - BUY' + '\n' : crh_alert 
crh_alert := u24 != false and signalBUY24 ? crh_alert + s24 + ' - BUY' + '\n' : crh_alert 
crh_alert := u25 != false and signalBUY25 ? crh_alert + s25 + ' - BUY' + '\n' : crh_alert 
crh_alert := u26 != false and signalBUY26 ? crh_alert + s26 + ' - BUY' + '\n' : crh_alert 
crh_alert := u27 != false and signalBUY27 ? crh_alert + s27 + ' - BUY' + '\n' : crh_alert 
crh_alert := u28 != false and signalBUY28 ? crh_alert + s28 + ' - BUY' + '\n' : crh_alert 
crh_alert := u29 != false and signalBUY29 ? crh_alert + s29 + ' - BUY' + '\n' : crh_alert 
crh_alert := u30 != false and signalBUY30 ? crh_alert + s30 + ' - BUY' + '\n' : crh_alert 
crh_alert := u31 != false and signalBUY31 ? crh_alert + s31 + ' - BUY' + '\n' : crh_alert 
crh_alert := u32 != false and signalBUY32 ? crh_alert + s32 + ' - BUY' + '\n' : crh_alert 
crh_alert := u33 != false and signalBUY33 ? crh_alert + s33 + ' - BUY' + '\n' : crh_alert 
crh_alert := u34 != false and signalBUY34 ? crh_alert + s34 + ' - BUY' + '\n' : crh_alert 
crh_alert := u35 != false and signalBUY35 ? crh_alert + s35 + ' - BUY' + '\n' : crh_alert 
crh_alert := u36 != false and signalBUY36 ? crh_alert + s36 + ' - BUY' + '\n' : crh_alert 
crh_alert := u37 != false and signalBUY37 ? crh_alert + s37 + ' - BUY' + '\n' : crh_alert 
crh_alert := u38 != false and signalBUY38 ? crh_alert + s38 + ' - BUY' + '\n' : crh_alert 
crh_alert := u39 != false and signalBUY39 ? crh_alert + s39 + ' - BUY' + '\n' : crh_alert 
//crh_alert := u40 != false and signalBUY40 ? crh_alert + s40 + ' - BUY' + '\n' : crh_alert 
// Send alert only if screener is not empty
if (crh_alert != '')
    alert(crh_alert + '\n(Remove Holder [5ema.vn])', freq = alert.freq_once_per_bar_close)

