Cannot call "ta.ema" with argument "length"="len". An argument of "series int" type was used but a "simple int" is expected.
Calculate one average per length at the top level and choose between the results, or take the length from input.int().
Updated 23 October 2026. Runs in your browser; nothing you type is uploaded.
Try a worked example
My script, Pine v6 indicator
TradingView's compiler stops at line 4
Cannot call "ta.ema" with argument "length"="len". An argument of "series int" type was used but a "simple int" is expected.
Static checks, which read the code as written: Passes static repaint & Pine Script v6 checks. Edit the script and the compiler line goes; the checks below follow your edits.
Critical repaint flags
0
0 caution flags to verify
Bar-close gate
Not found
barstate.isconfirmed or a bar-close alert
Higher-timeframe calls
0
request.security() calls, of a 40 limit
Plots and alerts
1
Plots, of a 64 limit; 0 alerts
Repaint and lookahead
No lookahead leaks, unshifted request.security() calls or realtime-only signal branches found in this snippet.
Pine Script v6 migration checklist
Declares //@version=6, and none of the migration patterns this checker reads were found. TradingView's compiler is the final word.
Want TradingView indicators whose Pine Script v6 source already passes every check?
Every desk in Pine Pro Library ships as readable .pine v6 source with confirmed higher-timeframe requests and barstate.isconfirmed event logging.
What causes it
ta.ema() needs a length that is fixed from the first bar; a length worked out from bar values can change from bar to bar.
The fix, compiled
Calculate one average per length at the top level and choose between the results, or take the length from input.int().
//@version=6
indicator("My script")
len = close > open ? 10 : 20
ma = ta.ema(close, len)
plot(ma)//@version=6
indicator("My script")
e10 = ta.ema(close, 10)
e20 = ta.ema(close, 20)
ma = close > open ? e10 : e20
plot(ma)Types: na, series, simple and const
- Value with NA type cannot be assigned to a variable that was defined without type keyword
- Cannot call "alertcondition" with argument "message"="call "operator +" (series string)". An argument of "series string" type was used but a "const string" is expected.
Compiled on TradingView 23 October 2026. The checker above reads repaint and v6 migration patterns; TradingView's compiler is the final word on whether a script compiles.
Have your AI fix the next one
- Pine Fixer An AI skill pack for 45 compiler-verified Pine v6 failure classes, with a repaint clinic. $9.99 once.