TradingCharts

Expression Statement Has No Effect

An expression at script scope that doesn't do anything — a bare identifier, a bare arithmetic expression, a function call whose return is thrown away.

Common causes

1. Forgotten plot

ma = ta.sma(close, 20)
ma               // ⚠ likely meant plot(ma)

Add the visualisation:

plot(ma, "MA 20", color=color.aqua)

2. Trailing identifier used as a block return

Some scripts use a bare identifier at the end of a => block to mean "return this":

smooth(src, len) =>
    _ret = ta.ema(src, len)
    _ret

That's fine inside a function body — the trailing expression is the function's return. The warning fires only when the trailing expression sits at script scope, where there is nothing to return to.

3. Debug remnant

math.log(rsi)     // ⚠ leftover from testing

Remove or wrap in a log.info:

log.info("rsi=" + str.tostring(rsi) + ", log=" + str.tostring(math.log(rsi)))

Suppressing the warning

Assign the value to a _ convention name:

_debug = math.log(rsi)

The compiler does not treat _ names specially, but it does not warn on a plain assignment.