Tutorial

Pine Script Watchlist Table: Track Multiple Symbols

Build a multi-symbol watchlist table in Pine Script v6: tuple requests, RSI and trend columns, na guards, and how to stay under request limits.

•12 min read

You have a short list of markets you check every morning. Maybe it is five crypto pairs, maybe a handful of index ETFs. You flip between chart tabs, squint at the daily percent change on each, and by the third tab you have forgotten what the first one looked like. TradingView has a built-in watchlist panel, but it lives off to the side, and you cannot make it show the thing you actually care about, such as whether each symbol sits above its 50-period EMA or where its RSI is. A Pine Script table fixes that. It draws a small grid on your chart, and every cell can hold any value your script can compute, for any symbol you ask for.

This guide builds that grid from scratch. You will start with a five-symbol table showing price and daily change, then add columns for RSI and trend, then harden it against the two things that quietly break multi-symbol scripts: missing data and request limits. Every script is Pine Script v6 and complete, so you can paste each one into the Pine Editor and see the table appear.

How a Pine Script table works

A table is a drawing object, like a label or a box, but it is pinned to a corner or edge of the chart rather than to a price and a bar. You create it once with table.new(), giving it a position, a number of columns, and a number of rows. You then fill individual cells with table.cell(), passing the column index, the row index, and the text. Indices start at zero, so a table with 4 columns has columns 0 to 3.

Two habits matter right away. First, create the table with var, so Pine Script makes it on the first bar and reuses the same object on every later bar. Without var, the script would try to build a new table on every bar. Second, fill the cells only on the last bar, using barstate.islast. A table is a display, not a time series. Only the final state matters, and writing cells on every historical bar wastes execution time for no visible gain.

If you want the stats-dashboard version of this idea, where the cells hold performance figures rather than other symbols, the earlier guide on Pine Script table objects covers it. This post is about the multi-symbol case, which adds one new problem: getting data for symbols other than the one on your chart.

Getting data for other symbols

Your script can only see the symbol on the chart directly. For anything else it has to ask TradingView's servers through request.security(). You give it a symbol, a timeframe, and an expression, and it evaluates that expression in the context of that other symbol and hands the result back to your script.

The expression can be a single value, such as close, or a tuple in square brackets. Tuples are what make a watchlist efficient. If you want the last price and the previous close for one symbol, ask for [close, close[1]] in a single request instead of making two separate requests. Fewer requests means you stay further from the per-script request limit, which matters when your list grows.

There are two behaviors of request.security() that are worth knowing before you write a watchlist, because they decide whether your table is trustworthy. The first is lookahead. In v6 the default is barmerge.lookahead_off, which means a higher-timeframe value on a historical bar is only the value that was actually known at that point. For a watchlist that reads the last bar, this default is what you want. The longer explanation, and why switching it on makes indicators look better in hindsight than they ever were live, is in Pine Script lookahead explained. The second is the way a request resolves on the last, still-forming bar. On a realtime bar the requested close is the current price, so the table updates as the market moves, and it keeps updating with each new tick.

If you want the full mechanics of how the request is evaluated bar by bar, how request.security works in Pine Script goes through it. For a gentler introduction to pulling in one other symbol, see how to fetch data from another symbol.

A minimal five-symbol watchlist

The first script uses input.symbol() for each of five symbols, so you can change the list from the settings dialog without touching code. Each symbol is requested on the daily timeframe, which gives you today's price against yesterday's close.

pine
//@version=6
indicator("Watchlist Table", overlay = true)

sym1 = input.symbol("BINANCE:BTCUSDT", "Symbol 1")
sym2 = input.symbol("BINANCE:ETHUSDT", "Symbol 2")
sym3 = input.symbol("BINANCE:SOLUSDT", "Symbol 3")
sym4 = input.symbol("BINANCE:BNBUSDT", "Symbol 4")
sym5 = input.symbol("BINANCE:XRPUSDT", "Symbol 5")

getPrices(string sym) =>
    request.security(sym, "D", [close, close[1]])

var table watch = table.new(position.top_right, 3, 6, border_width = 1)

drawRow(int row, string sym, float c, float p) =>
    chg = (c - p) / p * 100
    clr = chg >= 0 ? color.new(color.green, 70) : color.new(color.red, 70)
    table.cell(watch, 0, row, array.last(str.split(sym, ":")), text_color = color.white, text_halign = text.align_left)
    table.cell(watch, 1, row, str.tostring(c, format.mintick), text_color = color.white)
    table.cell(watch, 2, row, str.tostring(chg, "#.##") + "%", text_color = color.white, bgcolor = clr)

[c1, p1] = getPrices(sym1)
[c2, p2] = getPrices(sym2)
[c3, p3] = getPrices(sym3)
[c4, p4] = getPrices(sym4)
[c5, p5] = getPrices(sym5)

if barstate.islast
    table.cell(watch, 0, 0, "Symbol", text_color = color.white, bgcolor = color.gray)
    table.cell(watch, 1, 0, "Price", text_color = color.white, bgcolor = color.gray)
    table.cell(watch, 2, 0, "1D %", text_color = color.white, bgcolor = color.gray)
    drawRow(1, sym1, c1, p1)
    drawRow(2, sym2, c2, p2)
    drawRow(3, sym3, c3, p3)
    drawRow(4, sym4, c4, p4)
    drawRow(5, sym5, c5, p5)

A few details in that script are doing real work. The request calls sit at the top level of the script, outside the if barstate.islast block. request.security() needs to run on every bar so that its internal history stays consistent, so you request everywhere and only draw on the last bar. The drawRow() helper avoids repeating the same three table.cell() lines five times, and it keeps the color logic in one place. Splitting the symbol string on the colon and taking the last piece turns BINANCE:BTCUSDT into BTCUSDT, which is the label you want to read.

The table has 6 rows because there is one header row and five symbols. If you change the number of symbols, change the row count in table.new() to match, or the extra rows will fail to draw.

Notice also that the cell text comes from str.tostring() with a format. format.mintick rounds the price to the minimum tick of the chart symbol, which is handy but can look odd when your list mixes a six-digit price with a four-decimal one. The percentage uses the "#.##" pattern to keep two decimals at most.

Adding RSI and a trend column

A price and a percent change are useful, but they are also what the built-in watchlist already gives you. The reason to build your own is to put your own logic into the grid. Suppose you want each row to show the 14-period RSI of that symbol and whether it is above or below its 50-period EMA.

You can add both to the tuple. Everything inside the brackets is calculated on the requested symbol's own data, so ta.rsi(close, 14) here is the RSI of that symbol, not of your chart symbol.

pine
//@version=6
indicator("Watchlist Table with RSI and Trend", overlay = true)

tf = input.timeframe("D", "Watchlist timeframe")
sym1 = input.symbol("BINANCE:BTCUSDT", "Symbol 1")
sym2 = input.symbol("BINANCE:ETHUSDT", "Symbol 2")
sym3 = input.symbol("BINANCE:SOLUSDT", "Symbol 3")
sym4 = input.symbol("BINANCE:BNBUSDT", "Symbol 4")
sym5 = input.symbol("BINANCE:XRPUSDT", "Symbol 5")

getData(string sym) =>
    request.security(sym, tf, [close, close[1], ta.rsi(close, 14), ta.ema(close, 50)])

var table watch = table.new(position.top_right, 5, 6, border_width = 1)

drawRow(int row, string sym, float c, float p, float rsi, float ema) =>
    bool valid = not na(c) and not na(p) and p != 0
    chg = valid ? (c - p) / p * 100 : na
    chgColor = na(chg) ? color.gray : chg >= 0 ? color.new(color.green, 70) : color.new(color.red, 70)
    trendText = na(ema) ? "n/a" : c > ema ? "Above EMA" : "Below EMA"
    rsiText = na(rsi) ? "n/a" : str.tostring(rsi, "#.#")
    table.cell(watch, 0, row, array.last(str.split(sym, ":")), text_color = color.white, text_halign = text.align_left)
    table.cell(watch, 1, row, na(c) ? "n/a" : str.tostring(c, format.mintick), text_color = color.white)
    table.cell(watch, 2, row, na(chg) ? "n/a" : str.tostring(chg, "#.##") + "%", text_color = color.white, bgcolor = chgColor)
    table.cell(watch, 3, row, rsiText, text_color = color.white)
    table.cell(watch, 4, row, trendText, text_color = color.white)

[c1, p1, r1, e1] = getData(sym1)
[c2, p2, r2, e2] = getData(sym2)
[c3, p3, r3, e3] = getData(sym3)
[c4, p4, r4, e4] = getData(sym4)
[c5, p5, r5, e5] = getData(sym5)

if barstate.islast
    table.cell(watch, 0, 0, "Symbol", text_color = color.white, bgcolor = color.gray)
    table.cell(watch, 1, 0, "Price", text_color = color.white, bgcolor = color.gray)
    table.cell(watch, 2, 0, "Change", text_color = color.white, bgcolor = color.gray)
    table.cell(watch, 3, 0, "RSI 14", text_color = color.white, bgcolor = color.gray)
    table.cell(watch, 4, 0, "Trend", text_color = color.white, bgcolor = color.gray)
    drawRow(1, sym1, c1, p1, r1, e1)
    drawRow(2, sym2, c2, p2, r2, e2)
    drawRow(3, sym3, c3, p3, r3, e3)
    drawRow(4, sym4, c4, p4, r4, e4)
    drawRow(5, sym5, c5, p5, r5, e5)

This version adds a timeframe input, so the same table can show hourly or four-hour data instead of daily. It also introduces the guard logic you need once the data is not guaranteed to be there, which is the next topic.

The trend column is a description of where price sits relative to a moving average right now. It is not a forecast, and you should not read it as a call to do anything. It is simply a compact way to scan a list and see which symbols are above their average and which are below.

When a cell comes back empty

Real watchlists break in a boring way. A symbol you typed does not exist on that exchange, or it has less history than your indicator needs, or the exchange had a gap in its data. In each case request.security() returns na, and Pine Script handles na by passing it silently through arithmetic. (c - p) / p * 100 with an na input gives na, and str.tostring(na) gives the text "NaN". Your table will show a row of "NaN" and nothing in the console will tell you why.

The second script guards against this with na() checks before any math or formatting, and it shows "n/a" as plain text instead. The percent change also checks that the previous close is not zero, to keep the division safe. If you want the full story on how na spreads through a script and the habits that stop it, how Pine Script handles na is the right companion read.

There is a related subtlety with the EMA. A 50-period EMA needs data to settle. On a symbol with only a few days of history, ta.ema(close, 50) is na for the early bars, but on the last bar of a long-listed symbol it is a real number. Because the table only draws the last bar's values, you rarely hit this unless you add a brand-new listing to the list, and the na check handles it when you do.

Request limits and how to stay under them

A script cannot make unlimited request.*() calls. TradingView caps the number of unique requests per script, and the cap depends on your account, so check the current figure in the Pine Script manual before you plan a long list. A unique request is a distinct combination of symbol, timeframe, and expression, which is why the tuple approach above pays off. Five symbols with four values each is five requests, not twenty.

Two habits keep you well under the cap. Put everything you need from one symbol into one tuple, and do not request the same symbol twice with different expressions if you can combine them. And keep the list short enough to read. A table of dozens of symbols is hard to read; in practice a watchlist table earns its place at around five to fifteen symbols, where one glance is enough.

Loading time is the other cost. Every request adds work, and a script with many requests can take noticeably longer to calculate on load. If your table feels slow, the first thing to try is reducing the number of values per symbol, then the number of symbols.

Making the table readable

Once the data is right, a few formatting choices decide whether the table is something you look at or something you hide. Position the table where it does not cover recent price action. Which corner is free depends on your symbol, so offer a position input and you can move the table without editing code.

Keep colors meaningful. Green and red backgrounds on the change column tell you direction at a glance, and a neutral gray for missing values stops an n/a cell from looking like a negative move. Use color.new(color, 70) for the backgrounds so the table stays subtle over the chart, and keep the text white or a theme-aware color so it stays legible on both light and dark charts.

Finally, set a text size that matches how many rows you have. text_size = size.small on each cell keeps a ten-row table compact. You can also pass size.auto, which lets TradingView choose based on the chart's scale.

Extending it with plain-English requests

Once the skeleton exists, most changes are small edits to the same pattern: a new column, a different indicator in the tuple, a conditional color, a sort order. Each is only a few lines, but in a 60-line script it is easy to change the tuple and forget to update the destructuring, or add a column and forget to widen the table in table.new().

This is where an AI editor earns its keep. In PineScripter you can describe a change, such as adding a 20-period ATR percentage column or turning the trend text into an arrow, and the AI edits only the lines that change while the Code Changes view shows exactly what moved. Every script it writes is checked for compile errors, and when one is found the AI fixes it itself, so you do not paste errors back and forth. If you are new to describing indicators this way, how to describe a complex indicator so the AI gets it right is a useful read. You can also run any script through the free Pine Script validator before pasting it into TradingView.

Common mistakes to avoid

Most watchlist bugs come from the same short list. Forgetting var on the table creates a new table on each bar. Filling cells outside barstate.islast slows the script and can hit drawing limits on long charts. Hard-coding the row count and then changing the symbol list leaves blank or missing rows. Requesting the same symbol several times instead of using a tuple burns through your request budget. And turning lookahead on to make historical values line up produces numbers that were not knowable at the time, which does not matter for a last-bar display but becomes a real problem the moment you reuse the same data in a plot or a condition.

If your table shows blank cells, check the symbol strings first. The format is EXCHANGE:TICKER, and a typo returns na with no warning.

Putting it together

A watchlist table is a small piece of Pine Script that does a lot of work for how often you will look at it. You create the table once with var, request each symbol with a tuple so your request count stays low, guard every value against na, and draw everything on the last bar. From there, each new column is one more value in the tuple and one more table.cell() call.

Build the five-symbol version first, confirm the numbers against the chart tabs you would otherwise flip through, and only then add columns. A table you trust at five symbols and three columns is worth more than a sprawling one you have to double check.

Disclaimer: PineScripter is a coding tool for Pine Script development. It does not provide financial advice and does not guarantee trading profits. Always backtest strategies thoroughly and understand the risks before live trading.

Frequently asked questions

How many symbols can a Pine Script watchlist table show?

The limit is the number of unique request.* calls a script may make, which depends on your TradingView account. Check the current figure in the Pine Script manual. Combining values into one tuple per symbol keeps the count low.

Why does my watchlist table show NaN or n/a?

request.security returned na, usually because the symbol string is wrong, the symbol has too little history, or data is missing. Check the EXCHANGE:TICKER format and guard values with na() before formatting them.

Why draw the table only on barstate.islast?

A table is a display, so only its final state matters. Writing cells on every historical bar adds execution time without changing what you see.

Can I change the symbols without editing the code?

Yes. Use input.symbol for each symbol and you can change the list from the script settings dialog.

Does a request on the daily timeframe update live?

On the last, still-forming bar the requested close is the current price, so the table updates as new ticks arrive.

Describe your indicator in plain English and get Pine Script that compiles →


Disclaimer: PineScripter is a coding tool for Pine Script development. It does not provide financial advice and does not guarantee trading profits. Always backtest strategies thoroughly and understand the risks before live trading.