The Strat Screener - yungchopps
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © trawda13

//@version=5
indicator("The Strat Screener - yungchopps", overlay = true)

////////////////////
/// Ticker Input ///
////////////////////
color_blind = input(false, "color vision deficiency")

s01 = input.symbol("AAPL", "Symbol")
s02 = input.symbol("MSFT", "Symbol")
s03 = input.symbol("AMZN", "Symbol")
s04 = input.symbol("GOOG", "Symbol")
s05 = input.symbol("FB", "Symbol")
s06 = input.symbol("A", "Symbol")
s07 = input.symbol("TSLA", "Symbol")
s08 = input.symbol("V", "Symbol")
s09 = input.symbol("JPM", "Symbol")
s10 = input.symbol("NVDA", "Symbol")
s11 = input.symbol("JNJ", "Symbol")
s12 = input.symbol("WMT", "Symbol")
s13 = input.symbol("UNH", "Symbol")
s14 = input.symbol("MA", "Symbol")
s15 = input.symbol("PYPL", "Symbol")
s16 = input.symbol("PG", "Symbol")
s17 = input.symbol("HD", "Symbol")
s18 = input.symbol("BAC", "Symbol")
s19 = input.symbol("ADBE", "Symbol")
s20 = input.symbol("CMCSA", "Symbol")
s21 = input.symbol("NKE", "Symbol")
s22 = input.symbol("ORCL", "Symbol")
s23 = input.symbol("KO", "Symbol")
s24 = input.symbol("XOM", "Symbol")
s25 = input.symbol("NFLX", "Symbol")
s26 = input.symbol("VZ", "Symbol")
s27 = input.symbol("CSCO", "Symbol")
s28 = input.symbol("PFE", "Symbol")
s29 = input.symbol("LLY", "Symbol")
s30 = input.symbol("INTC", "Symbol")
s31 = input.symbol("CRM", "Symbol")
s32 = input.symbol("PEP", "Symbol")
s33 = input.symbol("ABT", "Symbol")
s34 = input.symbol("ACN", "Symbol")
s35 = input.symbol("ABBV", "Symbol")
s36 = input.symbol("TMO", "Symbol")
s37 = input.symbol("DHR", "Symbol")
s38 = input.symbol("T", "Symbol")
s39 = input.symbol("MRK", "Symbol")
s40 = input.symbol("DIS", "Symbol")

///////////////////////////////
//////////// Color ////////////
///////////////////////////////
bgColor_heading = color.gray
textColor = color.black
bgColor_body = #ccedc2

if color_blind
    bgColor_heading := color.orange
    bgColor_body := color.orange
    textColor := color.blue


////////////////////////////////////////////////////
//////////// Identifies the candles ////////////////
////////////////////////////////////////////////////

// Checks for 1
getOneBar(rightBar,leftBar) =>
    high[rightBar] <= high[leftBar] and low[rightBar] >= low[leftBar]

// Checks for 2d
getTwoDownBar(rightBar, leftBar) =>
    low[rightBar] < low[leftBar] and not (high[rightBar] > high[leftBar])

// Checks for 2p
getTwoUpBar(rightBar, leftBar) =>
    high[rightBar] > high[leftBar] and not (low[rightBar] < low[leftBar])

// Checks for 3
getThreeBar(rightBar, leftBar) =>
    high[rightBar] > high[leftBar] and low[rightBar] < low[leftBar]
    
    
// Checks for all Strat setups
Strat_Screener_Func() =>
    bull_rj = getTwoUpBar(2,3) and getTwoUpBar(1,2) and getTwoDownBar(0,1)      // Bullish RJ
    bear_rj = getTwoDownBar(2,3) and getTwoDownBar(1,2) and getTwoUpBar(0,1)    // Bearish RJ
    nirvana = getOneBar(1,2) and getThreeBar(0,1)                               // Nirvana
    holy_Gr = getThreeBar(1,2) and getOneBar(0,1)                               // Holy Grail
    two_one = (getTwoUpBar(1,2) or getTwoDownBar(1,2)) and getOneBar(0,1)       // 2-1 continuation or reversal
    
    halfway = high[1] - ((high[1] - low[1])/2)
    fiftyHigh = (high[0] > high[1] and not (low[0] < low[1])) and (close < halfway)
    fiftyLow = (low[0] < low[1] and not (high[0] > high[1])) and (close > halfway)
    fifty = fiftyHigh or fiftyLow
    [bull_rj, bear_rj, nirvana, holy_Gr, fifty, two_one]                                        // Returns the setups

// Retrieves the namse of the ticker
getName(_str) =>
    string[] _pair = str.split(_str, ":")
    string[] _chars = str.split(array.get(_pair, 1), "")  // Index 1
    string _return = array.join(_chars, "")
    
///////////////
/// Tickers ///
///////////////

[bullrj01, bearrj01, nirvana01, holyGrail01, fifty01, twoOne01] = request.security(s01, timeframe.period, Strat_Screener_Func())
[bullrj02, bearrj02, nirvana02, holyGrail02, fifty02, twoOne02] = request.security(s02, timeframe.period, Strat_Screener_Func())
[bullrj03, bearrj03, nirvana03, holyGrail03, fifty03, twoOne03] = request.security(s03, timeframe.period, Strat_Screener_Func())
[bullrj04, bearrj04, nirvana04, holyGrail04, fifty04, twoOne04] = request.security(s04, timeframe.period, Strat_Screener_Func())
[bullrj05, bearrj05, nirvana05, holyGrail05, fifty05, twoOne05] = request.security(s05, timeframe.period, Strat_Screener_Func())
[bullrj06, bearrj06, nirvana06, holyGrail06, fifty06, twoOne06] = request.security(s06, timeframe.period, Strat_Screener_Func())
[bullrj07, bearrj07, nirvana07, holyGrail07, fifty07, twoOne07] = request.security(s07, timeframe.period, Strat_Screener_Func())
[bullrj08, bearrj08, nirvana08, holyGrail08, fifty08, twoOne08] = request.security(s08, timeframe.period, Strat_Screener_Func())
[bullrj09, bearrj09, nirvana09, holyGrail09, fifty09, twoOne09] = request.security(s09, timeframe.period, Strat_Screener_Func())
[bullrj10, bearrj10, nirvana10, holyGrail10, fifty10, twoOne10] = request.security(s10, timeframe.period, Strat_Screener_Func())
[bullrj11, bearrj11, nirvana11, holyGrail11, fifty11, twoOne11] = request.security(s11, timeframe.period, Strat_Screener_Func())
[bullrj12, bearrj12, nirvana12, holyGrail12, fifty12, twoOne12] = request.security(s12, timeframe.period, Strat_Screener_Func())
[bullrj13, bearrj13, nirvana13, holyGrail13, fifty13, twoOne13] = request.security(s13, timeframe.period, Strat_Screener_Func())
[bullrj14, bearrj14, nirvana14, holyGrail14, fifty14, twoOne14] = request.security(s14, timeframe.period, Strat_Screener_Func())
[bullrj15, bearrj15, nirvana15, holyGrail15, fifty15, twoOne15] = request.security(s15, timeframe.period, Strat_Screener_Func())
[bullrj16, bearrj16, nirvana16, holyGrail16, fifty16, twoOne16] = request.security(s16, timeframe.period, Strat_Screener_Func())
[bullrj17, bearrj17, nirvana17, holyGrail17, fifty17, twoOne17] = request.security(s17, timeframe.period, Strat_Screener_Func())
[bullrj18, bearrj18, nirvana18, holyGrail18, fifty18, twoOne18] = request.security(s18, timeframe.period, Strat_Screener_Func())
[bullrj19, bearrj19, nirvana19, holyGrail19, fifty19, twoOne19] = request.security(s19, timeframe.period, Strat_Screener_Func())
[bullrj20, bearrj20, nirvana20, holyGrail20, fifty20, twoOne20] = request.security(s20, timeframe.period, Strat_Screener_Func())
[bullrj21, bearrj21, nirvana21, holyGrail21, fifty21, twoOne21] = request.security(s21, timeframe.period, Strat_Screener_Func())
[bullrj22, bearrj22, nirvana22, holyGrail22, fifty22, twoOne22] = request.security(s22, timeframe.period, Strat_Screener_Func())
[bullrj23, bearrj23, nirvana23, holyGrail23, fifty23, twoOne23] = request.security(s23, timeframe.period, Strat_Screener_Func())
[bullrj24, bearrj24, nirvana24, holyGrail24, fifty24, twoOne24] = request.security(s24, timeframe.period, Strat_Screener_Func())
[bullrj25, bearrj25, nirvana25, holyGrail25, fifty25, twoOne25] = request.security(s25, timeframe.period, Strat_Screener_Func())
[bullrj26, bearrj26, nirvana26, holyGrail26, fifty26, twoOne26] = request.security(s26, timeframe.period, Strat_Screener_Func())
[bullrj27, bearrj27, nirvana27, holyGrail27, fifty27, twoOne27] = request.security(s27, timeframe.period, Strat_Screener_Func())
[bullrj28, bearrj28, nirvana28, holyGrail28, fifty28, twoOne28] = request.security(s28, timeframe.period, Strat_Screener_Func())
[bullrj29, bearrj29, nirvana29, holyGrail29, fifty29, twoOne29] = request.security(s29, timeframe.period, Strat_Screener_Func())
[bullrj30, bearrj30, nirvana30, holyGrail30, fifty30, twoOne30] = request.security(s30, timeframe.period, Strat_Screener_Func())
[bullrj31, bearrj31, nirvana31, holyGrail31, fifty31, twoOne31] = request.security(s31, timeframe.period, Strat_Screener_Func())
[bullrj32, bearrj32, nirvana32, holyGrail32, fifty32, twoOne32] = request.security(s32, timeframe.period, Strat_Screener_Func())
[bullrj33, bearrj33, nirvana33, holyGrail33, fifty33, twoOne33] = request.security(s33, timeframe.period, Strat_Screener_Func())
[bullrj34, bearrj34, nirvana34, holyGrail34, fifty34, twoOne34] = request.security(s34, timeframe.period, Strat_Screener_Func())
[bullrj35, bearrj35, nirvana35, holyGrail35, fifty35, twoOne35] = request.security(s35, timeframe.period, Strat_Screener_Func())
[bullrj36, bearrj36, nirvana36, holyGrail36, fifty36, twoOne36] = request.security(s36, timeframe.period, Strat_Screener_Func())
[bullrj37, bearrj37, nirvana37, holyGrail37, fifty37, twoOne37] = request.security(s37, timeframe.period, Strat_Screener_Func())
[bullrj38, bearrj38, nirvana38, holyGrail38, fifty38, twoOne38] = request.security(s38, timeframe.period, Strat_Screener_Func())
[bullrj39, bearrj39, nirvana39, holyGrail39, fifty39, twoOne39] = request.security(s39, timeframe.period, Strat_Screener_Func())
[bullrj40, bearrj40, nirvana40, holyGrail40, fifty40, twoOne40] = request.security(s40, timeframe.period, Strat_Screener_Func())

//////////////
/// Arrays ///
//////////////
s_arr = array.new_string(0)
bullrj_arr = array.new_bool(0)
bearrj_arr = array.new_bool(0)
nirvana_arr = array.new_bool(0)
holyGrail_arr = array.new_bool(0)
fifty_arr = array.new_bool(0)
twoOne_arr = array.new_bool(0)

// Symbol name
array.push(s_arr, s01)
array.push(s_arr, s02)
array.push(s_arr, s03)
array.push(s_arr, s04)
array.push(s_arr, s05)
array.push(s_arr, s06)
array.push(s_arr, s07)
array.push(s_arr, s08)
array.push(s_arr, s09)
array.push(s_arr, s10)
array.push(s_arr, s11)
array.push(s_arr, s12)
array.push(s_arr, s13)
array.push(s_arr, s14)
array.push(s_arr, s15)
array.push(s_arr, s16)
array.push(s_arr, s17)
array.push(s_arr, s18)
array.push(s_arr, s19)
array.push(s_arr, s20)
array.push(s_arr, s21)
array.push(s_arr, s22)
array.push(s_arr, s23)
array.push(s_arr, s24)
array.push(s_arr, s25)
array.push(s_arr, s26)
array.push(s_arr, s27)
array.push(s_arr, s28)
array.push(s_arr, s29)
array.push(s_arr, s30)
array.push(s_arr, s31)
array.push(s_arr, s32)
array.push(s_arr, s33)
array.push(s_arr, s34)
array.push(s_arr, s35)
array.push(s_arr, s36)
array.push(s_arr, s37)
array.push(s_arr, s38)
array.push(s_arr, s39)
array.push(s_arr, s40)

// Bullish RJ setups
array.push(bullrj_arr, bullrj01)
array.push(bullrj_arr, bullrj02)
array.push(bullrj_arr, bullrj03)
array.push(bullrj_arr, bullrj04)
array.push(bullrj_arr, bullrj05)
array.push(bullrj_arr, bullrj06)
array.push(bullrj_arr, bullrj07)
array.push(bullrj_arr, bullrj08)
array.push(bullrj_arr, bullrj09)
array.push(bullrj_arr, bullrj10)
array.push(bullrj_arr, bullrj11)
array.push(bullrj_arr, bullrj12)
array.push(bullrj_arr, bullrj13)
array.push(bullrj_arr, bullrj14)
array.push(bullrj_arr, bullrj15)
array.push(bullrj_arr, bullrj16)
array.push(bullrj_arr, bullrj17)
array.push(bullrj_arr, bullrj18)
array.push(bullrj_arr, bullrj19)
array.push(bullrj_arr, bullrj20)
array.push(bullrj_arr, bullrj21)
array.push(bullrj_arr, bullrj22)
array.push(bullrj_arr, bullrj23)
array.push(bullrj_arr, bullrj24)
array.push(bullrj_arr, bullrj25)
array.push(bullrj_arr, bullrj26)
array.push(bullrj_arr, bullrj27)
array.push(bullrj_arr, bullrj28)
array.push(bullrj_arr, bullrj29)
array.push(bullrj_arr, bullrj30)
array.push(bullrj_arr, bullrj31)
array.push(bullrj_arr, bullrj32)
array.push(bullrj_arr, bullrj33)
array.push(bullrj_arr, bullrj34)
array.push(bullrj_arr, bullrj35)
array.push(bullrj_arr, bullrj36)
array.push(bullrj_arr, bullrj37)
array.push(bullrj_arr, bullrj38)
array.push(bullrj_arr, bullrj39)
array.push(bullrj_arr, bullrj40)

// Bearish RJ setups
array.push(bearrj_arr, bearrj01)
array.push(bearrj_arr, bearrj02)
array.push(bearrj_arr, bearrj03)
array.push(bearrj_arr, bearrj04)
array.push(bearrj_arr, bearrj05)
array.push(bearrj_arr, bearrj06)
array.push(bearrj_arr, bearrj07)
array.push(bearrj_arr, bearrj08)
array.push(bearrj_arr, bearrj09)
array.push(bearrj_arr, bearrj10)
array.push(bearrj_arr, bearrj11)
array.push(bearrj_arr, bearrj12)
array.push(bearrj_arr, bearrj13)
array.push(bearrj_arr, bearrj14)
array.push(bearrj_arr, bearrj15)
array.push(bearrj_arr, bearrj16)
array.push(bearrj_arr, bearrj17)
array.push(bearrj_arr, bearrj18)
array.push(bearrj_arr, bearrj19)
array.push(bearrj_arr, bearrj20)
array.push(bearrj_arr, bearrj21)
array.push(bearrj_arr, bearrj22)
array.push(bearrj_arr, bearrj23)
array.push(bearrj_arr, bearrj24)
array.push(bearrj_arr, bearrj25)
array.push(bearrj_arr, bearrj26)
array.push(bearrj_arr, bearrj27)
array.push(bearrj_arr, bearrj28)
array.push(bearrj_arr, bearrj29)
array.push(bearrj_arr, bearrj30)
array.push(bearrj_arr, bearrj31)
array.push(bearrj_arr, bearrj32)
array.push(bearrj_arr, bearrj33)
array.push(bearrj_arr, bearrj34)
array.push(bearrj_arr, bearrj35)
array.push(bearrj_arr, bearrj36)
array.push(bearrj_arr, bearrj37)
array.push(bearrj_arr, bearrj38)
array.push(bearrj_arr, bearrj39)
array.push(bearrj_arr, bearrj40)

// Nirvana setups
array.push(nirvana_arr, nirvana01)
array.push(nirvana_arr, nirvana02)
array.push(nirvana_arr, nirvana03)
array.push(nirvana_arr, nirvana04)
array.push(nirvana_arr, nirvana05)
array.push(nirvana_arr, nirvana06)
array.push(nirvana_arr, nirvana07)
array.push(nirvana_arr, nirvana08)
array.push(nirvana_arr, nirvana09)
array.push(nirvana_arr, nirvana10)
array.push(nirvana_arr, nirvana11)
array.push(nirvana_arr, nirvana12)
array.push(nirvana_arr, nirvana13)
array.push(nirvana_arr, nirvana14)
array.push(nirvana_arr, nirvana15)
array.push(nirvana_arr, nirvana16)
array.push(nirvana_arr, nirvana17)
array.push(nirvana_arr, nirvana18)
array.push(nirvana_arr, nirvana19)
array.push(nirvana_arr, nirvana20)
array.push(nirvana_arr, nirvana21)
array.push(nirvana_arr, nirvana22)
array.push(nirvana_arr, nirvana23)
array.push(nirvana_arr, nirvana24)
array.push(nirvana_arr, nirvana25)
array.push(nirvana_arr, nirvana26)
array.push(nirvana_arr, nirvana27)
array.push(nirvana_arr, nirvana28)
array.push(nirvana_arr, nirvana29)
array.push(nirvana_arr, nirvana30)
array.push(nirvana_arr, nirvana31)
array.push(nirvana_arr, nirvana32)
array.push(nirvana_arr, nirvana33)
array.push(nirvana_arr, nirvana34)
array.push(nirvana_arr, nirvana35)
array.push(nirvana_arr, nirvana36)
array.push(nirvana_arr, nirvana37)
array.push(nirvana_arr, nirvana38)
array.push(nirvana_arr, nirvana39)
array.push(nirvana_arr, nirvana40)

// Holy Grail setups
array.push(holyGrail_arr, holyGrail01)
array.push(holyGrail_arr, holyGrail02)
array.push(holyGrail_arr, holyGrail03)
array.push(holyGrail_arr, holyGrail04)
array.push(holyGrail_arr, holyGrail05)
array.push(holyGrail_arr, holyGrail06)
array.push(holyGrail_arr, holyGrail07)
array.push(holyGrail_arr, holyGrail08)
array.push(holyGrail_arr, holyGrail09)
array.push(holyGrail_arr, holyGrail10)
array.push(holyGrail_arr, holyGrail11)
array.push(holyGrail_arr, holyGrail12)
array.push(holyGrail_arr, holyGrail13)
array.push(holyGrail_arr, holyGrail14)
array.push(holyGrail_arr, holyGrail15)
array.push(holyGrail_arr, holyGrail16)
array.push(holyGrail_arr, holyGrail17)
array.push(holyGrail_arr, holyGrail18)
array.push(holyGrail_arr, holyGrail19)
array.push(holyGrail_arr, holyGrail20)
array.push(holyGrail_arr, holyGrail21)
array.push(holyGrail_arr, holyGrail22)
array.push(holyGrail_arr, holyGrail23)
array.push(holyGrail_arr, holyGrail24)
array.push(holyGrail_arr, holyGrail25)
array.push(holyGrail_arr, holyGrail26)
array.push(holyGrail_arr, holyGrail27)
array.push(holyGrail_arr, holyGrail28)
array.push(holyGrail_arr, holyGrail29)
array.push(holyGrail_arr, holyGrail30)
array.push(holyGrail_arr, holyGrail31)
array.push(holyGrail_arr, holyGrail32)
array.push(holyGrail_arr, holyGrail33)
array.push(holyGrail_arr, holyGrail34)
array.push(holyGrail_arr, holyGrail35)
array.push(holyGrail_arr, holyGrail36)
array.push(holyGrail_arr, holyGrail37)
array.push(holyGrail_arr, holyGrail38)
array.push(holyGrail_arr, holyGrail39)
array.push(holyGrail_arr, holyGrail40)

// 50% retracement setups
array.push(fifty_arr, fifty01)
array.push(fifty_arr, fifty02)
array.push(fifty_arr, fifty03)
array.push(fifty_arr, fifty04)
array.push(fifty_arr, fifty05)
array.push(fifty_arr, fifty06)
array.push(fifty_arr, fifty07)
array.push(fifty_arr, fifty08)
array.push(fifty_arr, fifty09)
array.push(fifty_arr, fifty10)
array.push(fifty_arr, fifty11)
array.push(fifty_arr, fifty12)
array.push(fifty_arr, fifty13)
array.push(fifty_arr, fifty14)
array.push(fifty_arr, fifty15)
array.push(fifty_arr, fifty16)
array.push(fifty_arr, fifty17)
array.push(fifty_arr, fifty18)
array.push(fifty_arr, fifty19)
array.push(fifty_arr, fifty20)
array.push(fifty_arr, fifty21)
array.push(fifty_arr, fifty22)
array.push(fifty_arr, fifty23)
array.push(fifty_arr, fifty24)
array.push(fifty_arr, fifty25)
array.push(fifty_arr, fifty26)
array.push(fifty_arr, fifty27)
array.push(fifty_arr, fifty28)
array.push(fifty_arr, fifty29)
array.push(fifty_arr, fifty30)
array.push(fifty_arr, fifty31)
array.push(fifty_arr, fifty32)
array.push(fifty_arr, fifty33)
array.push(fifty_arr, fifty34)
array.push(fifty_arr, fifty35)
array.push(fifty_arr, fifty36)
array.push(fifty_arr, fifty37)
array.push(fifty_arr, fifty38)
array.push(fifty_arr, fifty39)
array.push(fifty_arr, fifty40)

// 2-1 setup
array.push(twoOne_arr, twoOne01)
array.push(twoOne_arr, twoOne02)
array.push(twoOne_arr, twoOne03)
array.push(twoOne_arr, twoOne04)
array.push(twoOne_arr, twoOne05)
array.push(twoOne_arr, twoOne06)
array.push(twoOne_arr, twoOne07)
array.push(twoOne_arr, twoOne08)
array.push(twoOne_arr, twoOne09)
array.push(twoOne_arr, twoOne10)
array.push(twoOne_arr, twoOne11)
array.push(twoOne_arr, twoOne12)
array.push(twoOne_arr, twoOne13)
array.push(twoOne_arr, twoOne14)
array.push(twoOne_arr, twoOne15)
array.push(twoOne_arr, twoOne16)
array.push(twoOne_arr, twoOne17)
array.push(twoOne_arr, twoOne18)
array.push(twoOne_arr, twoOne19)
array.push(twoOne_arr, twoOne20)
array.push(twoOne_arr, twoOne21)
array.push(twoOne_arr, twoOne22)
array.push(twoOne_arr, twoOne23)
array.push(twoOne_arr, twoOne24)
array.push(twoOne_arr, twoOne25)
array.push(twoOne_arr, twoOne26)
array.push(twoOne_arr, twoOne27)
array.push(twoOne_arr, twoOne28)
array.push(twoOne_arr, twoOne29)
array.push(twoOne_arr, twoOne30)
array.push(twoOne_arr, twoOne31)
array.push(twoOne_arr, twoOne32)
array.push(twoOne_arr, twoOne33)
array.push(twoOne_arr, twoOne34)
array.push(twoOne_arr, twoOne35)
array.push(twoOne_arr, twoOne36)
array.push(twoOne_arr, twoOne37)
array.push(twoOne_arr, twoOne38)
array.push(twoOne_arr, twoOne39)
array.push(twoOne_arr, twoOne40)



/////////////
/// Table ///
/////////////
var tbl = table.new(position.bottom_left, 41, 10, frame_color=#151715, frame_width=1, border_width=2, border_color=color.new(color.white, 100))

if barstate.islast
    
    //table.cell(tbl, 0, 0, 'Symbol',     text_halign = text.align_center, bgcolor = color.gray, text_color = color.black, text_size = size.small)
    table.cell(tbl, 0, 0, 'BULL RJ (2u2u2d2u)',     text_halign = text.align_center, bgcolor = bgColor_heading, text_color = textColor, text_size = size.small)
    table.cell(tbl, 0, 1, 'BEAR RJ (2d2d2u2d)',     text_halign = text.align_center, bgcolor = bgColor_heading, text_color = textColor, text_size = size.small)
    table.cell(tbl, 0, 2, 'NIRVANA (1-3)',          text_halign = text.align_center, bgcolor = bgColor_heading, text_color = textColor, text_size = size.small)
    table.cell(tbl, 0, 3, 'HOLY GR (3-1)',          text_halign = text.align_center, bgcolor = bgColor_heading, text_color = textColor, text_size = size.small)
    table.cell(tbl, 0, 4, '50%',                    text_halign = text.align_center, bgcolor = bgColor_heading, text_color = textColor, text_size = size.small)
    table.cell(tbl, 0, 5, '2-1-2',                  text_halign = text.align_center, bgcolor = bgColor_heading, text_color = textColor, text_size = size.small)
    s_arr1 = array.new_string(0)
    s_arr2 = array.new_string(0)
    s_arr3 = array.new_string(0)
    s_arr4 = array.new_string(0)
    s_arr5 = array.new_string(0)
    s_arr6 = array.new_string(0)
    for i = 0 to 39
        bull_rj_num     = array.get(bullrj_arr, i)      == 1 ? true : false
        bear_rj_num     = array.get(bearrj_arr, i)      == 1 ? true : false
        nirvana_num     = array.get(nirvana_arr, i)     == 1 ? true : false
        holyGrail_num   = array.get(holyGrail_arr, i)   == 1 ? true : false
        fifty_num       = array.get(fifty_arr, i)       == 1 ? true : false
        twoOne_num      = array.get(twoOne_arr, i)      == 1 ? true : false
        
        if bull_rj_num
            array.push(s_arr1, getName(array.get(s_arr, i)))
        if bear_rj_num
            array.push(s_arr2, getName(array.get(s_arr, i)))
        if nirvana_num
            array.push(s_arr3, getName(array.get(s_arr, i)))
        if holyGrail_num
            array.push(s_arr4, getName(array.get(s_arr, i)))
        if fifty_num
            array.push(s_arr5, getName(array.get(s_arr, i)))
        if twoOne_num
            array.push(s_arr6, getName(array.get(s_arr, i)))
        
    //table.cell(tbl, i + 1, 0, array.get(s_arr, i),                      text_halign = text.align_left, bgcolor = #ccedc2, text_color = color.black, text_size = size.small)
    table.cell(tbl, 1, 0, array.join(s_arr1, ","),   text_halign = text.align_center, bgcolor = bgColor_body, text_color = textColor, text_size = size.small)
    table.cell(tbl, 1, 1, array.join(s_arr2, ","),   text_halign = text.align_center, bgcolor = bgColor_body, text_color = textColor, text_size = size.small)
    table.cell(tbl, 1, 2, array.join(s_arr3, ","),   text_halign = text.align_center, bgcolor = bgColor_body, text_color = textColor, text_size = size.small)
    table.cell(tbl, 1, 3, array.join(s_arr4, ","),   text_halign = text.align_center, bgcolor = bgColor_body, text_color = textColor, text_size = size.small)
    table.cell(tbl, 1, 4, array.join(s_arr5, ","),   text_halign = text.align_center, bgcolor = bgColor_body, text_color = textColor, text_size = size.small)
    table.cell(tbl, 1, 5, array.join(s_arr6, ","),   text_halign = text.align_center, bgcolor = bgColor_body, text_color = textColor, text_size = size.small)
