Scripts
Write your own indicators in the Pine Editor, put them on the chart, and keep them between sessions. Start with a topic below or search (Ctrl K).
Getting started
What you can buildWhat the script editor is for, what runs in it, and what does not.Your first scriptOpen the editor, run an example, change a setting, and save it.How a script runsOne bar at a time, oldest to newest, and why a script cannot peek ahead.
Writing scripts
Language basicsVariables, series history, conditions, loops, functions and operators.Inputs and settingsTurn numbers, switches, colours, timeframes and sessions into settings.Built-in series and functionsThe price series, ta, math, str, color and time functions you can call.Putting output on the chartplot, hline, fill, bgcolor, barcolor, shapes, arrows and your own candles.
Going further
Other timeframesUse a daily or hourly value on a lower-timeframe chart without repainting.ArraysKeep a list of values across bars, and call functions either way.Maps and matricesKey-value tables and grids of numbers, with matrix maths.Types and methodsDefine your own object types and call functions on them with dot syntax.EnumsA fixed set of named choices, usable as a dropdown setting.LibrariesSave functions, types and enums once and import them into other scripts.Labels, lines and boxesDraw text, lines, boxes and shaded areas at any bar and price.TablesPut a panel of text in a corner of the chart, with merged cells and tooltips.
Reference
Example scriptsThe ten examples that ship with the editor, and three short recipes.What it will not doFeatures that are refused or not supported, and why.Saving and restoringWhat is kept between runs of the app, and where.When something looks wrongFlat lines, missing bars, errors, and why a result differs from TradingView.What is builtEvery feature, and how far it has been checked.What's newWhat was added to the script editor, newest first.