Pine Script functions that don't exist, and what to use instead
AI-generated Pine Script snippets, old forum posts, and half-remembered docs sometimes call a function that sounds exactly like it should be real and isn't. This page checks the names people ask about most directly against TradingView's own Pine Script v6 language reference and names the real built-in to use instead of each. For the mechanism that turns any of these real functions' output into a live Autoview command, see Pine Script functions.
No bitwise namespace, in any form
math.bitwise_and(), math.bitwise_or(), math.bitwise_xor(), and math.bitwise_not() don't exist, and neither do short forms like band(), bor(), or bxor(). There's no bitwise namespace under math. at all in the v6 reference, and no bit-level operator anywhere in the language.
Use instead: nothing built-in fills this gap directly. If you're reaching for bitwise operations to pack several flags into one number, track each flag as its own bool or int variable instead.
No math.clamp()
math.clamp() doesn't exist.
Use instead: math.max(minVal, math.min(maxVal, value)). math.max() and math.min() are both real, and combining them constrains value to the [minVal, maxVal] range the same way a clamp function would.
clamped = math.max(0.0, math.min(100.0, rawValue))
No rma2, dema2, or tema2, numbered or not
ta.rma2(), ta.dema2(), and ta.tema2() don't exist. Neither do bare ta.dema() or ta.tema(), without the "2": Pine has no DEMA or TEMA built-in under any name.
Use instead for rma2: there's only one ta.rma(source, length), Wilder's smoothed moving average. It's what ta.rsi() and the standard ATR formula use internally. If you need two different smoothing lengths, call it twice with two different length arguments; there's no built-in that takes two lengths in one call.
Use instead for dema/tema: build them by hand from ta.ema(). DEMA doubles one EMA and subtracts an EMA-of-that-EMA; TEMA adds a third layer:
e1 = ta.ema(source, length)
e2 = ta.ema(e1, length)
dema = 2 * e1 - e2
e3 = ta.ema(e2, length)
tema = 3 * e1 - 3 * e2 + e3
No plotfill()
plotfill() doesn't exist. The real plot family is plot(), plotshape(), plotchar(), plotarrow(), plotbar(), and plotcandle().
Use instead: if what you actually want is a shaded region between two plots or hline()s, that's a separate function, fill(), not a plot*() variant:
upper = plot(ta.highest(high, 20))
lower = plot(ta.lowest(low, 20))
fill(upper, lower, color.new(color.blue, 90))
No ta.sum(), only math.sum()
ta.sum() doesn't exist. The sliding-sum function lives under the math. namespace, not ta..
Use instead: math.sum(source, length), which returns the sum of the last length values of source.
No ta.natr() for a normalized ATR
ta.natr() doesn't exist. Pine's only ATR built-in is ta.atr(length), Wilder's Average True Range, and it returns an absolute price value, not a percentage.
Use instead: normalize it yourself by dividing by the current close:
normalizedAtr = ta.atr(14) / close * 100
Two names that ARE real, if you're checking
Not every unusual-sounding name is fake. ta.percentrank(source, length) is a real built-in ("the percents of how many previous values was less than or equal to the current value"), as is its array counterpart array.percentrank(id, index). strategy.convert_to_account(value) is also real, converting a value from the chart symbol's currency into the strategy's own strategy.account_currency. The point isn't that anything unfamiliar is suspect, it's that the reference itself, not a guess, settles it either way.
If you're ever unsure whether a name you've seen in a snippet, a forum post, or an AI-written script is real, the Pine Script v6 language reference is the complete, current list. If a function isn't in it, it isn't part of the language, whatever a comment or a generated example claims.
A note on what Autoview is. Autoview is an execution tool, not a trading or investment advisor. It places the orders your script and alerts tell it to; it doesn't generate signals or make any claim about results. Trading carries risk of loss, and you're responsible for the strategy you automate. See our disclosures.