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

Taught to TradeSystems over signals.

Explainers / My Pine Script is valid. What did the va

My Pine Script is valid. What did the validator actually check?

Since November 2026 a chatbot connected to TradingView's own MCP server can call a tool named validate_pine_script, read the errors, change the code and call it again until the script is valid. TradingView's documentation describes exactly that loop: validate until valid, then run or backtest, then save if you ask. For anyone on a paid plan, "my script won't compile" is now a problem a chatbot fixes for free.

That is good news, and it moves the question. A valid script is one the compiler accepts. It is not a script that does what its name says, and it is not a backtest that could have happened. This page splits checking into three layers, says what each one sees, and says what only a chart shows.

Layer 1: the compiler (the validator and the Pine Editor)

What the documentation says the validator returns: a yes or no, a list of errors and a list of warnings. Each message carries a line and a column. Errors stop the script. The docs say plainly that warnings don't block running or saving.

What that layer catches:

What it does not try to catch: the words "repaint" and "lookahead" appear nowhere in the MCP documentation for the Pine tools (read 2026-12-04). That is not a flaw. A compiler checks that code is legal, not that its results could have been known at the time.

One practical point. A chatbot told to "fix the errors" stops when the error list is empty. The warnings are still there. Read them yourself.

Layer 2: pattern checks (linters)

A linter reads the source text and flags lines that look like known problems. Free, open-source ones exist for Pine. For example, the MIT-licensed pinescript-mcp has a repaint check whose rules cover:

Our own repaint checker does the same kind of thing in your browser.

The catch with any pattern check, human or machine, is that it has to know the safe form of each pattern. TradingView's own docs give the non-repainting way to read a higher timeframe as close[1] with lookahead_on. One free AI auditor's published sample report marks lookahead_on as critical and tells you to switch it off. Without the offset, lookahead_off repaints on the live bar. Same line of code, opposite advice. The documentation is the tie-breaker, not the tool.

Layer 3: what only a chart run shows

These are the problems that compile cleanly, pass a pattern check, and still make the script behave differently live than on history.

A timeframe input that is not a timeframe

Many popular multi-timeframe scripts take a timeframe input, fetch the price from that timeframe, and then compute the average on chart bars. A "50 on the weekly" from a daily chart then spans about 10 weeks, not 50. No line looks wrong. You see it by putting the script next to the same indicator built on the real higher timeframe. We have found this in more than one old script with tens of thousands of boosts (see Moving Average Cross Alert MTF).

History against live

On history, a script runs once per bar on final values. On the live bar it runs on every update. A marker built on the current bar's close can appear and vanish several times before the close. Nothing in the code is illegal. You see it by watching a few live bars on a short timeframe, or by comparing what the chart showed live with the same bars after a reload.

Fills a backtest assumes

strategy() defaults to zero commission and zero slippage. process_orders_on_close = true fills on the close of the bar that produced the signal. Both compile. Whether you could have been filled there is a question about your market, not the code. You see it in the List of Trades by comparing fills with the bar that signalled.

When an alert fires

An alert can fire on the first tick that makes a condition true, even if the bar closes the other way. The chart after the close may show no signal where you got an alert. You see it by setting the alert, letting it fire, and comparing with the chart afterwards.

What to do with a valid script

  1. Read the warnings, not only the errors.
  2. Run a pattern check, and check each flag against TradingView's documentation before you change anything.
  3. Do the chart checks above: the timeframe test for any MTF input, a few live bars, the List of Trades, one real alert.

The first two are free and fast. The third takes time, and it is the part we do in the Pine Script Audit below: line numbers, what happens, and how to see each issue on your own chart. The audit is written by an AI model working through a fixed checklist, and it says what it could not check.

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 passes these checks is correct or safe to trade. Pine Script and TradingView are products of TradingView, Inc. This page describes them in our own words and is not affiliated with TradingView or with any tool mentioned.

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, Pine Script v5 to v6, 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

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.