Indicator · Pine Script v5 · Own pane

Strategy Scanner

by RobertAgee· code credited to CubanEmissary

This indicator scans up to thirty symbols simultaneously against selected technical strategies, such as moving average crosses, price strength, or volume momentum.

View on GitHub

GitHub stars34on the repository
Pine versionv5runs as is
Lines of code923
Settings40inputs
LicenceNone statedfile: MPL-2.0
Last update3 years ago12 Mar 2023

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

923 lines of Pine Script v5 from script.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

script.txt
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © CubanEmissary

//@version=5
indicator("Strategy Scanner")

timeframe = input.timeframe('', 'Timeframe', group="Display Settings")
myStrategy = input.string("myStrategy", "Strategy", options = ["Golden/Death Cross", "+/- 5% in One Candle", "Price Strength Index", "Relative Volume Strength Index", "Stochastic Momentum Index", "myStrategy"], group="Display Settings")
preset = input.string("Custom", "Watchlist", options = ["Custom", "SP100 AAPL-CSCO", "SP100 DHR-MCD", "SP100 MET-TXN", "Forex", "Crypto", "Sectors/Commodities"], group="Display Settings")
showLabels = input.bool(true, 'Show Symbol Labels', group="Display Settings")
showBuyShapes = input.bool(true, 'Show Scanner Longs', group="Display Settings")
showSellShapes = input.bool(true, 'Show Scanner Shorts', group="Display Settings")
showHLines = input.bool(true, 'Show Horizontal Lines', group="Display Settings")
showBuyCandles = input.bool(false, 'Show Long Candle Markers', group="Display Settings")
showSellCandles = input.bool(false, 'Show Short Candle Markers', group="Display Settings")
bColor = input.color(color.new(#00FF00, 0), 'Long Marker Color', group="Display Settings")
sColor = input.color(color.new(#FF0000, 0), 'Short Marker Color', group="Display Settings")

sendList = input.bool(false, 'Send Buy/Sell List', group='Alert Settings')
sendLong = input.bool(false, 'Send Individual Long Alerts', group='Alert Settings')
sendShort = input.bool(false, 'Send Individual Short Alerts', group='Alert Settings')

longMessage = input.text_area(defval = "\"side\" : \"long\", \"orderType\" : \"market\", \"percentStake\" : \"2\", \"targetProfit\" : \"5\", \"stopLoss\" : \"1\"", title = " ...................................Long Alert.................................. .....................Each Alert includes ticker and last price..................... { \"ticker\" : \"[tickerID]\", \"last\" : \"[lastPrice]\", + message + }", group='Alert Settings')
shortMessage = input.text_area(defval = "\"side\" : \"short\", \"orderType\" : \"market\", \"percentStake\" : \"2\", \"targetProfit\" : \"5\", \"stopLoss\" : \"1\"", title = " ...................................Short Alert................................. .....................Each Alert includes ticker and last price..................... { \"ticker\" : \"[tickerID]\", \"last\" : \"[lastPrice]\", + message + }", group='Alert Settings')

sym1 = syminfo.ticker
sym2 = input("GOOG", "Sym2", group="Custom Watchlist")
sym3 = input("AAPL", "Sym3", group="Custom Watchlist")
sym4 = input("JPM", "Sym4", group="Custom Watchlist")
sym5 = input("XAUUSD", "Sym5", group="Custom Watchlist")
sym6 = input("ADM", "Sym6", group="Custom Watchlist")
sym7 = input("M", "Sym7", group="Custom Watchlist")
sym8 = input("MSTR", "Sym8", group="Custom Watchlist")
sym9 = input("GME", "Sym9", group="Custom Watchlist")
sym10 = input("CSCO", "Sym10", group="Custom Watchlist")

sym11 = input("DOW", "Sym11", group="Custom Watchlist")
sym12 = input("PFE", "Sym12", group="Custom Watchlist")
sym13 = input("BTCUSD", "Sym13", group="Custom Watchlist")
sym14 = input("ETHUSD", "Sym14", group="Custom Watchlist")
sym15 = input("XAGUSD", "Sym15", group="Custom Watchlist")
sym16 = input("MMM", "Sym16", group="Custom Watchlist")
sym17 = input("NFLX", "Sym17", group="Custom Watchlist")
sym18 = input("MSFT", "Sym18", group="Custom Watchlist")
sym19 = input("AMZN", "Sym19", group="Custom Watchlist")
sym20 = input("WIRE", "Sym20", group="Custom Watchlist")
    
sym21 = input("LAC", "Sym21", group="Custom Watchlist")
sym22 = input("SP", "Sym22", group="Custom Watchlist")
sym23 = input("SCHW", "Sym23", group="Custom Watchlist")
sym24 = input("TMO", "Sym24", group="Custom Watchlist")
sym25 = input("NEE", "Sym25", group="Custom Watchlist")
sym26 = input("PEP", "Sym26", group="Custom Watchlist")
sym27 = input("LMT", "Sym27", group="Custom Watchlist")
sym28 = input("PM", "Sym28", group="Custom Watchlist")
sym29 = input("LLY", "Sym29", group="Custom Watchlist")
sym30 = input("ROKU", "Sym30", group="Custom Watchlist")

if(preset == "SP100 AAPL-CSCO")
    sym2 := "AAPL"
    sym3 := "ABBV"
    sym4 := "ABT"
    sym5 := "ACN"
    sym6 := "ADBE"
    sym7 := "AIG"
    sym8 := "AMD"
    sym9 := "AMGN"
    sym10 := "AMT"
    
    sym11 := "AMZN"
    sym12 := "AVGO"
    sym13 := "AXP"
    sym14 := "BA"
    sym15 := "BAC"
    sym16 := "BK"
    sym17 := "BKNG"
    sym18 := "BLK"
    sym19 := "BMY"
    sym20 := "BRK.B"
    
    sym21 := "C"
    sym22 := "CAT"
    sym23 := "CHTR"
    sym24 := "CL"
    sym25 := "CMCSA"
    sym26 := "COF"
    sym27 := "COP"
    sym28 := "COST"
    sym29 := "CRM"
    sym30 := "CSCO"

if(preset == "SP100 DHR-MCD")
    sym2 := "DHR"
    sym3 := "DIS"
    sym4 := "DOW"
    sym5 := "DUK"
    sym6 := "EMR"
    sym7 := "EXC"
    sym8 := "F"
    sym9 := "FDX"
    sym10 := "GD"
    
    sym11 := "GE"
    sym12 := "GILD"
    sym13 := "GM"
    sym14 := "GOOG"
    sym15 := "GOOGL"
    sym16 := "GS"
    sym17 := "HD"
    sym18 := "HON"
    sym19 := "IBM"
    sym20 := "INTC"
    
    sym21 := "JNJ"
    sym22 := "JPM"
    sym23 := "KHC"
    sym24 := "KO"
    sym25 := "LIN"
    sym26 := "LLY"
    sym27 := "LMT"
    sym28 := "LOW"
    sym29 := "MA"
    sym30 := "MCD"

if(preset == "SP100 MET-TXN")
    sym2 := "MET"
    sym3 := "META"
    sym4 := "MMM"
    sym5 := "MO"
    sym6 := "MRK"
    sym7 := "MS"
    sym8 := "MSFT"
    sym9 := "NEE"
    sym10 := "NFLX"
    
    sym11 := "NKE"
    sym12 := "NVDA"
    sym13 := "ORCL"
    sym14 := "PEP"
    sym15 := "PFE"
    sym16 := "PG"
    sym17 := "PM"
    sym18 := "PYPL"
    sym19 := "QCOM"
    sym20 := "RTX"
    
    sym21 := "SBUX"
    sym22 := "SCHW"
    sym23 := "SO"
    sym24 := "SPG"
    sym25 := "T"
    sym26 := "TGT"
    sym27 := "TMO"
    sym28 := "TMUS"
    sym29 := "TSLA"
    sym30 := "TXN"
    
if(preset == "Crypto")
    sym2 := "BTCUSDT"
    sym3 := "ETHUSDT"
    sym4 := "XMRUSDT"
    sym5 := "DOTUSDT"
    sym6 := "ADAUSDT"
    sym7 := "SOLUSDT"
    sym8 := "FXSUSDT"
    sym9 := "QNTUSDT"
    sym10 := "VETUSDT"
    
    sym11 := "LTCUSDT"
    sym12 := "KCSUSDT"
    sym13 := "MATICUSDT"
    sym14 := "DOGEUSDT"
    sym15 := "XRPUSDT"
    sym16 := "BNBUSDT"
    sym17 := "EOSUSDT"
    sym18 := "TRXUSDT"
    sym19 := "AKROUSDT"
    sym20 := "APTUSDT"
    
    sym21 := "FTMUSDT"
    sym22 := "TONUSDT"
    sym23 := "FILUSDT"
    sym24 := "AVAXUSDT"
    sym25 := "GRTUSDT"
    sym26 := "LINKUSDT"
    sym27 := "HBARUSDT"
    sym28 := "NEARUSDT"
    sym29 := "OCEANUSDT"
    sym30 := "ALGOUSDT"
    
if(preset == "Forex")
    sym2 := "EURUSD"
    sym3 := "JPYUSD"
    sym4 := "MXNUSD"
    sym5 := "GBPUSD"
    sym6 := "NZDUSD"
    sym7 := "AUDUSD"
    sym8 := "TRYUSD"
    sym9 := "CADUSD"
    sym10 := "CNHUSD"
    
    sym11 := "CHFUSD"
    sym12 := "DKKUSD"
    sym13 := "HKDUSD"
    sym14 := "HUFUSD"
    sym15 := "NOKUSD"
    sym16 := "PLNUSD"
    sym17 := "SEKUSD"
    sym18 := "SGDUSD"
    sym19 := "CZKUSD"
    sym20 := "GBPEUR"
    
    sym21 := "NZDEUR"
    sym22 := "CADEUR"
    sym23 := "JPYEUR"
    sym24 := "MXNEUR"
    sym25 := "HKDEUR"
    sym26 := "PLNEUR"
    sym27 := "CHFEUR"
    sym28 := "AUDEUR"
    sym29 := "MXNCAD"
    sym30 := "JPYCAD"    

if(preset == "Sectors/Commodities")
    sym2 := "XAUUSD"
    sym3 := "XAGUSD"
    sym4 := "XPTUSD"
    sym5 := "XPDUSD"
    sym6 := "XLB"
    sym7 := "XLC"
    sym8 := "XLE"
    sym9 := "XLF"
    sym10 := "XLI"
    
    sym11 := "XLK"
    sym12 := "XLP"
    sym13 := "XLU"
    sym14 := "XLV"
    sym15 := "XLY"
    sym16 := "XES"
    sym17 := "XHB"
    sym18 := "NQCILHTR"
    sym19 := "DJCISB"
    sym20 := "DJCIGR"
    
    sym21 := "NQCIWER"
    sym22 := "NQCISNER"
    sym23 := "NQCISER"
    sym24 := "NQCICER"
    sym25 := "DJCICC"
    sym26 := "DJCIKC"
    sym27 := "DJCIEN"
    sym28 := "NQCIHOER"
    sym29 := "NQCINGER"
    sym30 := "NQCILHTR"


// strategy methods
// contains a few basic strategies
// personal strategies can be added
myStrategy(_src, _myStrategy) => 
    
    if(_myStrategy == "Golden/Death Cross")
        ema50 = ta.ema(_src, 50)
        ema200 = ta.ema(_src, 200)

        bCondition = if(ta.crossover(ema50, ema200))
            1
        else
            na
        sCondition = if(ta.crossunder(ema50, ema200))
            1
        else
            na
        
        [ema50, bCondition, sCondition]
        
    else if(_myStrategy == "+/- 5% in One Candle")
        bCondition = if(close <= 0.95*close[1])
            1
        else
            na
        sCondition = if(close[1] <= 0.95*close)
            1
        else
            na
        
        [_src, bCondition, sCondition]

    else if(_myStrategy == "Price Strength Index")
        u = math.max(close - close[1], 0) // upward change
        d = math.max(close[1] - close, 0) // downward change
        rs = (ta.ema(u, 7) / ta.ema(d, 7))
        res = (100 - 100 / (1 + rs))
        PSI = (ta.hma(res, 56))

        bCondition = if(ta.crossover((PSI-PSI[1]), 0))
            1
        else
            na
        sCondition = if(ta.crossunder((PSI-PSI[1]), 0))
            1
        else
            na
        
        [PSI, bCondition, sCondition]

    else if(_myStrategy == "Relative Volume Strength Index")
        nv = ta.cum((ta.change(close)) * volume)
        av = ta.ema(nv, 5)
        RVSI = ta.rsi(av, 10)
        x = ta.ema(RVSI, 10)

        bCondition = if((RVSI[1] < x[1]) and (RVSI[2] > RVSI[1]) and (RVSI >= x) and (RVSI[1] < RVSI))
            1
        else
            na
        sCondition = if((RVSI[1] >= x[1]) and (RVSI[2] < RVSI[1]) and (RVSI >= x) and (RVSI[1] > RVSI))
            1
        else
            na
        
        [RVSI, bCondition, sCondition]

    else if(_myStrategy == "Stochastic Momentum Index")
        // Range Calculation
        ll = ta.lowest(low, 10)
        hh = ta.highest(high, 10)
        diff = hh - ll
        rdiff = close - (hh+ll)/2

        avgrel = ta.ema(ta.ema(rdiff, 3), 3)
        avgdiff = ta.ema(ta.ema(diff, 3), 3)
        // SMI calculations
        SMI = avgdiff != 0 ? (avgrel/(avgdiff/2)*100) : 0
        SMIsignal = ta.ema(SMI, 3)
        emasignal = ta.ema(SMI, 10)
        
        level_40smi = SMIsignal > 40 ? SMIsignal : 40

        level_m40smi = SMIsignal < -40 ? SMIsignal : -40

        bCondition = if(SMIsignal < -40)
            1
        else
            na
        sCondition = if(SMIsignal > 40)
            1
        else
            na
            
        [emasignal, bCondition, sCondition]

    else if(_myStrategy == "myStrategy")
        // meant to insert your custom strategy
        // default is RSI
        ss1 = ta.rsi(close, 7)

        bCondition = if(ss1 < 30)
            1
        else
            na
        sCondition = if(ss1 > 70)
            1
        else
            na
            
        [_src, bCondition, sCondition]


// request strategy analysis on symbols
[ss1, bCondition1, sCondition1] = request.security(sym1, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss2, bCondition2, sCondition2] = request.security(sym2, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss3, bCondition3, sCondition3] = request.security(sym3, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss4, bCondition4, sCondition4] = request.security(sym4, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss5, bCondition5, sCondition5] = request.security(sym5, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss6, bCondition6, sCondition6] = request.security(sym6, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss7, bCondition7, sCondition7] = request.security(sym7, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss8, bCondition8, sCondition8] = request.security(sym8, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss9, bCondition9, sCondition9] = request.security(sym9, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss10, bCondition10, sCondition10] = request.security(sym10, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)

[ss11, bCondition11, sCondition11] = request.security(sym11, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss12, bCondition12, sCondition12] = request.security(sym12, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss13, bCondition13, sCondition13] = request.security(sym13, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss14, bCondition14, sCondition14] = request.security(sym14, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss15, bCondition15, sCondition15] = request.security(sym15, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss16, bCondition16, sCondition16] = request.security(sym16, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss17, bCondition17, sCondition17] = request.security(sym17, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss18, bCondition18, sCondition18] = request.security(sym18, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss19, bCondition19, sCondition19] = request.security(sym19, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss20, bCondition20, sCondition20] = request.security(sym20, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)

[ss21, bCondition21, sCondition21] = request.security(sym21, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss22, bCondition22, sCondition22] = request.security(sym22, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss23, bCondition23, sCondition23] = request.security(sym23, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss24, bCondition24, sCondition24] = request.security(sym24, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss25, bCondition25, sCondition25] = request.security(sym25, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss26, bCondition26, sCondition26] = request.security(sym26, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss27, bCondition27, sCondition27] = request.security(sym27, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss28, bCondition28, sCondition28] = request.security(sym28, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
[ss29, bCondition29, sCondition29] = request.security(sym29, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)

[ss30, bCondition30, sCondition30] = request.security(sym30, timeframe, myStrategy(close, myStrategy), barmerge.gaps_on, barmerge.lookahead_on)
// send group list alerts
// builds an array of symbol strings that are concatenated with a for loop into the alert message
// if pine script had a dictionary object, I would loop through that instead
if(sendList == true)
    report = array.new_string(0)
    if(bCondition1 == 1)
        array.push(report, sym1)
    if(bCondition2 == 1)
        array.push(report, sym2)
    if(bCondition3 == 1)
        array.push(report, sym3)
    if(bCondition4 == 1)
        array.push(report, sym4)
    if(bCondition5 == 1)
        array.push(report, sym5)
    if(bCondition6 == 1)
        array.push(report, sym6)
    if(bCondition7 == 1)
        array.push(report, sym7)
    if(bCondition8 == 1)
        array.push(report, sym8)
    if(bCondition9 == 1)
        array.push(report, sym9)
    if(bCondition10 == 1)
        array.push(report, sym10)
    if(bCondition11 == 1)
        array.push(report, sym11)
    if(bCondition12 == 1)
        array.push(report, sym12)
    if(bCondition13 == 1)
        array.push(report, sym13)
    if(bCondition14 == 1)
        array.push(report, sym14)
    if(bCondition15 == 1)
        array.push(report, sym15)
    if(bCondition16 == 1)
        array.push(report, sym16)
    if(bCondition17 == 1)
        array.push(report, sym17)
    if(bCondition18 == 1)
        array.push(report, sym18)
    if(bCondition19 == 1)
        array.push(report, sym19)
    if(bCondition20 == 1)
        array.push(report, sym20)
    if(bCondition21 == 1)
        array.push(report, sym21)
    if(bCondition22 == 1)
        array.push(report, sym22)
    if(bCondition23 == 1)
        array.push(report, sym23)
    if(bCondition24 == 1)
        array.push(report, sym24)
    if(bCondition25 == 1)
        array.push(report, sym25)
    if(bCondition26 == 1)
        array.push(report, sym26)
    if(bCondition27 == 1)
        array.push(report, sym27)
    if(bCondition28 == 1)
        array.push(report, sym28)
    if(bCondition29 == 1)
        array.push(report, sym29)
    if(bCondition30 == 1)
        array.push(report, sym30)

    string message = 'Buy: '
    if array.size(report) > 0
        for i = 0 to array.size(report)-1
            message := message + array.get(report, i) + ', '
        array.clear(report)

    if(sCondition1 == 1)
        array.push(report, sym1)
    if(sCondition2 == 1)
        array.push(report, sym2)
    if(sCondition3 == 1)
        array.push(report, sym3)
    if(sCondition4 == 1)
        array.push(report, sym4)
    if(sCondition5 == 1)
        array.push(report, sym5)
    if(sCondition6 == 1)
        array.push(report, sym6)
    if(sCondition7 == 1)
        array.push(report, sym7)
    if(sCondition8 == 1)
        array.push(report, sym8)
    if(sCondition9 == 1)
        array.push(report, sym9)
    if(sCondition10 == 1)
        array.push(report, sym10)
    if(sCondition11 == 1)
        array.push(report, sym11)
    if(sCondition12 == 1)
        array.push(report, sym12)
    if(sCondition13 == 1)
        array.push(report, sym13)
    if(sCondition14 == 1)
        array.push(report, sym14)
    if(sCondition15 == 1)
        array.push(report, sym15)
    if(sCondition16 == 1)
        array.push(report, sym16)
    if(sCondition17 == 1)
        array.push(report, sym17)
    if(sCondition18 == 1)
        array.push(report, sym18)
    if(sCondition19 == 1)
        array.push(report, sym19)
    if(sCondition20 == 1)
        array.push(report, sym20)
    if(sCondition21 == 1)
        array.push(report, sym21)
    if(sCondition22 == 1)
        array.push(report, sym22)
    if(sCondition23 == 1)
        array.push(report, sym23)
    if(sCondition24 == 1)
        array.push(report, sym24)
    if(sCondition25 == 1)
        array.push(report, sym25)
    if(sCondition26 == 1)
        array.push(report, sym26)
    if(sCondition27 == 1)
        array.push(report, sym27)
    if(sCondition28 == 1)
        array.push(report, sym28)
    if(sCondition29 == 1)
        array.push(report, sym29)
    if(sCondition30 == 1)
        array.push(report, sym30)
        
    message := message + "| Sell: "
    if array.size(report) > 0
        for i = 0 to array.size(report)-1
            message := message + array.get(report, i) + ', '

    alert(message, alert.freq_once_per_bar_close)
    array.clear(report)

// 

//send individual alerts
// creates a JSON message to be sent to an execution server

longMessage(sym, ss) =>
    final = "{ \"symbol\" : \""+str.tostring(sym)+"\", \"lastPrice\" : \"" + str.tostring(ss) + "\", " + longMessage
    if(str.endswith(final, ","))
        final := str.substring(final, 0, str.length(final)-2) + " }"
    final+ " }"

shortMessage(sym, ss) =>
    final = "{ \"symbol\" : \""+str.tostring(sym)+"\", \"lastPrice\" : \"" + str.tostring(ss) + "\", " + shortMessage
    if(str.endswith(final, ","))
        final := str.substring(final, 0, str.length(final)-2)
    final+ " }"

if(sendLong == true)
    if(bCondition1 == 1)
        alert(longMessage(sym1, ss1), alert.freq_once_per_bar_close)
    if(bCondition2 == 1)
        alert(longMessage(sym2, ss2), alert.freq_once_per_bar_close)
    if(bCondition3 == 1)
        alert(longMessage(sym3, ss3), alert.freq_once_per_bar_close)
    if(bCondition4 == 1)
        alert(longMessage(sym4, ss4), alert.freq_once_per_bar_close)
    if(bCondition5 == 1)
        alert(longMessage(sym5, ss5), alert.freq_once_per_bar_close)
    if(bCondition6 == 1)
        alert(longMessage(sym6, ss6), alert.freq_once_per_bar_close)
    if(bCondition7 == 1)
        alert(longMessage(sym7, ss7), alert.freq_once_per_bar_close)
    if(bCondition8 == 1)
        alert(longMessage(sym8, ss8), alert.freq_once_per_bar_close)
    if(bCondition9 == 1)
        alert(longMessage(sym9, ss9), alert.freq_once_per_bar_close)
    if(bCondition10 == 1)
        alert(longMessage(sym10, ss10), alert.freq_once_per_bar_close)
    if(bCondition11 == 1)
        alert(longMessage(sym11, ss11), alert.freq_once_per_bar_close)
    if(bCondition12 == 1)
        alert(longMessage(sym12, ss12), alert.freq_once_per_bar_close)
    if(bCondition13 == 1)
        alert(longMessage(sym13, ss13), alert.freq_once_per_bar_close)
    if(bCondition14 == 1)
        alert(longMessage(sym14, ss14), alert.freq_once_per_bar_close)
    if(bCondition15 == 1)
        alert(longMessage(sym15, ss15), alert.freq_once_per_bar_close)
    if(bCondition16 == 1)
        alert(longMessage(sym16, ss16), alert.freq_once_per_bar_close)
    if(bCondition17 == 1)
        alert(longMessage(sym17, ss17), alert.freq_once_per_bar_close)
    if(bCondition18 == 1)
        alert(longMessage(sym18, ss18), alert.freq_once_per_bar_close)
    if(bCondition19 == 1)
        alert(longMessage(sym19, ss19), alert.freq_once_per_bar_close)
    if(bCondition20 == 1)
        alert(longMessage(sym20, ss20), alert.freq_once_per_bar_close)
    if(bCondition21 == 1)
        alert(longMessage(sym21, ss21), alert.freq_once_per_bar_close)
    if(bCondition22 == 1)
        alert(longMessage(sym22, ss22), alert.freq_once_per_bar_close)
    if(bCondition23 == 1)
        alert(longMessage(sym23, ss23), alert.freq_once_per_bar_close)
    if(bCondition24 == 1)
        alert(longMessage(sym24, ss24), alert.freq_once_per_bar_close)
    if(bCondition25 == 1)
        alert(longMessage(sym25, ss25), alert.freq_once_per_bar_close)
    if(bCondition26 == 1)
        alert(longMessage(sym26, ss26), alert.freq_once_per_bar_close)
    if(bCondition27 == 1)
        alert(longMessage(sym27, ss27), alert.freq_once_per_bar_close)
    if(bCondition28 == 1)
        alert(longMessage(sym28, ss28), alert.freq_once_per_bar_close)
    if(bCondition29 == 1)
        alert(longMessage(sym29, ss29), alert.freq_once_per_bar_close)
    if(bCondition30 == 1)
        alert(longMessage(sym30, ss30), alert.freq_once_per_bar_close)

if(sendShort == true)
    if(sCondition1 == 1)
        alert(shortMessage(sym1, ss1), alert.freq_once_per_bar_close)
    if(sCondition2 == 1)
        alert(shortMessage(sym2, ss2), alert.freq_once_per_bar_close)
    if(sCondition3 == 1)
        alert(shortMessage(sym3, ss3), alert.freq_once_per_bar_close)
    if(sCondition4 == 1)
        alert(shortMessage(sym4, ss4), alert.freq_once_per_bar_close)
    if(sCondition5 == 1)
        alert(shortMessage(sym5, ss5), alert.freq_once_per_bar_close)
    if(sCondition6 == 1)
        alert(shortMessage(sym6, ss6), alert.freq_once_per_bar_close)
    if(sCondition7 == 1)
        alert(shortMessage(sym7, ss7), alert.freq_once_per_bar_close)
    if(sCondition8 == 1)
        alert(shortMessage(sym8, ss8), alert.freq_once_per_bar_close)
    if(sCondition9 == 1)
        alert(shortMessage(sym9, ss9), alert.freq_once_per_bar_close)
    if(sCondition10 == 1)
        alert(shortMessage(sym10, ss10), alert.freq_once_per_bar_close)
    if(sCondition11 == 1)
        alert(shortMessage(sym11, ss11), alert.freq_once_per_bar_close)
    if(sCondition12 == 1)
        alert(shortMessage(sym12, ss12), alert.freq_once_per_bar_close)
    if(sCondition13 == 1)
        alert(shortMessage(sym13, ss13), alert.freq_once_per_bar_close)
    if(sCondition14 == 1)
        alert(shortMessage(sym14, ss14), alert.freq_once_per_bar_close)
    if(sCondition15 == 1)
        alert(shortMessage(sym15, ss15), alert.freq_once_per_bar_close)
    if(sCondition16 == 1)
        alert(shortMessage(sym16, ss16), alert.freq_once_per_bar_close)
    if(sCondition17 == 1)
        alert(shortMessage(sym17, ss17), alert.freq_once_per_bar_close)
    if(sCondition18 == 1)
        alert(shortMessage(sym18, ss18), alert.freq_once_per_bar_close)
    if(sCondition19 == 1)
        alert(shortMessage(sym19, ss19), alert.freq_once_per_bar_close)
    if(sCondition20 == 1)
        alert(shortMessage(sym20, ss20), alert.freq_once_per_bar_close)
    if(sCondition21 == 1)
        alert(shortMessage(sym21, ss21), alert.freq_once_per_bar_close)
    if(sCondition22 == 1)
        alert(shortMessage(sym22, ss22), alert.freq_once_per_bar_close)
    if(sCondition23 == 1)
        alert(shortMessage(sym23, ss23), alert.freq_once_per_bar_close)
    if(sCondition24 == 1)
        alert(shortMessage(sym24, ss24), alert.freq_once_per_bar_close)
    if(sCondition25 == 1)
        alert(shortMessage(sym25, ss25), alert.freq_once_per_bar_close)
    if(sCondition26 == 1)
        alert(shortMessage(sym26, ss26), alert.freq_once_per_bar_close)
    if(sCondition27 == 1)
        alert(shortMessage(sym27, ss27), alert.freq_once_per_bar_close)
    if(sCondition28 == 1)
        alert(shortMessage(sym28, ss28), alert.freq_once_per_bar_close)
    if(sCondition29 == 1)
        alert(shortMessage(sym29, ss29), alert.freq_once_per_bar_close)
    if(sCondition30 == 1)
        alert(shortMessage(sym30, ss30), alert.freq_once_per_bar_close)


//


//draw symbol horizontal lines
// please note that hline() methods cannot be used within an if statement, but can contain an if statement
hline((showHLines == true) ? 145 : na, color=color.new(color.red, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 140 : na, color=color.new(color.orange, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 135 : na, color=color.new(color.yellow, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 130 : na, color=color.new(color.lime, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 125 : na, color=color.new(color.green, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 120 : na, color=color.new(color.teal, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 115 : na, color=color.new(color.blue, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 110 : na, color=color.new(color.fuchsia, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 105 : na, color=color.new(color.purple, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 100 : na, color=color.new(color.maroon, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 95 : na, color=color.new(color.red, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 90 : na, color=color.new(color.orange, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 85 : na, color=color.new(color.yellow, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 80 : na, color=color.new(color.lime, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 75 : na, color=color.new(color.green, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 70 : na, color=color.new(color.teal, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 65 : na, color=color.new(color.blue, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 60 : na, color=color.new(color.fuchsia, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 55 : na, color=color.new(color.purple, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 50 : na, color=color.new(color.maroon, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 45 : na, color=color.new(color.red, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 40 : na, color=color.new(color.orange, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 35 : na, color=color.new(color.yellow, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 30 : na, color=color.new(color.lime, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 25 : na, color=color.new(color.green, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 20 : na, color=color.new(color.teal, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 15 : na, color=color.new(color.blue, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 10 : na, color=color.new(color.fuchsia, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 5 : na, color=color.new(color.purple, 25), linestyle = hline.style_dotted)
hline((showHLines == true) ? 0 : na, color=color.new(color.maroon, 25), linestyle = hline.style_dotted)

// plot symbol labels
if(showLabels == true)
    label1 = label.new(bar_index+5, 145, text=sym1, style=label.style_label_left, textcolor=color.red, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label1[1])
    label2 = label.new(bar_index+5, 140, text=sym2, style=label.style_label_left, textcolor=color.orange, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label2[1])
    label3 = label.new(bar_index+5, 135, text=sym3, style=label.style_label_left, textcolor=color.yellow, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label3[1])
    label4 = label.new(bar_index+5, 130, text=sym4, style=label.style_label_left, textcolor=color.lime, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label4[1])
    label5 = label.new(bar_index+5, 125, text=sym5, style=label.style_label_left, textcolor=color.green, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label5[1])
    label6 = label.new(bar_index+5, 120, text=sym6, style=label.style_label_left, textcolor=color.teal, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label6[1])
    label7 = label.new(bar_index+5, 115, text=sym7, style=label.style_label_left, textcolor=color.blue, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label7[1])
    label8 = label.new(bar_index+5, 110, text=sym8, style=label.style_label_left, textcolor=color.fuchsia, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label8[1])
    label9 = label.new(bar_index+5, 105, text=sym9, style=label.style_label_left, textcolor=color.purple, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label9[1])
    label10 = label.new(bar_index+5, 100, text=sym10, style=label.style_label_left, textcolor=color.maroon, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label10[1])
    label11 = label.new(bar_index+5, 95, text=sym11, style=label.style_label_left, textcolor=color.red, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label11[1])
    label12 = label.new(bar_index+5, 90, text=sym12, style=label.style_label_left, textcolor=color.orange, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label12[1])
    label13 = label.new(bar_index+5, 85, text=sym13, style=label.style_label_left, textcolor=color.yellow, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label13[1])
    label14 = label.new(bar_index+5, 80, text=sym14, style=label.style_label_left, textcolor=color.lime, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label14[1])
    label15 = label.new(bar_index+5, 75, text=sym15, style=label.style_label_left, textcolor=color.green, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label15[1])
    label16 = label.new(bar_index+5, 70, text=sym16, style=label.style_label_left, textcolor=color.teal, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label16[1])
    label17 = label.new(bar_index+5, 65, text=sym17, style=label.style_label_left, textcolor=color.blue, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label17[1])
    label18 = label.new(bar_index+5, 60, text=sym18, style=label.style_label_left, textcolor=color.fuchsia, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label18[1])
    label19 = label.new(bar_index+5, 55, text=sym19, style=label.style_label_left, textcolor=color.purple, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label19[1])
    label20 = label.new(bar_index+5, 50, text=sym20, style=label.style_label_left, textcolor=color.maroon, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label20[1])
    label21 = label.new(bar_index+5, 45, text=sym21, style=label.style_label_left, textcolor=color.red, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label21[1])
    label22 = label.new(bar_index+5, 40, text=sym22, style=label.style_label_left, textcolor=color.orange, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label22[1])
    label23 = label.new(bar_index+5, 35, text=sym23, style=label.style_label_left, textcolor=color.yellow, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label23[1])
    label24 = label.new(bar_index+5, 30, text=sym24, style=label.style_label_left, textcolor=color.lime, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label24[1])
    label25 = label.new(bar_index+5, 25, text=sym25, style=label.style_label_left, textcolor=color.green, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label25[1])
    label26 = label.new(bar_index+5, 20, text=sym26, style=label.style_label_left, textcolor=color.teal, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label26[1])
    label27 = label.new(bar_index+5, 15, text=sym27, style=label.style_label_left, textcolor=color.blue, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label27[1])
    label28 = label.new(bar_index+5, 10, text=sym28, style=label.style_label_left, textcolor=color.fuchsia, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label28[1])
    label29 = label.new(bar_index+5, 5, text=sym29, style=label.style_label_left, textcolor=color.purple, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label29[1])
    label30 = label.new(bar_index+5, 0, text=sym30, style=label.style_label_left, textcolor=color.maroon, size=size.normal, color=color.rgb(0, 0, 0, 100), xloc=xloc.bar_index, yloc=yloc.price)
    label.delete(label30[1])

// 
// plot shape entry markers
// please note that plot() methods cannot be used within an if statement, but can contain an if statement
plotshape((showBuyShapes == true) ? (bCondition1*145) : na, title="Buy Sym1", style=shape.circle,
                 location=location.absolute, color=color.new(color.red, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition2*140) : na, title="Buy Sym2", style=shape.circle,
                 location=location.absolute, color=color.new(color.orange, 50), size=size.small)                 
plotshape((showBuyShapes == true) ? (bCondition3*135) : na, title="Buy Sym3", style=shape.circle,
                 location=location.absolute, color=color.new(color.yellow, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition4*130) : na, title="Buy Sym4", style=shape.circle,
                 location=location.absolute, color=color.new(color.lime, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition5*125) : na, title="Buy Sym5", style=shape.circle,
                 location=location.absolute, color=color.new(color.green, 50), size=size.small)                 
plotshape((showBuyShapes == true) ? (bCondition6*120) : na, title="Buy Sym6", style=shape.circle,
                 location=location.absolute, color=color.new(color.teal, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition7*115) : na, title="Buy Sym7", style=shape.circle,
                 location=location.absolute, color=color.new(color.blue, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition8*110) : na, title="Buy Sym8", style=shape.circle,
                 location=location.absolute, color=color.new(color.fuchsia, 50), size=size.small)                 
plotshape((showBuyShapes == true) ? (bCondition9*105) : na, title="Buy Sym9", style=shape.circle,
                 location=location.absolute, color=color.new(color.purple, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition10*100) : na, title="Buy Sym10", style=shape.circle,
                 location=location.absolute, color=color.new(color.maroon, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition11*95) : na, title="Buy Sym11", style=shape.circle,
                 location=location.absolute, color=color.new(color.red, 50), size=size.small)                 
plotshape((showBuyShapes == true) ? (bCondition12*90) : na, title="Buy Sym12", style=shape.circle,
                 location=location.absolute, color=color.new(color.orange, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition13*85) : na, title="Buy Sym13", style=shape.circle,
                 location=location.absolute, color=color.new(color.yellow, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition14*80) : na, title="Buy Sym14", style=shape.circle,
                 location=location.absolute, color=color.new(color.lime, 50), size=size.small)                 
plotshape((showBuyShapes == true) ? (bCondition15*75) : na, title="Buy Sym15", style=shape.circle,
                 location=location.absolute, color=color.new(color.green, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition16*70) : na, title="Buy Sym16", style=shape.circle,
                 location=location.absolute, color=color.new(color.teal, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition17*65) : na, title="Buy Sym17", style=shape.circle,
                 location=location.absolute, color=color.new(color.blue, 50), size=size.small)                 
plotshape((showBuyShapes == true) ? (bCondition18*60) : na, title="Buy Sym18", style=shape.circle,
                 location=location.absolute, color=color.new(color.fuchsia, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition19*55) : na, title="Buy Sym19", style=shape.circle,
                 location=location.absolute, color=color.new(color.purple, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition20*50) : na, title="Buy Sym20", style=shape.circle,
                 location=location.absolute, color=color.new(color.maroon, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition21*45) : na, title="Buy Sym21", style=shape.circle,
                 location=location.absolute, color=color.new(color.red, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition22*40) : na, title="Buy Sym22", style=shape.circle,
                 location=location.absolute, color=color.new(color.orange, 50), size=size.small)                 
plotshape((showBuyShapes == true) ? (bCondition23*35) : na, title="Buy Sym23", style=shape.circle,
                 location=location.absolute, color=color.new(color.yellow, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition24*30) : na, title="Buy Sym24", style=shape.circle,
                 location=location.absolute, color=color.new(color.lime, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition25*25) : na, title="Buy Sym25", style=shape.circle,
                 location=location.absolute, color=color.new(color.green, 50), size=size.small)                 
plotshape((showBuyShapes == true) ? (bCondition26*20) : na, title="Buy Sym26", style=shape.circle,
                 location=location.absolute, color=color.new(color.teal, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition27*15) : na, title="Buy Sym27", style=shape.circle,
                 location=location.absolute, color=color.new(color.blue, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition28*10) : na, title="Buy Sym28", style=shape.circle,
                 location=location.absolute, color=color.new(color.fuchsia, 50), size=size.small)                 
plotshape((showBuyShapes == true) ? (bCondition29*5) : na, title="Buy Sym29", style=shape.circle,
                 location=location.absolute, color=color.new(color.purple, 50), size=size.small)
plotshape((showBuyShapes == true) ? (bCondition30*0) : na, title="Buy Sym30", style=shape.circle,
                 location=location.absolute, color=color.new(color.maroon, 50), size=size.small)             

// 
//plot shape exit markers
// please note that plot() methods cannot be used within an if statement, but can contain an if statement
plotshape((showSellShapes == true) ? (sCondition1*145) : na, title="Sell Sym1", style=shape.xcross,
                 location=location.absolute, color=color.new(color.red, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition2*140) : na, title="Sell Sym2", style=shape.xcross,
                 location=location.absolute, color=color.new(color.orange, 50), size=size.small)                 
plotshape((showSellShapes == true) ? (sCondition3*135) : na, title="Sell Sym3", style=shape.xcross,
                 location=location.absolute, color=color.new(color.yellow, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition4*130) : na, title="Sell Sym4", style=shape.xcross,
                 location=location.absolute, color=color.new(color.lime, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition5*125) : na, title="Sell Sym5", style=shape.xcross,
                 location=location.absolute, color=color.new(color.green, 50), size=size.small)                 
plotshape((showSellShapes == true) ? (sCondition6*120) : na, title="Sell Sym6", style=shape.xcross,
                 location=location.absolute, color=color.new(color.teal, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition7*115) : na, title="Sell Sym7", style=shape.xcross,
                 location=location.absolute, color=color.new(color.blue, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition8*110) : na, title="Sell Sym8", style=shape.xcross,
                 location=location.absolute, color=color.new(color.fuchsia, 50), size=size.small)                 
plotshape((showSellShapes == true) ? (sCondition9*105) : na, title="Sell Sym9", style=shape.xcross,
                 location=location.absolute, color=color.new(color.purple, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition10*100) : na, title="Sell Sym10", style=shape.xcross,
                 location=location.absolute, color=color.new(color.maroon, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition11*95) : na, title="Sell Sym11", style=shape.xcross,
                 location=location.absolute, color=color.new(color.red, 50), size=size.small)                 
plotshape((showSellShapes == true) ? (sCondition12*90) : na, title="Sell Sym12", style=shape.xcross,
                 location=location.absolute, color=color.new(color.orange, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition13*85) : na, title="Sell Sym13", style=shape.xcross,
                 location=location.absolute, color=color.new(color.yellow, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition14*80) : na, title="Sell Sym14", style=shape.xcross,
                 location=location.absolute, color=color.new(color.lime, 50), size=size.small)                 
plotshape((showSellShapes == true) ? (sCondition15*75) : na, title="Sell Sym15", style=shape.xcross,
                 location=location.absolute, color=color.new(color.green, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition16*70) : na, title="Sell Sym16", style=shape.xcross,
                 location=location.absolute, color=color.new(color.teal, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition17*65) : na, title="Sell Sym17", style=shape.xcross,
                 location=location.absolute, color=color.new(color.blue, 50), size=size.small)                 
plotshape((showSellShapes == true) ? (sCondition18*60) : na, title="Sell Sym18", style=shape.xcross,
                 location=location.absolute, color=color.new(color.fuchsia, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition19*55) : na, title="Sell Sym19", style=shape.xcross,
                 location=location.absolute, color=color.new(color.purple, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition20*50) : na, title="Sell Sym20", style=shape.xcross,
                 location=location.absolute, color=color.new(color.maroon, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition21*45) : na, title="Sell Sym21", style=shape.xcross,
                 location=location.absolute, color=color.new(color.red, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition22*40) : na, title="Sell Sym22", style=shape.xcross,
                 location=location.absolute, color=color.new(color.orange, 50), size=size.small)                 
plotshape((showSellShapes == true) ? (sCondition23*35) : na, title="Sell Sym23", style=shape.xcross,
                 location=location.absolute, color=color.new(color.yellow, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition24*30) : na, title="Sell Sym24", style=shape.xcross,
                 location=location.absolute, color=color.new(color.lime, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition25*25) : na, title="Sell Sym25", style=shape.xcross,
                 location=location.absolute, color=color.new(color.green, 50), size=size.small)                 
plotshape((showSellShapes == true) ? (sCondition26*20) : na, title="Sell Sym26", style=shape.xcross,
                 location=location.absolute, color=color.new(color.teal, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition27*15) : na, title="Sell Sym27", style=shape.xcross,
                 location=location.absolute, color=color.new(color.blue, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition28*10) : na, title="Sell Sym28", style=shape.xcross,
                 location=location.absolute, color=color.new(color.fuchsia, 50), size=size.small)                 
plotshape((showSellShapes == true) ? (sCondition29*5) : na, title="Sell Sym29", style=shape.xcross,
                 location=location.absolute, color=color.new(color.purple, 50), size=size.small)
plotshape((showSellShapes == true) ? (sCondition30*0) : na, title="Sell Sym30", style=shape.xcross,
                 location=location.absolute, color=color.new(color.maroon, 50), size=size.small)
           

// 

// plot candle entry/exit symbols
bColor := (showBuyCandles == true) ? color.new(bColor, 0) : color.new(bColor, 100)
plotchar(bCondition1, "Candle Entry", "L", location = location.belowbar, color=bColor, offset = 0, size = size.tiny, display = (showBuyCandles == true) ? display.all : display.none)

sColor := (showSellCandles == true) ? color.new(sColor, 0) : color.new(sColor, 100)
plotchar(sCondition1, "Candle Exit", "S", location = location.abovebar, color=sColor, offset = 0, size = size.tiny, display = (showSellCandles == true) ? display.all : display.none)

Overview

Strategy Scanner displays long and short signals using shapes, labels, and horizontal lines directly inside a separate pane. User settings configure the scanning timeframe, strategy model, preset or custom watchlists, marker colors, and individual webhook alert payloads. Designed primarily as a visual screener and alerting system, it does not manage live trading positions or enforce automated execution on its own.

Details

Published by

RobertAgee on GitHub

Code credit

CubanEmissary, as written in the script's header

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Screeners & dashboards, Moving averages, Oscillators & momentum

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

pinepinescriptscannertradingviewalgocryptoforexstocksstrategytrading

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Timeframetimeframetimeframe
StrategystringmyStrategymyStrategy
WatchliststringCustompreset
Show Symbol LabelsbooltrueshowLabels
Show Scanner LongsbooltrueshowBuyShapes
Show Scanner ShortsbooltrueshowSellShapes
Show Horizontal LinesbooltrueshowHLines
Show Long Candle MarkersboolfalseshowBuyCandles
Show Short Candle MarkersboolfalseshowSellCandles
Long Marker Colorcolorcolor.new(#00FF00, 0)bColor
Short Marker Colorcolorcolor.new(#FF0000, 0)sColor
Send Buy/Sell ListboolfalsesendList
Show all 40 settings
SettingTypeDefaultVariable
Send Individual Long AlertsboolfalsesendLong
Send Individual Short AlertsboolfalsesendShort
...................................Long Alert.................................. .....................Each Alert includetext"side" : "long", "orderType" : "market", "percentStake" : "2longMessage
...................................Short Alert................................. .....................Each Alert includetext"side" : "short", "orderType" : "market", "percentStake" : "shortMessage
Sym2stringGOOGsym2
Sym3stringAAPLsym3
Sym4stringJPMsym4
Sym5stringXAUUSDsym5
Sym6stringADMsym6
Sym7stringMsym7
Sym8stringMSTRsym8
Sym9stringGMEsym9
Sym10stringCSCOsym10
Sym11stringDOWsym11
Sym12stringPFEsym12
Sym13stringBTCUSDsym13
Sym14stringETHUSDsym14
Sym15stringXAGUSDsym15
Sym16stringMMMsym16
Sym17stringNFLXsym17
Sym18stringMSFTsym18
Sym19stringAMZNsym19
Sym20stringWIREsym20
Sym21stringLACsym21
Sym22stringSPsym22
Sym23stringSCHWsym23
Sym24stringTMOsym24
Sym25stringNEEsym25
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

218 stars

Multi-Timeframe Analysis Suite calculates trend direction and momentum conditions across five user-selected timeframes using moving averages, RSI, and Stochastic oscillators. It evaluates moving average slope and oscillator levels to compute trend alignment, m

Indicator v6 Screeners & dashboardsTrend
Updated 3 months ago · None stated GitHub repository of Multi-Timeframe Analysis Suite

KamaFama

by Mastaaa1987
141 stars

KamaFama is an indicator that translates a Freqtrade trading strategy into Pine Script for visualization. It combines Kaufman Adaptive Moving Average (KAMA), MAMA/FAMA calculations derived via Hilbert Transform, Williams %R, and correlation trend filters to ev

Indicator v6 Moving averagesOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of KamaFama
114 stars

Calculates normalized reversal metrics across up to ten Forex currency pairs using user-selected moving average methods, including HarmonicMA, EMA, SMA, or WMA. The indicator identifies overbought, oversold, and mean-crossing conditions using a configurable th

Indicator v4 Screeners & dashboardsMean reversion
Updated 1 year ago · None stated GitHub repository of Multi-Pair Trend Reversal Widget

Technical Ratings

by TWODS-CAPITAL
37 stars

This indicator scores price using moving averages, oscillators, or both, then maps the result to buy, sell, and neutral ratings. It compares several simple and exponential averages, a Hull average, a volume-weighted average, and Ichimoku lines with price, and

Indicator v5 Oscillators & momentumMoving averages
Updated 3 years ago · MIT GitHub repository of Technical Ratings

MTF WaveTrend Opportunity Hunter calculates multi-timeframe momentum and confluence scores using WaveTrend across custom Regime, Setup, Trigger, and Context timeframes. It plots a net confluence score histogram, multi-layer heat ribbons, an RRG-style Rotation

Indicator v6 TrendOscillators & momentum
Updated yesterday · MIT GitHub repository of MTF WaveTrend Opportunity Hunter [WavesUnchained]

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers