Skip to content
ChartDeck ChartScript docs Account Open the terminal

Limits

Every ChartScript limit - per plan and per script - what it is for, and exactly what happens when a script reaches it.

ChartScript has limits so that every chart stays fast and one script can never freeze your browser or slow the service for others. Most scripts never come near them. This page lists each limit, why it exists, and what you see when you reach it.

#Limits by plan

ChartScript is on every plan. The language and the editor are the same everywhere; these limits differ by plan:

LimitBeginnerPlusProElite
ChartScript scriptsWrite your own indicators, import scripts and publish them to the Community31550250
Versions kept per scriptEvery save is a version; the oldest ones are pruned past this550200Unlimited
Script sizeThe code of one script. Comments and blank lines do not count256 KB1 MB2 MB2 MB
Script storageAll saved versions of your scripts together, compressed. When it is full, the oldest versions are removed first2 MB100 MB500 MB2 GB
Plots per scriptLines, histograms, shapes and other values one script draws on the chart128128128128
Labels, lines and boxes per scriptOf each kind. Past this the oldest ones are removed2501,0001,0001,000
Tables per script10505050
Bars per runHow many of the chart’s newest bars one script runs over (at most 2,000 on a phone)5,000 bars7,500 bars10,000 bars20,000 bars
Look-backHow many bars back one script can read a value5,000 bars7,500 bars10,000 bars10,000 bars
Extra timeframes and markets per scriptHow many other timeframes and markets one script can read. Past your plan's live-market limit they update when each bar closes204080128
Script screen: markets per screenRank the markets of a watchlist by one of your scripts. This is how many markets one screen runs; it refreshes by itself on Plus, Pro and Elite, and on Beginner when you press Refresh1050200500
Saved script screensScreens kept in your account: the script, its inputs, the watchlist, the timeframe and the columns131025
Volume at price in scriptsScripts read the volume traded at each price of a day, a week or a month, from recorded trades: point of control, value area and the profile itself. Every plan gets the previous day’s point of control and value areaNot includedIncludedIncludedIncluded
Protected script live updatesHow often a protected script from the Community updates on your chart while the bar is open. Every bar close is always shown1 / s2 / s3 / s4 / s

The rows of the table, in plain words:

  • Scripts: how many scripts you keep (3 on Beginner, 15 on Plus, 50 on Pro, 250 on Elite). Deleted scripts waiting in Recently deleted do not count.
  • Versions kept per script: older versions beyond this are removed when you save (5 / 50 / 200, and every version on Elite).
  • Script storage: how much room all your saved versions take together, after compression (2 MB on Beginner, 100 MB on Plus, 500 MB on Pro, 2 GB on Elite). Scripts are text and compress well: a script of 180 KB takes about 45 KB, so most members never come near it.
  • Bars per run: the most bars one run of a script can cover (5,000 on Beginner, 7,500 on Plus, 10,000 on Pro, 20,000 on Elite). A script runs on 5,000 bars unless it asks for another number with calc_bars_count; see Bars per run below.
  • Look-back: how far back from the current bar a script can read a value, such as close[100] (5,000 bars on Beginner, 7,500 on Plus, 10,000 on Pro and Elite). It is a different number from bars per run: on Elite a script can run over 20,000 bars, and on each of them it can read back up to 10,000.
  • Extra timeframes and markets per script: how many different other timeframes or markets one script may read with requests (20 / 40 / 80 / 128).
  • Script screens: a script screen runs one of your scripts over a watchlist: up to 10 / 50 / 200 / 500 markets per screen, 1 / 3 / 10 / 25 saved screens, and automatic refresh on Plus, Pro and Elite (at most every 5 / 2 / 1 minutes).
  • Volume at price: the vap functions read recorded volume at price on Plus, Pro and Elite. On Beginner they read na, and the legend says so.
  • Footprints: the fp values read the Footprint chart's data on Pro and Elite (on other plans na, and the legend says so), for about the newest 10,000 bars of each timeframe (42 pages of 240 bars). Older bars read na, never 0.
  • Big trades and liquidations on each bar: the chart's Big trades reach back as far as your plan's Big trades (15 minutes on Beginner, 24 hours on Plus, 30 days on Pro, 90 days on Elite), at most a month back from the newest bar; a signed-out visitor gets na. The liquidations on each bar are Pro and Elite, over the last 7 days (30 on Elite).
  • Protected script live updates: how often a protected Community script on your chart updates while the bar is open (1 / 2 / 3 / 4 times a second). Every bar close is always shown, on every plan.

Some caps depend on the plan too: the size of one script (256 KB of code on Beginner, 1 MB on Plus, 2 MB on Pro and Elite, where comments and blank lines do not count); labels, lines and boxes of each kind (250 on Beginner, 1,000 on the other plans); tables (10 on Beginner, 50 on the others); and the look-back (5,000 bars on Beginner, 7,500 on Plus, 10,000 on Pro and Elite; never more than the bars per run). 128 plots per script is the same on every plan. They are described below.

#What happens at each plan limit

#Number of scripts

When you are at the limit, creating a script (New, a template, an import or Make a copy) cannot be saved, and you see "Your plan keeps up to 3 scripts." (with your plan's number). Delete a script you no longer need, or upgrade. Restoring a script from Recently deleted also needs a free place.

#Versions per script

Nothing stops you saving. When a save takes a script past the limit, the oldest versions are removed, except the newest version and any version a saved layout or your open chart is kept on. See Saving and versions.

#Script storage

Every save is a version, and your versions are stored compressed. Your plan sets how much they may take together. My scripts shows it ("12.4 MB of 100 MB"), and the editor's History tab shows what each version of the open script takes.

When a save would go past your storage:

  1. The oldest versions are removed first, across all your scripts, to make room. The newest version of each script is never removed, nor a published version, nor a version that a saved layout, your open chart or an alert is kept on. The save message tells you how many were removed.
  2. If that is still not enough, the save is refused with "Your script storage is full (2 MB of 2 MB). Delete versions or scripts you no longer need." Open History and delete versions you no longer need, delete a script, or upgrade. A script in Recently deleted still takes room until its 30 days are over; Delete forever frees it at once.

Saving the same text twice (for example with Restore) takes no extra room.

#Bars per run

A script runs on its own history: the newest 5,000 bars of the chart's market and timeframe, or the number its indicator(...) line asks for with calc_bars_count. Your plan sets the most (its bars per run): 5,000 on Beginner, 7,500 on Plus, 10,000 on Pro and 20,000 on Elite. On a phone it is at most 2,000, to keep the chart responsive. A number above your plan's counts as your plan's.

ChartScriptOpen in editor
//@chartscript 1
indicator("Long-run average", { overlay: true, calc_bars_count: 10000 })
plot(ta.sma(close, 2000), "2,000-bar average", color.accent)
  • The chart does not load more bars for a script. It shows its usual bars, and ChartDeck fetches the older bars the script needs separately, for the script only.
  • Scrolling back past the run shows the older bars without the script's values, and the legend says "Script runs on the last 5000 bars" (with the number of chart bars the run covers). The run is never extended by scrolling: the values you see are always those of the same run.
  • First draw. When the chart already holds enough bars, the script draws at once. Otherwise it first draws over the bars in view, then once more over its whole run when those bars have arrived.
  • Requests load the span of the run in their own timeframe, plus the warm-up their expression needs. See How far back a request reaches.
  • On ChartDeck's servers (a protected script or a script alert) a script runs on exactly the same bars as on your chart: the same number, from the same first bar. The cap is the plan of the member viewing it or of the alert's owner (and of the script's author). So an alert and the chart give the same values.
  • Seconds, tick and range charts are built from recorded trades: there a script runs on the bars the chart holds.

Bars per run is not the look-back: that is how far back a script reads from each bar, at most 10,000.

#Extra timeframes and markets

Each distinct pair of market and timeframe that a script reads with request.tf, request.market or request.lower_tf is one context. Identical requests share one context.

  • When the compiler can count the contexts (fixed markets and timeframes), going over your plan's number is error CS3004: "This script uses 25 other timeframes or markets; your plan allows 20."
  • When the market or timeframe comes from a value worked out while the script runs, a context beyond the limit gives na and the script logs it once.

Other markets also count toward your plan's live markets and live streams, and a chart's own price feed always comes first. A request past those limits keeps its history but refreshes every minute instead of on every tick; a request of 1 hour or more on a market no chart streams is refreshed about every 30 seconds and needs no stream at all. request.live tells your script whether a context is live. See Other timeframes and markets.

#Script alerts

A script's conditions can become alerts that ChartDeck checks on its servers (Alerts). They have no count of their own: they share your plan's alerts total with every other alert (price, technical, watchlist and calendar), active or paused:

BeginnerPlusProElite
Alerts of every kind together102507002,500

They can use any timeframe your plan can chart, like every alert. With the total in use, creating one more says "Your plan allows 10 active alerts in total. Upgrade for more." (on Beginner; your plan's own number on the others) A once per bar alert on a script that is too slow for every live update is checked at bar close only. A script alert runs on the same bars per run as the script on your chart.

#Protected Community scripts

Protected scripts run on ChartDeck's servers. Your plan sets how often one updates on your chart within an open bar (1 to 4 times a second); bar closes always arrive at once. If a protected script costs a lot to run, it may switch to updating on bar close only, as your own scripts do (below). When the servers are busy, the legend says "Script servers busy, retrying…" and the chart tries again by itself, sooner on higher plans.

#ChartDeck data

A script reads ChartDeck data (open interest, funding, basis, long/short ratios, liquidations, CVD, ETF flows) as your plan reads it in the built-in studies:

BeginnerPlusProElite
History of the series (order-flow window)1 day30 days90 days365 days
oi.agg*, funding.agg_*, lsr.*, liq.*--yesyes
fp.* (footprints)--yesyes
flow.big_* (the chart's Big trades)yesyesyesyes
flow.agg_* (all-exchange flow)--yesyes
oi.ref* and Binance prints (flow.prints(..., "binance"))yesyesyesyes
etf.net_flow-yesyesyes
Data series loaded per script481616
  • Bars older than the window read na, and the legend says "history limited to 30 days on your plan".
  • A series your plan does not include reads na and the legend says "not included in your plan". The script still compiles and runs.
  • Each distinct source is one loaded series (open interest and OI delta are two; liq.long_usd and liq.short_usd are one; the six flow.agg_* are one; every fp.* value together is one; the three flow.big_* are one; liq.long_liq_usd and liq.short_liq_usd are one). flow.buy_vol, flow.sell_vol, flow.delta and flow.buy_share come from the bars and are not counted. Series read inside a request count once per requested market and timeframe. Past your plan's number, the extra series read na and the legend says how many were not loaded.
  • On a protected script or a script alert, the plan is that of the member viewing the chart, or of the alert's owner.

#Limits of every script

These are the same on every plan.

#Plots, inputs and alert conditions

LimitValueWhen you go over
Plots (lines, histograms, shapes and other plotted values)128CS3001 "A script can have at most 128 plots."
Inputs400CS3002
Alert conditions200CS3003

These are compile errors, so the editor shows them as you type.

#Labels, lines, boxes, polylines and tables

A script that creates drawing objects keeps only the most recent ones. By default that is 50 of each kind. You can raise it in your indicator(...) line:

ChartScriptOpen in editor
//@chartscript 1
indicator("Pivot labels", { overlay: true, max_labels_count: 300 })
const ph = ta.pivothigh(high, 5, 5)
if (!na(ph)) {
    label.new(
        bar_index - 5,
        ph,
        str.tostring(ph),
        { style: label.style_label_down, color: color.new(color.accent, 20), textcolor: color.white }
    )
}
KindDefaultMost you can ask for (Beginner)Most you can ask for (Plus, Pro, Elite)
Labels (max_labels_count)502501,000
Lines (max_lines_count)502501,000
Boxes (max_boxes_count)502501,000
Polylines (max_polylines_count)50250500
Tablesthe plan's cap1050

When a script creates one more object than its budget, the oldest of that kind is removed. There is no error: this is how a script keeps, say, the last 300 labels as the chart moves on. A number above the maximum is treated as the maximum.

A single table holds at most 2,000 cells and a single polyline at most 10,000 points; going past those stops the script with CS5103.

#Look-back (max_bars_back)

The look-back is how far back from the current bar a script reads; the bars per run are how many bars it runs over. Reading a value from the past, such as close[100], needs the script to keep that much history. By default it keeps 500 bars; indicator(..., { max_bars_back: 2000 }) or max_bars_back raises it, up to 10,000.

  • A value outside 1 to 10,000 is CS3005 "max_bars_back must be between 1 and 10000."
  • Reading further back than the script keeps stops it with CS5202, which names the value and suggests a max_bars_back that would be enough.
ChartScriptOpen in editor
//@chartscript 1
indicator("Change over 1,000 bars", { max_bars_back: 1500 })
const change = (close - close[1000]) / close[1000] * 100
plot(change, "Change %", color.accent)
hline(0, "Zero", color.muted)

#Time

Your own scripts run in your browser, and ChartDeck stops a script that takes too long, so that a slow script never freezes the chart.

RunTime allowedWhen it is too slow
The full run over every bar (when the script loads or its inputs change)2.5 seconds (5 seconds on a phone)Stops with CS5401
One live update of the open bar50 msStops with CS5402
A script that stops answering altogetherShut down with CS5404

Live updates have a gentler step first. One slow update (a busy moment on your device) only reloads the script. Two slow live updates in a row switch the script to updating when each bar closes, and the legend says "Updating on bar close only (too slow per tick)". The values at each bar close are exactly the same; you only lose the movement within the open bar.

Performance and Profiling show how to find and fix slow code.

#Loops

LimitValueWhen you go over
Passes of one loop on one bar100,000CS5301
Passes of all loops together on one bar1,000,000CS5303

A loop that never ends is almost always a bug; these limits turn it into a clear error instead of a frozen chart.

#Memory, collections and text

LimitValueWhen you go over
Elements in one array or matrix100,000CS5103
Entries in one map50,000CS5103
Length of a string while the script runs40,960 charactersCS5104
Length of a string written in the code40,960 charactersCS1023
Total memory the script usesa fixed budgetCS5403 "Stopped: the script used more memory than allowed."

The memory check happens twice: the compiler estimates how much state a script keeps (for example, many long histories) and reports CS5403 before it runs, and the runtime stops a script whose collections and text grow past the budget.

#Script size

LimitValueWhen you go over
Code in one script256 KB on Beginner, 1 MB on Plus, 2 MB on Pro and EliteThe save is refused: "The script has 2.3 MB of code; a script can hold up to 2 MB. Comments and blank lines do not count."
The whole text of one script, comments included5 MBThe save is refused: "The script is 5.2 MB; a script can be up to 5 MB with its comments."

What counts is its code: comments, blank lines and the spaces at the start and end of a line are free, so notes, a license header or commented-out experiments cost nothing. The editor shows it next to the script's name, for example "Code 212 KB of 2 MB", and turns it red when a script is too large to save. For scale, 2 MB of code is more than 40,000 lines; a very large indicator is about 150 KB.

If a script is too large, move shared code into a library or remove what you no longer use.

#Code size and shape

LimitValueWhen you go over
Length of a name64 charactersCS1026
Depth of nested expressions and blocks200 levelsCS1041
Errors reported in one compile100CS1038 "Too many errors; the rest of the script was not checked."

#Log messages

The Console keeps the last 200 lines. A single run records at most 200 log messages; more are dropped, so a log.info on every bar of a long chart shows only the first ones. Log only what you need, for example on barstate.islast or under a condition.

#Publishing limits

  • You can publish up to 5 new scripts a day.
  • A listing's name is 3 to 60 characters, its description up to 600 characters, with up to 5 tags picked from ChartDeck's fixed list of about 50.

See Publishing.

#When a script stops

When a runtime limit stops a script, it stops on that chart only: the chart, your other indicators and your other scripts keep working. The legend row shows the error, and with Preview on chart on, the editor's Console shows it with the line and the bar. Fix the code, save, and the script runs again.

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