How To Input CSV List Of Symbol Data Used For Screener
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © allanster

//@version=5
indicator("How To Input CSV List Of Symbol Data Used For Screener")

// Input CSV list using EXCHANGE:TICKER format for ticker IDs to be screened.
feed = input.text_area('COINBASE:BTCUSD,COINBASE:LTCUSD,COINBASE:LINKUSD', 'Feed',
 tooltip = '• Total ticker IDs cannot exceed 4.\n• Total characters cannot exceed 4096.' +
  '\n• Delimiters may use a space after comma but must use the chosen forrmat consistently.')

feed(back) =>                                             // extract tickerid and decrement list of ticker IDs
    loop  = back                                          // declare string variable to hold content list
    getT  = string(na)                                    // declare string variable to hold tickerid
    if str.length(loop) == 0                              // if list is empty
        getT := string(na)                                // assign na to tickerid variable
        loop := string(na)                                // assign na to list of ticker Ids variable
    else                                                  // else extract first tickerid
        getP  = nz(str.pos(loop, ','), str.length(loop))  // get position of first comma or last character
        getT := str.substring(loop, 0, getP)              // get tickerid in first position of list
        dlim  = 1                                         // if no space after delimiter set character size to 1
        if str.match(loop, ', ') == ', '                  // if space used after delimiter
            dlim := 2                                     // then set character size of delimiter to 2
        clrT  = str.substring(loop, 0, getP + dlim)       // get first tickerid + delimiter character(s)
        loop := str.replace(loop, clrT, '')               // clear tickerid + delimiter character(s) from list
    [getT, loop]                                          // return tickerid in first position & truncated list

[tid1, out1] = feed(feed)                                 // feed input list of ticker IDs
[tid2, out2] = feed(out1)                                 // feed decremented list
[tid3, out3] = feed(out2)                                 // feed decremented list
[tid4, out4] = feed(out3)                                 // feed decremented list
// [tidN, outN] = feed(outN-1)                            // can add more declared tuples up to N = 40 ticker IDs   

f_roc(_tidN) =>                                           // example screener function rate of change
    call = request.security(_tidN,
     timeframe.period, ta.roc(close, 1))                  // call expression rate of change for tickerid                       
    if str.length(_tidN) == 0                             // if tickerid is blank
        call := float(na)                                 // then overwrite result of call as float na
    call                                                  // return call result
        
sym1 = f_roc(tid1)                                        // screen tickerid 1
sym2 = f_roc(tid2)                                        // screen tickerid 2
sym3 = f_roc(tid3)                                        // screen tickerid 3
sym4 = f_roc(tid4)                                        // screen tickerid 4
// symN = f_roc(tkrN)                                     // can add more declared ticker IDs up to N = 40

plot(sym1, 'symbol1', #f79319)                          // plot rate of change for symbol 1
plot(sym2, 'symbol2', #c0c0c0)                          // plot rate of change for symbol 2
plot(sym3, 'symbol3', #2c61de)                          // plot rate of change for symbol 3
plot(sym4, 'symbol4', #ff00ff)                          // plot rate of change for symbol 4
// plot(symN, 'symbolN', #7f7f7f)                         // can add more plots up to N = 40