> ## Documentation Index
> Fetch the complete documentation index at: https://docs.darvas.app/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> These docs cover the Darvas financial data API, its MCP server, data API and Darvas Pro+ webhooks, and Pine Script custom indicators for Darvas charts.
> https://docs.darvas.app/llms.txt lists every indexed page with a summary, and https://docs.darvas.app/llms-full.txt holds them in one file. Add .md to any page URL to read that page as Markdown. The lookup lists of tickers, types and series are named at https://docs.darvas.app/ai-agents.
> The docs MCP server https://docs.darvas.app/mcp searches and reads these docs. It needs no key.
> Call the REST API at https://api.darvas.app/v1. Send the API key, which starts with dvk_, in the X-API-KEY header or as Authorization: Bearer. The OpenAPI 3.1 spec of all 168 operations is https://docs.darvas.app/openapi.yaml.
> Name a company by ticker or cik. A share class takes a dot or a dash, so BRK.B and BRK-B name the same shares. Dates are YYYY-MM-DD.
> A list answer holds one page. Request its next_page_url as it is until the answer has none. limit counts rows across all pages.
> Errors are JSON with a stable error code and a message: 400 VALIDATION_ERROR, 401 UNAUTHORIZED, 403 PLAN_REQUIRED, 404 NOT_FOUND, 429 RATE_LIMITED or QUOTA_EXCEEDED, 500 INTERNAL_ERROR and 503 UNAVAILABLE. On a 429, wait the seconds in Retry-After. 1 credit = 1 successful call: a 2xx answer with data costs one credit however many rows it holds (at most 1,000 a page), and empty answers, errors and FINRA /short-volume cost 0 credits.
> The Financial Data MCP server is https://api.darvas.app/mcp (Streamable HTTP, protocol 2025-11-25, the same API key in X-API-KEY or as a Bearer token). tools/list answers 8 flagship tools plus search_data_tools and call_data_tool by default; ?mode=full lists all 164 tools and ?toolsets=sec,crypto,macro lists domains. Every tool is callable by name, takes response_format (json, compact or tsv) and fields, and a list answer's cursor value goes in the cursor argument. The darvas://catalog/* resources cost 0 credits. Setup for each client is at https://docs.darvas.app/mcp-server.
> The data API covers SEC filers and their filings, statements, XBRL facts, debt maturities, ownership and earnings, US stock prices, technicals and FINRA short volume, macro series and a global economic calendar.
> Its crypto data covers prices, indices, order books, order flow, volume profiles, derivatives, options, liquidations, spot ETF flows and a screener across 9 exchanges. It also covers DeFi protocols, stablecoins, yields and DEX pairs, and Polymarket, Kalshi and OKX prediction markets. https://docs.darvas.app/market-coverage gives the history and update time of each dataset.
> https://docs.darvas.app/ai-agents names the endpoint and the MCP tool that answer each kind of question about these datasets.
> Custom indicators for Darvas charts are Pine Script v5 or v6 indicator() or strategy() scripts. Darvas rewrites Pine v1 to v4 to v5 and runs no other indicator language. Start at https://docs.darvas.app/pine-script/introduction.
> https://docs.darvas.app/pine-script/support lists the Pine Script that Darvas runs. https://docs.darvas.app/pine-script/request-security covers request.security() and request.financial(), and https://docs.darvas.app/pine-script/limits lists the run limits.
> Darvas Pro+ webhooks send a signed POST for alarm fires and pauses, scheduled answers, economic calendar alerts, ETF flow updates, ended connections and the data API events. https://docs.darvas.app/pro/webhooks lists every event, its object and how to verify the Darvas-Signature header.

# Pine Script v5 & v6 Language Support Matrix

> Review every Pine Script v5 and v6 declaration, plot, drawing, strategy function and input Darvas supports, plus key differences from TradingView.

Darvas runs Pine Script with [PineTS](https://github.com/LuxAlgo/PineTS), an open-source Pine runtime, and draws the result the way TradingView draws it. This page lists what that covers.

## Versions

| Script | What Darvas does |
| - | - |
| `//@version=6` or `//@version=5` | Runs the script as written. |
| `//@version=1` to `//@version=4` | Rewrites the script to v5, then runs it. The rewrite changes namespaces, typed `input()` calls, `transp`, `iff()` and v3 color and style names, and keeps line numbers. The editor shows a note with the original version. |
| No `//@version` line, with `study(` | Reads the script as v1 and rewrites it. |

A rewrite is syntactic. Where a language rule changed between versions, compare the result with TradingView.

## Declarations

| Declaration | Support |
| - | - |
| `indicator()` | Runs. |
| `study()` | Runs as `indicator()`. `resolution=` becomes `timeframe=`. |
| `strategy()` | Runs. See [Strategies](#strategies). |
| `library()` and `import` | Refused with "Pine libraries are not supported yet". |

A script without an `indicator()` or `strategy()` declaration fails with an error.

## What the chart draws

* `plot()` with the styles `line`, `linebr`, `stepline`, `stepline_diamond`, `steplinebr`, `histogram`, `columns`, `area`, `areabr`, `circles` and `cross`, and the options `offset`, `show_last`, `trackprice`, `histbase`, `join`, `linestyle`, `format`, `precision`, `display` and `force_overlay`.
* `hline()`, `fill()` between plots or hlines, including gradient fills, `bgcolor()` and `barcolor()`.
* `plotshape()`, `plotchar()`, `plotarrow()`, `plotcandle()` and `plotbar()`.
* `label`, `line`, `box`, `linefill`, `polyline` and `table` drawings, with text, tooltips, arrows and `extend`.
* `display.none` hides a plot. `scale.left` and `scale.none` place the script on the left scale or on an unlabeled scale of its own.

A `plotchar()` with an empty character, a drawing with an `na` coordinate or color, a polyline with fewer than two points and an empty table draw nothing. When a run passes one of the [output caps](https://docs.darvas.app/pine-script/limits.md), Darvas leaves the extra items out and writes a warning to the editor's **Logs**.

## Strategies

A `strategy()` script runs, and Darvas places no orders.

* Simulated orders are arrows on the price chart, under the bar for a buy and over it for a sell. Blue marks a long entry, red a short entry and purple an exit. Each arrow shows the order id and the signed size, such as "Long +1".
* **Backtest** in the chart legend shows the net profit, closed and open trades, win rate, profit factor and max drawdown of the closed trades.
* Darvas does not show the Strategy Tester's other figures or its trade list.
* Strategy order alerts do not exist on Darvas, so `{{strategy.*}}` placeholders stay as written.

## Inputs

The inputs dialog has a field for each of these `input.*()` types.

| Type | Field |
| - | - |
| `input.int`, `input.float`, `input.price` | Number |
| `input.bool` | Switch |
| `input.color` | Color picker with an opacity field |
| `input.source`, `input.enum`, any input with `options` | List |
| `input.string` | Text |
| `input.text_area` | Multiline text |
| `input.time` | Date and time, in your local time |
| `input.timeframe` | List of Darvas timeframes and the chart's own |
| `input.session` | Session text, checked as `HHMM-HHMM` with optional weekdays |
| `input.symbol` | Text with suggestions from the chart's exchange |

Darvas applies these input options:

* `minval` and `maxval` limit the value.
* `step` sets the step of the number field.
* `group` puts inputs under a heading, and inputs that share an `inline` id sit on one row.
* `tooltip` adds an info button next to the input name.
* `confirm=true` opens the dialog when you add the indicator to a chart. Closing the dialog keeps the defaults.
* The dialog lists every input whatever its `display` says.

A value that no longer fits the script, such as an input the script removed, is skipped and does not fail the run.

## Logs

`log.info()`, `log.warning()` and `log.error()` write to **Logs** in the editor, with the bar each line came from. Only runs in the editor keep logs. Saved runs, alerts and community indicators keep none.

## Not supported

| Feature | What happens |
| - | - |
| `library()` and `import` | The script fails with "Pine libraries are not supported yet". |
| `ticker.renko`, `ticker.kagi`, `ticker.linebreak`, `ticker.pointfigure` | The script fails with a message that names the call. `ticker.heikinashi` works. |
| A variable named `range`, or `ta.sum` | The script fails, as it does on TradingView. Use `math.sum` instead of `ta.sum`. |
| The session `2400-0700` | Refused by the runtime. |
| A symbol Darvas does not list | `request.security()` stops the script. See [Other symbols and data](https://docs.darvas.app/pine-script/request-security.md). |

## Known differences from TradingView

* `x == (y == z)` loses its parentheses, so `barstate.isfirst == (bar_index == 0)` is false.
* `ta.supertrend` gives `na` as the direction on its warm-up bars, where TradingView gives 1.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.