Skip to content
ChartDeck ChartScript docs Account Open the terminal

Frequently asked questions

Answers to common ChartScript questions - plans and cost, privacy, repainting, na values, limits, phones, backtesting, selling and more.

#Getting started

#Is ChartScript free?

Yes. ChartScript is included on every plan, including the free Beginner plan: you can write, save, run and publish scripts without paying. Paid plans raise the limits, such as how many scripts you keep and how many bars a script runs on. You need to be signed in; visitors who are signed out cannot use scripts.

#Which plans include it, and what differs?

Beginner, Plus, Pro and Elite all include ChartScript with the same language and the same editor. The plans differ in how many scripts you keep, how many versions of each, how much storage your saved versions get, how many bars it runs on, how many other timeframes and markets one script can read, and how often protected Community scripts update. Limits has the full table.

#Do I need to know how to program?

No. Many useful indicators are a few lines long, and you can start from a template and change one thing at a time. The editor checks your code as you type, explains every built-in name (press F1), and offers fixes for common mistakes. The primer starts from zero.

#Is ChartScript JavaScript?

It looks like it, on purpose: const and let, braces around blocks, if (…) { … }, for (let i = 0; i < n; i++), &&, ||, !, template strings and // comments all work the way you expect. It is not JavaScript underneath, though. A script runs once on every bar, each name holds that bar's value with its history (close[1]), a missing value is na, conditions must be true or false (a number is not a condition), and there are no classes, callbacks or await. state keeps a value from one bar to the next. Variables and the execution model explain the differences.

#I wrote a script in the earlier syntax. Does it still work?

Yes. When you open it, the editor rewrites it in the current syntax and shows "Updated to the new ChartScript syntax"; the next save stores the new text, and Undo brings back the old one. In the rare case the rewrite is not possible, the script keeps its old text and still runs.

#Where do I find the editor?

Open Indicators in the top toolbar (or press /), go to the My scripts tab, and click New script, a template, or Edit on one of your scripts. Your first script walks through it.

#Can I see how ChartDeck's built-in indicators are written?

For many of them, yes. When a built-in indicator has an official ChartScript version, its settings dialog shows View source, which opens the code read-only in the editor. Make a copy puts a copy in your own scripts to change; it keeps its open-source license (MPL-2.0).

#Can I bring scripts over from another charting platform?

Yes. My scripts has an import button that converts a script and tells you what changed and what could not be converted. Start with the migration overview.

#Privacy and sharing

#Can other people see my code?

Not unless you choose to share it. Your scripts are private: only you can see them, edit them or run them.

If you publish a script, you pick whether its source is open (people who can use it can read and copy it under your license) or protected (people can add it to their charts, but never see the code). A protected script runs on ChartDeck's servers and their charts receive only the values to draw. See Publishing.

#Can I share a script with only a few people?

Yes: publish it Invite-only. It is not listed anywhere, and only the members you add by @handle or who use your invite link can see and add it. You can combine invite-only with open or protected source. See Visibility and protection.

#Can I sell my scripts?

Yes, if the script is invite-only (a public script can be added by anyone, so there is nothing to sell). You give each buyer access for a term: a month, three months, a year, for life, a custom date or a free trial. There are two ways to sell, and you can use either for each script:

  • In ChartDeck: connect your own Stripe account under Account → Selling & access and set monthly, yearly or lifetime prices. Buyers pay on the script's card, access follows the payment, and Stripe pays you directly. You are the seller: receipts, taxes, refunds and disputes are yours, in your Stripe Dashboard. ChartDeck takes no fee: you keep 100% of each sale, and only Stripe's own processing fees apply.
  • On your own site: keep selling where you already sell, and let buyers in with the vendor API or with single-use access codes.

See Selling access.

#What happens when an author removes my access to their script?

The script stays on your chart and in your layout, but it draws nothing and its legend row says "Locked – access removed by the author". You are told once. If the author lets you in again, it runs again. A script that was removed from the Community shows "Disabled – removed from the Community".

#How scripts behave

#Where does my script run? Will it slow my computer down?

Your own scripts run in your browser, in a sandbox beside the chart. That keeps them fast and private, but it also means a script's work is done by your device. ChartDeck protects the chart with time limits: a script that takes too long is stopped with a clear error, and one that is too slow on live updates switches to updating on bar close only. See Limits and Performance.

Because your scripts run in the browser, they run while ChartDeck is open. They do not keep running on a server when you close the tab.

#Why does my script give different values from the same indicator elsewhere?

Usually for one of these reasons:

  • Different data. Crypto prices differ from exchange to exchange, and so do candles, volumes and session times. Compare the same market on the same exchange.
  • A different starting point. A script runs on the most recent 5,000 bars, or the number its calc_bars_count asks for (up to your plan's bars per run). Indicators that depend on all earlier values, such as EMA and RSI, settle to the same values only after enough bars; the very first ones can differ.
  • Different conventions. ChartScript's ta.ema starts from a simple average of its first values, which matches ChartDeck's built-in EMA bar for bar. Other platforms may start differently.
  • Requests that do not repaint. By default, a value from a higher timeframe is the last closed value, never a value from the future. Some platforms show a developing value instead.

The known differences page lists every difference in detail.

#Does ChartScript repaint?

On historical bars a script sees each bar once, complete. On the open bar it runs again as prices change, so the newest value moves until the bar closes. That is normal for any live indicator. After the close, the value never changes.

If you want marks that never move, act only on closed bars with barstate.isconfirmed:

ChartScriptOpen in editor
//@chartscript 1
indicator("Closed-bar cross", { overlay: true })
const fast = ta.ema(close, 9)
const slow = ta.ema(close, 21)
const crossUp = ta.crossover(fast, slow) && barstate.isconfirmed
plot(fast, "Fast", color.aqua)
plot(slow, "Slow", color.orange)
plotshape(crossUp, "Cross up", shape.triangleup, location.belowbar, color.up)

Requests for other timeframes do not repaint by default. Repainting explains the whole picture.

#Why is my value na?

na means "no value". You will most often see it:

  • At the start of the chart, because a calculation needs more bars than exist so far. A 50-bar average has no value on the first 49 bars.
  • When reading the past beyond the first bar, such as close[10] on the fifth bar.
  • While another timeframe or market loads, or when a market you asked for does not exist.
  • When a calculation has no answer, such as a result too large to store.

A plot simply leaves a gap where its value is na. To use a fallback instead, wrap the value in nz, and to test for it use na (comparing with == na is always an error):

ChartScriptOpen in editor
//@chartscript 1
indicator("Change since 50 bars ago")
const past = close[50]
const change = na(past) ? 0.0 : (close - past) / past * 100
plot(change, "Change %", color.accent)
plot(nz(ta.sma(change, 20)), "Average", color.muted)

#How many plots can a script have?

128 on every plan. Labels, lines and boxes are separate: up to 1,000 of each and 50 tables (250 of each and 10 tables on Beginner). See Limits.

#Why does my script say "Updating on bar close only"?

Two live updates in a row took longer than 50 ms, so ChartDeck switched the script to update only when each bar closes, to keep your chart smooth. The values at each close are unchanged. Performance shows how to make a script faster.

#Can my script read other timeframes and other coins?

Yes, with request.tf for another timeframe of the same market and request.market for another market. How many different ones a script can read depends on your plan. See Other timeframes and markets.

#Can I use open interest, funding or order book data in a script?

Yes. A script reads ChartDeck's data as ordinary series, one value per bar: open interest (oi), funding (funding), the perpetual–spot basis and Coinbase premium (basis), taker buy and sell volume and CVD (flow) on every plan; US spot-ETF flows (etf) on Plus, Pro and Elite; and aggregated open interest and funding, long/short ratios (lsr) and liquidations (liq) on Pro and Elite. History follows your plan's order-flow window. The recorded order book (book) has history on Pro and Elite. See ChartDeck data and Order-book data.

#Trading, alerts and testing

#Can I backtest a strategy?

Not yet. Strategies, with simulated orders and backtest results, are not available. ChartScript is for indicators today. See Strategies.

#Can a script place orders?

No. A script only calculates and draws. It never places, changes or cancels an order.

#Can I get alerts from my script?

You can define alert conditions with alert.on, and the script's Style tab can show them on the chart as small markers ("Alert conditions", off by default). Create alert… on the script turns a condition, or any alert.send call, into an alert that ChartDeck checks on its servers while your browser is closed, with every notification channel of your plan. See Alerts.

#Devices and languages

#Can I use ChartScript on a phone?

Yes. Scripts run on phone charts (on at most 2,000 bars, to stay responsive), and you can open the editor. On a small screen it opens read-only so you do not change code by accident while scrolling; switch on Edit anyway to type, and use the row of extra keys for brackets and operators. Writing long scripts is easier on a computer.

#Is ChartScript available in my language?

The ChartDeck interface, including the editor's buttons and messages, follows your language setting. These docs are in English only for now; translations will follow later. The language itself uses English names (close, plot, ta.ema) in every language, so a script works the same for everyone. A script can also carry its own translations of its settings labels.

#Your scripts

#I deleted a script by mistake. Can I get it back?

Yes, within 30 days. Open Indicators > My scripts > Recently deleted and click Restore. Right after deleting, the Undo button in the message does the same.

#I broke my script. How do I go back?

Every save is a version. Open the History tab in the editor, use Compare to find the last good one, and Restore it; it becomes the newest version and nothing is lost. See Saving and versions.

#My script will not save. Why?

The most common reasons: it has errors (the Problems tab lists them), you already have a script with that name, you are at your plan's number of scripts, the script is too large (more than 256 KB of code on Beginner, 1 MB on Plus, 2 MB on Pro and Elite), or your script storage is full. Saving and versions lists each message and what to do.

#How large can a script be?

Up to 256 KB of code on Beginner, 1 MB on Plus, 2 MB on Pro and Elite. Comments and blank lines do not count, and the whole text with its comments can be up to 5 MB. The editor shows how much you have used next to the script's name ("Code 212 KB of 2 MB"). See Limits.

#What is script storage?

Every save keeps a version, stored compressed. Your plan sets how much all your versions may take together: 2 MB on Beginner, 100 MB on Plus, 500 MB on Pro and 2 GB on Elite. My scripts shows your usage. When it fills up, your oldest versions are removed first (never the newest version of a script, a published version, or one that a layout or an alert uses). You can also delete single versions in the editor's History tab. See Limits.

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