> ## 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 alert() & alertcondition() Alerts

> Get an in-app, push, Telegram or Pro+ webhook alert when a saved Pine Script indicator draws a new buy or sell mark, or fires alertcondition() or alert().

An indicator alert checks a saved Pine Script indicator at every candle close and notifies you when it draws a new mark or raises an alert.

## Requirements

* The indicator is saved. A draft is deleted when you close Darvas, and its alert would stop with it.
* The chart timeframe is 15 minutes or longer, on a market whose candles Darvas stores.
* Your plan has room for one more. Darvas Free has 1 indicator alert, Darvas Pro 5 and Darvas Pro+ 20, and each counts toward the plan's conditional alerts.

## Set an alert

1. Open the saved indicator in the editor, on the market and timeframe to watch.
2. In the **Darvas** tab, choose **Set alert**. The assistant also shows this card when your request asks for alerts.
3. Under **What sets off the alert**, choose one:
   * **Buy and sell marks**, then **BUY marks**, **SELL marks** or **All marks**.
   * One of the script's `alertcondition()` titles.
   * **Any alert() function call**.
4. Choose **Set alert**.

Manage the alert in the **Alerts** panel.

## What counts as a mark

A mark is a point of `plotshape()` or `plotchar()` whose value is not `false`, `na` or 0, or a label from `label.new()`. A `plotchar()` with an empty character does not count. Simulated strategy orders do not count.

Darvas reads a mark's direction in this order:

1. Words in its title or text: buy, long, bull, bullish or al for a buy, and sell, short, bear, bearish or sat for a sell. A mark with words of both kinds goes on to the next rule.
2. Its shape or label style: an up shape is a buy and a down shape is a sell.
3. Its place: below the bar is a buy and above the bar is a sell.

A mark with no direction matches only **All marks**.

```pine theme={null}
//@version=6
indicator("EMA cross marks", overlay=true)
fast = ta.ema(close, 9)
slow = ta.ema(close, 21)
plotshape(ta.crossover(fast, slow), "Buy", shape.triangleup, location.belowbar, color.green)
plotshape(ta.crossunder(fast, slow), "Sell", shape.triangledown, location.abovebar, color.red)
```

## alertcondition() and alert()

* The card lists each `alertcondition()` whose title is a constant string. A title in a variable is not listed.
* **Any alert() function call** fires on every bar where the script calls `alert()`.
* The notification carries the alert's message, or the condition's title when the message is empty. Darvas fills these placeholders in `alertcondition()` and `alert()` messages: `{{ticker}}`, `{{exchange}}`, `{{interval}}`, `{{open}}`, `{{high}}`, `{{low}}`, `{{close}}`, `{{volume}}`, `{{time}}`, `{{timenow}}`, `{{syminfo.currency}}`, `{{syminfo.basecurrency}}`, `{{plot_0}}` to `{{plot_19}}` and `{{plot("Title")}}`. Times are in UTC. `{{strategy.*}}` placeholders stay as written.
* Every frequency works as "once per bar close", because Darvas checks closed candles. A condition that is true only inside a candle, and false at its close, never fires.

## When Darvas checks

* Darvas runs the saved script shortly after each candle closes, on the same 1,000 candles a chart uses, and reads only closed candles.
* The first check only records the newest mark, so an alert never fires on history.
* A newer mark sends a notification in the app, as a push notification and on Telegram, if you connected it. The alert stays on after it fires.
* On Darvas Pro+, a [webhook](https://docs.darvas.app/pro/webhooks.md) that subscribes to `alarm.custom_indicator.triggered` receives each alert as a signed POST.

## When an alert pauses

Darvas turns an alert off in these cases:

* You can no longer run the indicator, for example because its author stopped sharing it.
* The script fails on 3 candle closes in a row.
* The script passes its 10 second run time or its memory on 10 candle closes in a row.

You then get a notice that names the alert, says why it stopped and what turns it back on.


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