Root causes
- A numeric value is used directly where Pine v6 requires a `bool`.
- A v5 script relied on implicit numeric-to-Boolean conversion before migration.
- A function returns `int`, `float`, or another type instead of the intended condition.
Make the `if` condition return an explicit Boolean value. Pine Script v6 does not implicitly convert numeric values to `bool`, so an integer returned by `ta.change(dayofmonth)` cannot control the block directly. Compare it with zero, use another Boolean expression, or apply the appropriate `na` test. Here, `change != 0` states the intended new-day condition without relying on legacy conversion.
This link opens the Pine Script AI Coding Agent overview. It does not run or change code on this page.
Before and after
Both artifacts include the version declaration and the code needed to inspect the stated problem. The diff lists the lines that change between them.
//@version=6
indicator("Boolean condition demo")
int change = ta.change(dayofmonth)
bool isNewDay = false
if change
isNewDay := true
plot(isNewDay ? 1 : 0)//@version=6
indicator("Boolean condition demo")
int change = ta.change(dayofmonth)
bool isNewDay = false
if change != 0
isNewDay := true
plot(isNewDay ? 1 : 0)--- broken.pine
+++ fixed.pine
@@
-if change
+if change != 0Continue with a guide that shares the same scope, type, history, or resource mechanism.
Compiler warning
Compilation error
Open the Coding Agent overview to paste editable Pine Script, explain the intended behavior, and request a review. Compile and test the result in TradingView before using it.
Paste your code to fix this error