Free: indicator teardowns, a repaint checker and open-source scripts. No buy/sell signals, ever.

Taught to TradeSystems over signals.

Explainers / Pine Script v5 to v6

Pine Script v5 to v6: what changes, what breaks, and what changes without telling you

Version 6 of Pine Script is mostly version 5 with stricter types and a few new defaults. The Pine Editor has a converter that rewrites most of it for you. The trouble is that the changes come in two kinds. Some stop the script compiling, so the editor points straight at them. Others compile cleanly and change what the script calculates, and nothing on screen says so. This page lists both, from TradingView's own migration guide, in plain English, with the usual fix.

How the converter works

Open the v5 script in the Pine Editor. When a newer version exists, the //@version=5 line is highlighted. The script's menu (the dropdown next to its name) has "Convert code to v6". Three things to know about it:

There is no official online converter outside the editor. A converter on another site is either the same idea done by someone else, or a chatbot. Either can produce code that compiles; neither can tell you whether the result calculates what the old script did. The second half of this page is why that matters.

Changes that stop a script compiling

These are the easy ones: the editor stops and shows you the line.

Changes that compile and quietly change results

These are the ones that matter. The converted script compiles, the chart draws, and the numbers are not the numbers the v5 script produced.

A checklist for a converted script

  1. Convert in the editor, fix whatever it highlights, and save under a new name so the v5 version stays on the chart beside it.
  2. Search the source for and and or . Any ta. call, [1] reference or var update on the right-hand side of one gets moved onto its own line above.
  3. For a strategy: note the v5 Strategy Tester summary, then run v6 once with margin_long = 0, margin_short = 0 and once without. If the first matches v5 and the second does not, the difference is margin, not a bug.
  4. Search for strategy.exit( calls that have both a limit or stop and a profit or loss. Decide which one the script meant.
  5. Search for timeframe.period == and any division of two whole-number constants.
  6. Put both versions on the same chart and compare the plots bar by bar on a few hundred bars. Matching lines are the only proof the conversion is faithful.

Where it fails

Educational only. Not financial advice. Nothing here is a recommendation to buy or sell anything, and nothing here says that a script which compiles, converts or matches its old version is correct or safe to trade. Pine Script and TradingView are products of TradingView, Inc.; this page describes their published language and migration guide in our own words and is not affiliated with them.

Also explained: Repaint checker, VWAP, Supertrend, RSI, UT Bot Alerts, Nadaraya-Watson Envelope, Squeeze Momentum, What is repainting on TradingView?, Is TradingView backtesting accurate?, Chandelier Exit, WaveTrend Oscillator, QQE MOD, Pivot highs and lows, Hull Suite, Range Filter, Twin Range Filter, HalfTrend, ZigZag++, SSL Hybrid, CM MacD Ultimate MTF, Volume Profile / Fixed Range, ADX and DI, Support Resistance Channels, Market Structure Break & Order Block, Order Block Finder, Pivot Point SuperTrend, Trendlines with Breaks [LuxAlgo], Divergence for Many Indicators, TradingView script selling terms, Support and Resistance Levels with Break, Liquidity Swings [LuxAlgo], Pine Script errors, Breakout Probability (Expo), Did ChatGPT or Claude write your Pine Sc, Lorentzian Classification, SuperTrend AI (Clustering), Machine Learning Adaptive SuperTrend, Dynamic Swing Anchored VWAP, Support and Resistance Power Channel by , Support and Resistance (High Volume Boxe, Trendline Breakouts With Targets by Char, Breakout Finder by LonesomeTheBlue, Volume Flow Indicator by LazyBear, FVG Order Blocks by BigBeluga, CM_Williams_Vix_Fix by ChrisMoody, Bollinger + RSI Double Strategy by Chart, Ultimate Moving Average MTF by ChrisMood, Fibonacci Bollinger Bands by Rashad, Candlestick Patterns Identified by repo3, MACD + SMA 200 Strategy by ChartArt, Moving Average Cross Alert, Multi-Timefr, WaveTrend Oscillator [WT] by LazyBear, WaveTrend with Crosses [LazyBear], CM_Price-Action-Bars by ChrisMoody, RSI Candles by glaz, CM RSI-2 Strategy Lower Indicator by Chr, CM Stochastic Multi-TimeFrame by ChrisMo, CM_Ultimate RSI Multi Time Frame by Chri, TonyUX EMA Scalper - Buy / Sell by tux, MACD 4C by vkno422, My Pine Script is valid. What did the va

Next steps

  • Get a script fixed. Compiles but behaves differently live, or changes after a reload? In a Pine Script Audit, an AI model reads every line and writes a report on what to fix for $49, or also fixes those problems for $149. It cannot prove a script is safe.
  • Check your own script. Paste its source into the free repaint checker. It runs in your browser and flags known patterns.
Before you trust its backtest: the Integrity Checklist, $19 one-offBack to Taught to Trade

No TradingView account yet? This affiliate link gives you a $15 coupon toward a paid plan, and we earn a commission if you buy one. The free plan is enough to follow this page.