◆ New — Strategy Validator, Code Fixer & Prop Compliance Checker are live. Try one free →
Home / Pine errors / Types
Pine Script v6 error · Types

Pine Script v6 "Cannot call 'operator +' with argument of type 'series string'" — type-mismatch fix

The error
Add to Chart operation failed, reason: line N: Cannot call 'operator +' with argument of type 'series string'

This runtime type error means you tried to + a non-string value onto a string without converting it first — Pine's + does not auto-cast numbers to text. Educational content only; not financial advice and no profitability claim.

Why it happens

The + operator in Pine requires both operands to be the same type. When you concatenate a string with an int/float (or bool), one side ends up 'series string' and the other a number, and there is no implicit conversion, so the overload cannot be resolved. It usually surfaces when building label.new() text or an alert message like "RSI: " + rsiValue, where rsiValue is a float. The message often reports it as a 'series string' argument mismatch on the numeric side.

How to fix it

Wrap every non-string value in str.tostring() (optionally with a format string) before concatenating, so both sides of + are strings. For formatted output prefer str.format(). Gate any label/alert that fires a signal with `and barstate.isconfirmed` so it only draws on confirmed bars.

What triggers it

//@version=6
indicator("Type demo", overlay=true)
rsiValue = ta.rsi(close, 14)
labelText = "RSI: " + rsiValue
if barstate.islast
    label.new(bar_index, high, labelText)

The fix, in code

✓ Validated clean by our own engine

//@version=6
indicator("Type demo", overlay=true)
rsiValue = ta.rsi(close, 14)
labelText = "RSI: " + str.tostring(rsiValue, "#.##")
if barstate.islast and barstate.isconfirmed
    label.new(bar_index, high, labelText, style=label.style_label_down)

Related errors

Educational, code-correctness reference only — not financial advice. Trading involves substantial risk of loss.

Catch the bug that compiles.Run auditGet Pro