Skip to content
ChartDeck ChartScript docs Account Open the terminal

Next steps

Where to go after your first indicator - the reference manual, the official scripts you can read and copy, the starters, the tutorials and the Community.

You have written your first indicator. This page shows you where to learn the rest, in the order most people find useful: build things from the tutorials, look names up in the reference, and read real scripts that already work.

#Work through the tutorials

The tutorials in this section each build one complete, useful indicator and explain every part. They are in rough order of difficulty:

TutorialWhat it teaches
Moving average ribbonseveral plots, a fill, one color for a whole group
RSI divergence marksa pane of its own, levels, pivots, marks placed in the past
Volume spikeshistogram plots, averages of volume, alert conditions
Session high and lowstate variables, lines and labels you update as the bar moves
Multi-timeframe trendreading a higher timeframe, and what repainting is
Dashboard tablea table of values drawn once, on the last bar

Type each script yourself rather than pasting it if you can. Mistakes made while typing are the quickest way to meet the Problems tab and learn what its messages mean. Every error code has its own page that explains it; the full list is in Errors.

#Use the reference

The reference manual lists every built-in name: functions, variables and constants, with their parameters, defaults and a short example. It is grouped by namespace, the part before the dot: everything about technical analysis is under ta, text functions under str, drawings under line, label and so on. Names with no dot, such as plot or close, live on the namespace page of the same name when there is one, otherwise on global.

You rarely need to leave the editor to look something up:

  • Press F1 with the cursor on any name and the Reference tab opens on that name's card.
  • Hover over a name to see its signature.
  • Start typing and autocomplete offers the names that fit, with their parameters.
The editor's Reference tab showing the card for one built-in function

How to read a signature: ta.ema(source, length) means the function takes a series to average and a length. Parameters with a default, such as minval on input.int, can be left out; give them by name, in an options object at the end of the call, when you want them ({ minval: 1 }). When a page says a value must be "a constant or an input", it means the value cannot change from bar to bar: the series and qualifiers page explains why.

#Read the official scripts

ChartDeck's own built-in indicators have open ChartScript twins, the official scripts: from RSI, MACD and Bollinger Bands to Supertrend and Ichimoku cloud, and the indicators that draw on the chart, such as pivot points, session ranges, market structure, fair value gaps and volume profiles. Each one gives the same numbers, or draws the same lines, boxes and labels, as the built-in indicator, so they are a reliable place to see how real indicators are written.

To open one:

  1. Add the built-in indicator to a chart, for example RSI.
  2. Open its settings.
  3. Click View source.

The script opens in the editor read-only, marked "ChartDeck official". You can read it, scroll it and press F1 on any name in it. To change it, click Make a copy to edit: a copy goes into My scripts and opens as your own script, ready to change and save. The official scripts are open source under the MPL-2.0 license, and your copy keeps the license notice at the top, as that license requires.

Good ones to start with:

  • RSI and SMA: a few lines each; the smallest complete indicators.
  • MACD: three averages, a histogram whose color depends on whether it is growing or shrinking, and a zero line.
  • Donchian channels: highest high, lowest low and a fill between them.
  • Supertrend: state variables that carry state from bar to bar, and two plots that break where the trend flips.
  • Pivot points: levels from the previous day, week or month with request.tf, drawn as lines and labels that one period hands over to the next.
  • Market structure (BOS / CHoCH): swings from ta.pivothigh / ta.pivotlow, a user type for the latest unbroken swing, and lines and labels kept to the newest few.
  • Session ranges: local session times in three time zones, one box per session that grows bar by bar.
  • Zigzag: a user type with methods that reads the bars one at a time, and live state to keep work between the ticks of the live bar.
  • Market profile (TPO): periods built from request.lower_tf bars, the point of control and value area worked out with arrays on the newest bar, and the letters as one label per row.
  • Liquidation heatmap and Order book heatmap: ChartDeck's own data as heatmap.column values added to a heatmap, and legend keys with the palette's gradient.

All of them:

Official scriptDrawsShows
MACDvalues (plots)
Bollinger Bandsvalues (plots)
Supertrendvalues (plots)state
ADX / DMIvalues (plots)state
Heikin Ashi (smoothed)values (plots)state
Ichimoku cloudvalues (plots)functions
RSIvalues (plots)
EMAvalues (plots)
SMAvalues (plots)
Stoch RSIvalues (plots)
Moving averagevalues (plots)
Average true range (ATR)values (plots)
Squeeze momentumvalues (plots)
WaveTrendvalues (plots)
Keltner channelsvalues (plots)
Donchian channelsvalues (plots)
Parabolic SARvalues (plots)
Stochasticvalues (plots)
On-balance volume (OBV)values (plots)
Money flow index (MFI)values (plots)
CCIvalues (plots)
Chandelier exitvalues (plots)state
Chaikin money flow (CMF)values (plots)
Williams %Rvalues (plots)
Bollinger %Bvalues (plots)
Bollinger bandwidthvalues (plots)
Rate of change (ROC)values (plots)
Momentumvalues (plots)
Awesome oscillatorvalues (plots)
TRIXvalues (plots)
VWAPvalues (plots)functions, state
VWAP + deviation bandsvalues (plots)functions, state
Anchored VWAPvalues (plots) and drawings (polyline)user types, methods, functions, for…of, state
Fixed range volume profiledrawings (line, label, box)functions, for…of, state
Anchored volume profiledrawings (line, label, box)functions, for…of, state
Pivot pointsdrawings (line, label)higher timeframes (request.tf), user types, functions, for…of, state
Previous day / week / month levelsdrawings (line, label)higher timeframes (request.tf), user types, methods, functions, for…of, state
Session rangesdrawings (line, box)functions, for…of, state
Linear regression channeldrawings (line, linefill)state
Zigzagdrawings (line, label)higher timeframes (request.tf), user types, methods, functions, for…of, live state
Williams fractalsvalues (plots)
Market structure (BOS / CHoCH)drawings (line, label)user types, methods, state
Fair value gapsdrawings (box)user types, functions, for…of, state
Order blocksdrawings (box)user types, for…of, state
Liquidity sweepsdrawings (line, label)user types, methods, functions, for…of, state
Divergencesdrawings (line, label)user types, functions, state
Auto Fibonacci retracementdrawings (line, label, box)higher timeframes (request.tf), user types, methods, functions, for…of, state
Volumevalues (plots)state
CVDvalues (plots)
Volume deltavalues (plots)
Bar statisticsvalues (plots)state
Volume profile (approx.)drawings (line, label, box)functions, for…of, state
Open interestvalues (plots)
OI deltavalues (plots)
Aggregated open interestvalues (plots)
OI / price regimevalues (plots) and drawings (label, box)functions, for…of, state
Funding ratevalues (plots)
Aggregated fundingvalues (plots)
Perp/spot basisvalues (plots)
Coinbase premiumvalues (plots)
Long/short ratiovalues (plots)
Liquidationsvalues (plots)
ETF net flowsvalues (plots)
Market profile (TPO)drawings (line, label, box)lower timeframes (request.lower_tf), legend items, user types, functions, for…of, state
Large printsdrawings (label)trade prints (flow.prints), legend items, functions, for…of, state
Liquidation levelsdrawings (line, label)liquidation levels (liq.levels), legend items, user types, functions, for…of, state
Liquidation heatmapdrawings (heatmap)liquidation heat (liq.heat), legend items, functions, for…of, state
Order book heatmapdrawings (line, label, box, heatmap)the recorded order book (book.heat), legend items, functions, for…of, state

#Start from a starter

New in the editor offers a short list of starters: a blank overlay, a blank oscillator, an EMA cross with an alert, RSI with bands, an EMA ribbon, an up-bar streak counter and a price-level alert. Each is a small, working script. Starting from the nearest one is usually faster than starting from an empty page.

The New menu listing the starter scripts

#Learn the language properly

Once you have built two or three things, read the language section from the start. It is short, and it explains things the tutorials only touch on:

The concepts section covers each kind of output in detail: plots, fills, levels, text and shapes, drawings, tables and alerts.

When something does not do what you expect, Debugging shows how to print values to the Console tab, and the style guide helps keep a growing script readable.

#Learn from the Community

Members publish their own scripts to the Community. Open the Indicators dialog, choose Community and then the Scripts tab to browse them, sorted by trending, most liked, most discussed or newest.

  • An open-source script has a View source button: read it the same way as an official script, and use Make a copy to get your own copy. The author's license and a credit line come with it.
  • A protected script runs on your chart, but its author keeps the source hidden, so it cannot be viewed or copied.

Reading other people's scripts is one of the best ways to pick up idioms. Please respect each script's license, and read the community rules before you publish your own. When you are ready, Publishing walks you through it.

#One more small script

Here is a small script that uses several ideas from the tutorials at once. Paste it into the editor, then use F1 on each name you do not know yet.

ChartScriptOpen in editor
//@chartscript 1
indicator("Distance from average", { shorttitle: "Dist", overlay: false, precision: 2 })
const len = input.int(50, "Average length", { minval: 1 })
const avg = ta.ema(close, len)
const dist = (close - avg) / avg * 100
plot(dist, "Distance %", dist >= 0 ? color.up : color.down, { style: plot.style_columns })
hline(0, "Zero", color.muted)

It shows how far the close is from its 50-bar EMA, in percent, as green and red columns in a pane of its own.

The ChartScript documentation is in English for now; translations will follow.