Show more above No exchange, such as "ETHUSDT" The same coin on the chart's own venue. Another crypto exchange, such as COINBASE:BTCUSD, OKX:SOLUSDT, KUCOIN: or BITSTAMP: The same coin on the chart's own venue, with a notice such as "Using Binance data". Any other exchange, such as stocks, futures, forex, or ECONOMICS: No data: the script sees na and a notice names the request.
A .P perpetual suffix and a quote currency such as USDT, USDC, or USD
are ignored when matching. If the venue doesn't offer the market or can't
build the timeframe, a notice lists the data that isn't available and the
script sees no value (na) for it. If a request needs more than 20,000
candles, a notice says only the newest were loaded.
Company and economic data (request.financial, request.earnings,
request.dividends, request.splits, request.economic, and
request.quandl) isn't available. These calls return na, so anything built
on them draws nothing, and a notice names them.
+ Your own data in a script
+ request.data("key") returns a text value you stored under that key, such
+ as a day's options gamma exposure by strike, call and put walls, or any CSV,
+ JSON, or key-value text. The value is a string, so parse it with
+ str.split(), str.tonumber(), and the other string functions. The call
+ returns na when you have no value under that key.
+ pine theme={null}
+ //@version=6
+ indicator("Call Wall", overlay = true)
+ // Stored as "call:5900,put:5800"
+ raw = request.data("spx-walls")
+ 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.
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 Share a script for exactly what a
share shows and how to stop it.
Limits
Limit Value Pine scripts on one chart 4 Script length 64,000 characters Candles a script runs on 5,000 (fewer if the market has fewer) Inputs you can change 64 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
Show more below 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.
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