Show more above parts = str.split(raw, ",")
callWall = parts.size() > 0 ? str.tonumber(str.replace(parts.get(0), "call:", "")) : na
plot(callWall, "Call Wall", color.green)
Store values from Script Data on the Scripts page
or push them from a program with the
Script Data API (PUT /v1/scripts/data/{key}). When a
value changes, charts and editor previews running a script that reads it
recalculate within a few seconds, without reloading the chart.
- The key must be a constant string in the script: 1 to 64 letters, digits,
dots, dashes, or underscores, starting with a letter or digit. A key from an
input or another variable is an error.
- A script can read up to 20 keys.
− - Values are yours alone. A script someone shares with you reads your
− values under its keys, never the author's, and the shared page lists the
− keys it reads.
+ - Values are private by default: a shared script reads your values under its
+ keys unless the author explicitly turns on Share Live Script Data for
+ selected keys on that share. The shared page lists which keys come from the
+ author and which read your own Script Data, and you can switch an added copy
+ back to your own Script Data anytime.
Strategies
A script declared with strategy() runs as a simulated backtest on the
Show more below chart's candles. On the trade chart, each simulated fill is marked on the
chart, up to the newest 300 fills.
The strategy's results are on the Scripts page, under the editor's preview
chart: Strategy Results, the Trades panel, and **Show Strategy
Report, which opens Net Profit, Closed Trades, Percent
Profitable, Profit Factor, Max Drawdown, Open Profit**, and a list
of the newest 500 closed trades. The totals count every trade. To test a
strategy on several markets or input values, see
Backtest a strategy.
[!WARNING]
Show more above - Otherwise the script uses the first version of that library you saved, and
the chart shows a notice naming the version it uses. Saving a newer version
later doesn't change which version an unchanged script uses; save the exact
version the import names, or delete the one in use, to change it.
Each save without a version number adds the next one (1, 2, 3, and so on).
Saving the same source again doesn't add a version. A version you already saved can't be replaced: delete it in **Manage
Libraries first. Manage Libraries** lists your saved libraries and
versions, and deletes the ones you no longer need. Deleting a version a
script on the chart uses asks you to confirm first. Scripts that use a library
update after you save or delete one.
Library limit Value Saved library versions per account 100
+ Library limit Value Library names per account, including deleted ones 1,000
Libraries one script can import, including libraries they import 16 Library name Letters, digits, and underscores, up to 64 characters, not starting with a digit Library length 64,000 characters
At 100 saved versions, delete one in Manage Libraries to save another.
+ A library name still counts after you delete all its versions, so its version
+ numbers are never reused. After 1,000 names, save new versions of a name you
+ already used.
Your scripts and privacy
Scripts pasted into the chart are saved in your chart layout on your account.
Show more Scripts saved on the Scripts page and your libraries are saved to your
account. Only your own scripts can import your libraries, and libraries are
never shared.
A saved script stays private unless you share it. A share link, a share code,
or a Public Library listing shows a frozen copy of one saved version's
source to other traders, credited to your public username. See
Share a script for exactly what a
share shows and how to stop it.
Limits
Limit Value Pine scripts on one chart 4
− Limit Value Script length 64,000 characters
+ Limit Value Script length (Scripts page / saved scripts) 256,000 characters Script length (pasted in chart settings) 64,000 characters
Candles a script runs on 5,000 (fewer if the market has fewer) Inputs you can change 64
Show more Time to run a script over its candles 20 seconds Other market and timeframe requests per script 8, up to 20,000 candles each Strategy fill markers Newest 300
Strategy report trade list Newest 500 closed trades request.data() keys per script 20
− A script longer than 64,000 characters shows an error naming the limit. A
− script exactly 64,000 characters long was probably cut off when it was
− pasted, and shows an error saying so.
+ Scripts saved on the Scripts Page can be up to 256,000
+ characters long (including when switched on for your trade charts). Scripts
+ pasted directly into a chart indicator's Settings field are limited to 64,000
+ characters; a script longer than the limit shows an error naming it, and a
+ chart-pasted script of exactly 64,000 characters was probably cut off when it
+ was pasted and shows an error saying so.
A script that takes longer than 20 seconds is stopped. Edit the script or its
inputs to run it again.
Show more below Limits for saved scripts, versions, sharing, and backtests are in
Scripts Page.
Why values can differ from TradingView
Most published scripts draw the same values as on TradingView. They can differ
when:
- The market data differs. The chart uses its own venue's candles. A
TradingView chart of another exchange, or of a spot market rather than the
perpetual, has different prices and volume. Compare against the same
venue's perpetual on TradingView, on the same timeframe.
- The script depends on where history starts. Scripts run over 5,000