Pine Script Warnings
What is a warning?
Warnings are messages from the Pine compiler that highlight non‑critical issues, like unused variables, implicit type casts, or best‑practice suggestions. They do not stop your script from compiling or running.
Warning vs error
TradingView labels them differently in the Pine Editor:
- Warning (yellow): the script still compiles and still adds to the chart. Example: unused variable 'len' or this function is deprecated. Safe to ignore for now; you can ask HorizonAI to clean them up later.
- Error (red): the script will not compile. Example: undeclared identifier or mismatched input. Paste the exact message into HorizonAI and ask it to fix.
If you're not sure which you're looking at, try Add to chart. If it plots, it was a warning.
Common examples
- Unused variable or function
- Implicit type conversion
- Deprecated function notice (with a suggested alternative)
- Statement has no effect
What should you do?
- If your script compiles and adds to chart, you can proceed and ignore the warnings.
- If a warning later becomes an error after changes, tell HorizonAI: "fix the compile error" and paste the error message.
- For cleanliness, you can ask HorizonAI to "remove unused variables" or "update deprecated calls". This is optional.
When to act
- If you see an Error (not a Warning), the script won’t compile. Share that error with HorizonAI to fix.
- If a warning mentions deprecation with a deadline, consider updating, but you can still run the script today.
Bottom line: warnings are normal. If the script adds to the chart and behaves as expected, you’re good to go.