How to convert scripts to a newer Pine version
Scripts written in every Pine Script® version starting from v3 can be converted to the next version automatically using the converter available in the “Manage Script” menu:

In some cases, the code cannot be converted fully and requires manual changes. To learn how to manually fix these version-specific changes if necessary, consult the Migration Guides overview in our User Manual.
Also read: