What PineScript actually is
PineScript is a domain-specific language that runs only inside TradingView. It is purpose-built for financial chart work — variables default to time series, the language is sandboxed (no network, no filesystem), and every script returns either an indicator you can overlay on the chart or a strategy you can backtest.
Compared with general-purpose languages like Python or JavaScript, Pine gives up a lot of flexibility in exchange for three things that matter on a chart: it understands close, high, low, open, volume without you defining them; it plots series with one line; and every change re-runs across the chart history instantly.
What PineScript isn't
It is not a general programming language. You cannot open a file, talk to a broker, or run Pine outside TradingView. Strategies backtest inside TradingView only — there is no live execution path from Pine itself. For live trading you wire an alert from Pine to your broker or to automation software.
Versions: Pine v5 vs v6
Pine v5 has been the stable default since 2021 and is what every example in this course uses. Pine v6 is the newer line with stronger type checking and a few syntax changes; if you start a script today, TradingView will default you into v5. v6 is fine to learn later — the data model and the indicator/strategy split are the same.
Opening the Pine Editor
From any chart, click Pine Editor at the bottom of the screen. The editor opens with a default template. Click Save, then Add to chart — your first custom script is now on the price chart. The output appears in a separate pane below the candles (for studies) or overlays the candles (for strategies with plot shapes).
The minimum viable script
The shortest Pine script is two lines:
//@version=5 plot(close)
//@version=5 is the version directive. plot(close) draws the closing price as a line. That is a complete, valid indicator.
What you'll build by the end of this course
By the time you finish Part 4, you will have written a complete trend-following system that signals entries, sizes positions by account risk, draws stops and targets on the chart, and fires alerts you can route to your broker or automation tool.