# Chartnaut Docs > Chartnaut is a trading terminal: charts, scripting, replay and backtesting. These are its docs. Generated 2026-11-22T22:30:08Z. ## For coding agents: the Terminal SDK The Terminal SDK puts Chartnaut's terminal inside another app. Two npm packages: - `@chartnaut/charts`: the page side. `` and hooks from `@chartnaut/charts/react`, `createTerminal()` without React, `createMockTerminal()` from `@chartnaut/charts/testing` for tests. - `@chartnaut/node`: the server side. `frameRoute({ getUser })` answers the terminal's `/api/chartnaut/frame`; `new Chartnaut()` calls the partner API with `CHARTNAUT_SECRET_KEY`; `verifyRequest` checks webhooks. Start a project with `npm create @chartnaut/app my-app`, or `chartnaut init --project` in an existing one: both write a Test key to `.env.local` (never print or commit it). The secret key stays on the server. - [Overview](https://docs.chartnaut.com/sdk/overview/): what the SDK is and a two-file example - [Errors](https://docs.chartnaut.com/sdk/errors/): every error code (each error's `docs` link points here) and what to do - [llms-full.txt](https://docs.chartnaut.com/llms-full.txt): every page below in one file, with code - [partner-api.yaml](https://docs.chartnaut.com/openapi/partner-api.yaml): OpenAPI 3.1, Partner API (your server, @chartnaut/node) - [public-api.yaml](https://docs.chartnaut.com/openapi/public-api.yaml): OpenAPI 3.1, Public API (the CLI, the MCP server, developer apps) ## API reference Every operation of both HTTP APIs, generated from their OpenAPI files. ### Partner API - [Chartnaut Partner API](https://docs.chartnaut.com/api/partner/): base URL `https://api.chartnaut.com/partner/v1`, OpenAPI at https://docs.chartnaut.com/openapi/partner-api.yaml - [GET /users](https://docs.chartnaut.com/api/partner/list-users/): List your linked users - [POST /users](https://docs.chartnaut.com/api/partner/create-managed-user/): Create a managed user - [GET /users/{user}](https://docs.chartnaut.com/api/partner/get-user/): Read a linked user - [DELETE /users/{user}](https://docs.chartnaut.com/api/partner/delete-managed-user/): Delete a managed user - [PATCH /users/{user}](https://docs.chartnaut.com/api/partner/update-managed-user/): Change a managed user's level or features - [POST /users/{user}/export](https://docs.chartnaut.com/api/partner/export-managed-user/): Export a managed user's data - [GET /exports/{export}](https://docs.chartnaut.com/api/partner/get-export/): Read an export - [DELETE /users/{user}/connection](https://docs.chartnaut.com/api/partner/disconnect-user/): Unlink a user - [POST /users/{user}/frame-token](https://docs.chartnaut.com/api/partner/create-frame-token/): Get a frame URL for a user - [GET /users/{user}/alert-fires](https://docs.chartnaut.com/api/partner/list-alert-fires/): List a user's alert fires - [POST /links](https://docs.chartnaut.com/api/partner/create-link/): Make a link for one of your users - [GET /scripts](https://docs.chartnaut.com/api/partner/list-scripts/): The scripts published to an app - [POST /scripts](https://docs.chartnaut.com/api/partner/publish-script/): Publish one of your scripts to your app - [DELETE /scripts/{script}](https://docs.chartnaut.com/api/partner/unpublish-script/): Take a script off your app - [GET /sessions](https://docs.chartnaut.com/api/partner/list-sessions/): List your sessions, by user, label or status - [POST /sessions](https://docs.chartnaut.com/api/partner/create-session/): Create a backtest session for a user - [POST /sessions/batch](https://docs.chartnaut.com/api/partner/create-sessions/): Create up to 500 sessions in one call - [POST /sessions/actions](https://docs.chartnaut.com/api/partner/session-actions/): End, lock or unlock many sessions - [GET /sessions/{session}](https://docs.chartnaut.com/api/partner/get-session/): Read a session - [PATCH /sessions/{session}](https://docs.chartnaut.com/api/partner/update-session/): Change a session's labels or page control - [GET /sessions/{session}/trades](https://docs.chartnaut.com/api/partner/list-session-trades/): A session's closed trades - [GET /sessions/{session}/breaches](https://docs.chartnaut.com/api/partner/list-session-breaches/): A session's rule breaches - [GET /accounts](https://docs.chartnaut.com/api/partner/list-accounts/): List demo accounts you created, or a user's own accounts - [POST /accounts](https://docs.chartnaut.com/api/partner/create-account/): Create a demo account for a user - [POST /accounts/batch](https://docs.chartnaut.com/api/partner/create-accounts/): Create up to 500 demo accounts in one call - [POST /accounts/actions](https://docs.chartnaut.com/api/partner/account-actions/): Lock, unlock or close everything on many demo accounts - [GET /accounts/{account}](https://docs.chartnaut.com/api/partner/get-account/): Read an account - [PATCH /accounts/{account}](https://docs.chartnaut.com/api/partner/update-account/): Change a demo account's labels - [GET /accounts/{account}/trades](https://docs.chartnaut.com/api/partner/list-account-trades/): An account's closed trades - [GET /accounts/{account}/positions](https://docs.chartnaut.com/api/partner/list-account-positions/): A user's own account's open positions - [GET /accounts/{account}/breaches](https://docs.chartnaut.com/api/partner/list-account-breaches/): A demo account's rule breaches - [GET /webhooks/test](https://docs.chartnaut.com/api/partner/send-test-webhook/): Send a test.ping ### Public API - [Chartnaut API](https://docs.chartnaut.com/api/public/): base URL `https://api.chartnaut.com/v1`, OpenAPI at https://docs.chartnaut.com/openapi/public-api.yaml - [POST /auth/device](https://docs.chartnaut.com/api/public/start-device-login/): Start a browser sign-in - [POST /auth/token](https://docs.chartnaut.com/api/public/poll-device-login/): Finish a browser sign-in - [POST /auth/revoke](https://docs.chartnaut.com/api/public/revoke-current-key/): Revoke the key making this request (sign out) - [GET /scripts](https://docs.chartnaut.com/api/public/list-scripts/): List your scripts - [POST /scripts](https://docs.chartnaut.com/api/public/create-script/): Create a script and its first version - [POST /scripts/validate](https://docs.chartnaut.com/api/public/validate-script/): Lint and resolve a script without saving or running it - [GET /scripts/{slug}](https://docs.chartnaut.com/api/public/get-script/): Get a script (latest version, or slug@N) - [PUT /scripts/{slug}](https://docs.chartnaut.com/api/public/update-script/): Save a new version - [DELETE /scripts/{slug}](https://docs.chartnaut.com/api/public/delete-script/): Delete a script - [PATCH /scripts/{slug}](https://docs.chartnaut.com/api/public/update-script-metadata/): Rename or describe a script - [GET /scripts/{slug}/versions](https://docs.chartnaut.com/api/public/list-script-versions/): List versions, newest first - [GET /scripts/{slug}/events](https://docs.chartnaut.com/api/public/list-definition-events/): List a definition's events - [GET /scripts/{slug}/events/summary](https://docs.chartnaut.com/api/public/definition-events-summary/): Summarise a definition's events - [POST /scripts/{slug}/collect](https://docs.chartnaut.com/api/public/collect-definition/): Run a definition over history - [GET /runs](https://docs.chartnaut.com/api/public/list-runs/): List your runs, newest first - [POST /runs](https://docs.chartnaut.com/api/public/create-run/): Run a script on one instrument and window - [GET /runs/{run_id}](https://docs.chartnaut.com/api/public/get-run/): Get a run's status, progress and summary - [POST /runs/{run_id}/cancel](https://docs.chartnaut.com/api/public/cancel-run/): Cancel a queued or running run - [GET /runs/{run_id}/results](https://docs.chartnaut.com/api/public/get-run-results/): Get what the run produced - [GET /insights](https://docs.chartnaut.com/api/public/list-insights/): List your Forward Insights, newest change first - [POST /insights](https://docs.chartnaut.com/api/public/create-insight/): Put a study run on the chart as a Forward Insight - [GET /insights/{insight_id}](https://docs.chartnaut.com/api/public/get-insight/): Get one Forward Insight - [DELETE /insights/{insight_id}](https://docs.chartnaut.com/api/public/delete-insight/): Take an insight off your charts. The study and its runs are kept - [PATCH /insights/{insight_id}](https://docs.chartnaut.com/api/public/update-insight/): Rename an insight, change its description, or choose what a click on its events opens - [POST /insights/{insight_id}/activate](https://docs.chartnaut.com/api/public/activate-insight/): Make an insight active, so it shows on your charts of its definition, instrument and timeframe - [POST /insights/{insight_id}/deactivate](https://docs.chartnaut.com/api/public/deactivate-insight/): Stop an insight showing on your charts. It stays in your library - [GET /library](https://docs.chartnaut.com/api/public/search-library/): Search the scripts the caller can use. No source - [GET /library/{author}/{slug}](https://docs.chartnaut.com/api/public/get-library-script/): Describe one library script, with its interface and dependencies. No source - [POST /library/{author}/{slug}](https://docs.chartnaut.com/api/public/add-to-library/): Add another author's script to your library, with the scripts it needs - [DELETE /library/{author}/{slug}](https://docs.chartnaut.com/api/public/remove-from-library/): Remove a script you added from your library - [GET /library/{author}/{slug}/requirements](https://docs.chartnaut.com/api/public/get-library-requirements/): What adding a script to your library would add, and anything that stops it - [GET /instruments](https://docs.chartnaut.com/api/public/search-instruments/): Search instruments you can run on - [GET /datasets](https://docs.chartnaut.com/api/public/list-datasets/): List the reference datasets scripts can read - [GET /datasets/econ.calendar/codes](https://docs.chartnaut.com/api/public/search-calendar-codes/): Search economic calendar indicator codes - [GET /instruments/{symbol}](https://docs.chartnaut.com/api/public/get-instrument/): Get one instrument, including the coverage your plan can reach - [GET /timeframes](https://docs.chartnaut.com/api/public/list-timeframes/): List supported timeframes - [GET /me](https://docs.chartnaut.com/api/public/whoami/): Who this token belongs to, its scopes and the plan - [GET /usage](https://docs.chartnaut.com/api/public/get-usage/): Compute used this period, and every plan cap with its current count - [GET /webhooks](https://docs.chartnaut.com/api/public/list-webhooks/): List webhooks (not available yet, 501) - [POST /webhooks](https://docs.chartnaut.com/api/public/create-webhook/): Register a webhook (not available yet, 501) - [DELETE /webhooks/{webhook_id}](https://docs.chartnaut.com/api/public/delete-webhook/): Delete a webhook (not available yet, 501) - [GET /docs](https://docs.chartnaut.com/api/public/list-docs/): List scripting reference topics - [GET /docs/{topic}](https://docs.chartnaut.com/api/public/get-doc/): Get one reference topic as markdown - [GET /projects](https://docs.chartnaut.com/api/public/list-projects/): List your developer projects - [POST /projects](https://docs.chartnaut.com/api/public/create-project/): Create a developer project and its first Test key (the secret is shown once) - [GET /projects/{slug}](https://docs.chartnaut.com/api/public/get-project/): Get one project - [POST /projects/{slug}/keys](https://docs.chartnaut.com/api/public/create-project-key/): Mint a Test key (Live keys are only made in the browser: env "live" is 403 live_keys_browser_only) - [GET /projects/{slug}/sites](https://docs.chartnaut.com/api/public/list-project-sites/): List Test sites - [POST /projects/{slug}/sites](https://docs.chartnaut.com/api/public/add-project-site/): Add a Test site (Live sites are only added in the browser: 403 test_only) - [GET /projects/{slug}/quickstart](https://docs.chartnaut.com/api/public/get-project-quickstart/): What Test and Live still need, and the one CLI command - [GET /apps](https://docs.chartnaut.com/api/public/list-apps/): Old path of listProjects (deprecated) - [POST /apps](https://docs.chartnaut.com/api/public/create-app/): Old path of createProject (deprecated) - [GET /apps/{slug}](https://docs.chartnaut.com/api/public/get-app/): Old path of getProject (deprecated) - [POST /apps/{slug}/keys](https://docs.chartnaut.com/api/public/create-app-key/): Old path of createProjectKey (deprecated) - [GET /apps/{slug}/sites](https://docs.chartnaut.com/api/public/list-app-sites/): Old path of listProjectSites (deprecated) - [POST /apps/{slug}/sites](https://docs.chartnaut.com/api/public/add-app-site/): Old path of addProjectSite (deprecated) - [GET /apps/{slug}/quickstart](https://docs.chartnaut.com/api/public/get-app-quickstart/): Old path of getProjectQuickstart (deprecated) ## Terminal SDK Put Chartnaut's trading terminal inside your own app and drive it from your code. - [Overview](https://docs.chartnaut.com/sdk/overview/): Put Chartnaut's trading terminal inside your own app with @chartnaut/charts, and drive it from your code: charts, scripts, drawings, replay and orders. - [Getting started](https://docs.chartnaut.com/sdk/getting-started/): A working terminal on localhost in a few minutes: npm create @chartnaut/app, chartnaut init --project in an existing project folder, or by hand. - [React](https://docs.chartnaut.com/sdk/react/): The component, its props and events, and the hooks that turn the terminal's charts, scripts, replay and account into React state. - [The terminal object](https://docs.chartnaut.com/sdk/terminal/): createTerminal and the terminal it returns: ready and status, events with on, once and off, raw commands with send, can, apply, and dev mode. - [Layout and charts](https://docs.chartnaut.com/sdk/layout-and-charts/): Lay out up to 8 charts and panels, drive each chart by its id, link them, switch our interface off and match your colours. - [Scripts](https://docs.chartnaut.com/sdk/scripts/): Add indicators, definitions, insights and Pine scripts to a chart, read their values, react to their events and hold the replay on them. - [Drawings and overlays](https://docs.chartnaut.com/sdk/drawings-and-overlays/): Draw lines, zones, fibs, text and markers with the chart's own tools, hear the drawings your users make, and show your own data as overlays. - [Symbols and data](https://docs.chartnaut.com/sdk/symbols-and-data/): Search markets, read what a user may open, order sizes in lots, contracts or units, closed bars, live quotes, screenshots and watchlists. - [Replay, orders and the account](https://docs.chartnaut.com/sdk/replay-orders-account/): Drive a backtest from your code: play and step the replay, place orders by size or risk, move stops, close half, lock trading and read the account. - [Workspace and persist](https://docs.chartnaut.com/sdk/workspace-and-persist/): Where each user's layout, charts, scripts and drawings are kept: their browser, their Chartnaut account, your own database, or nowhere. - [Testing](https://docs.chartnaut.com/sdk/testing/): Test your app's terminal code without a terminal: createMockTerminal records every command, answers them, and emits events when your test says. - [Users](https://docs.chartnaut.com/sdk/users/): Who signs in to your terminal: linked users with their own Chartnaut account, or managed users you create on Business. frameRoute, cn.links, cn.users and cn.frames. - [Accounts](https://docs.chartnaut.com/sdk/accounts/): Demo accounts you create for challenges and live competitions, and the user's own broker accounts you can read: balances, open positions and closed trades. cn.accounts. - [Webhooks](https://docs.chartnaut.com/sdk/webhooks/): Hear on your server when a user links, a session ends or a rule breaks, and check each delivery's signature in one line with verifyRequest. - [Projects](https://docs.chartnaut.com/sdk/projects/): A project is what you set up on Chartnaut for something you build: Test and Live keys, the sites a terminal may open on, localhost in Test, View as, and what it takes to go live. - [Plans and limits](https://docs.chartnaut.com/sdk/plans-and-limits/): What Free, Pro and Business developer plans include, whose limit a refusal is (the user's or yours), and what happens at the cap. - [Errors](https://docs.chartnaut.com/sdk/errors/): Every error code the terminal and the partner API send, what each means and what to do about it. - [API reference and OpenAPI](https://docs.chartnaut.com/sdk/api-and-openapi/): The partner API behind @chartnaut/node and the public API behind the CLI, as OpenAPI 3.1 files you can download, generate clients from or hand to a coding agent. - [Changelog](https://docs.chartnaut.com/sdk/changelog/): What changed in each version of @chartnaut/charts and @chartnaut/node, and how the terminal tells you when your SDK is out of date. ## Get started What Chartnaut is, how the pieces fit, plans and the glossary. - [What Chartnaut is](https://docs.chartnaut.com/start/what-chartnaut-is/): Chartnaut is a trading terminal you can build into whatever you need: building blocks and agents that shape the charts and everything around them to how you trade. - [Ways to use Chartnaut](https://docs.chartnaut.com/start/ways-to-use-chartnaut/): Chartnaut Desktop, a web browser, the CLI and API, or an AI app over MCP: what each is for, what it needs, and why Desktop is the one to install. - [Chartnaut Desktop](https://docs.chartnaut.com/start/chartnaut-desktop/): Why Chartnaut recommends the desktop app, and how to install, sign in, update and remove it on Windows. - [Chartnaut in your browser](https://docs.chartnaut.com/start/chartnaut-in-your-browser/): Use Chartnaut at terminal.chartnaut.com with nothing to install, and what needs Chartnaut Desktop instead. - [For developers](https://docs.chartnaut.com/start/for-developers/): The Chartnaut CLI, the API and coding agents: where to start with each. - [How the pieces fit](https://docs.chartnaut.com/start/how-the-pieces-fit/): How Chartnaut turns a trading hunch into an answer: indicators and definitions find the setup, a study measures it, a Forward Insight brings it to your chart, and your own trades complete the picture. - [How to get the most out of Chartnaut](https://docs.chartnaut.com/start/get-the-most-out-of-chartnaut/): Six workflows that make Chartnaut worth using, and where to start each one. - [Plans](https://docs.chartnaut.com/start/plans/): Compare Free and Pro: price, live accounts and the 14-day live trial, history, options data, research limits, add-ons and the CLI, MCP and API. - [Glossary](https://docs.chartnaut.com/start/glossary/): Every Chartnaut term in one line, grouped by where you meet it. - [Keyboard shortcuts](https://docs.chartnaut.com/start/keyboard-shortcuts/): Search with ⌘K and move around Chartnaut with single keys. ## Using Chartnaut Every part of the app, in the order of the app's sidebar. - [Set up Charts for how you trade](https://docs.chartnaut.com/guides/set-up-charts/): Build your own chartbook: charts and panels side by side, your indicators on them and a theme you like. - [Connect a broker and place your first trade](https://docs.chartnaut.com/guides/connect-and-place-a-trade/): Connect MetaTrader, cTrader, TradeLocker or Chartnaut Demo, map your symbols, place a trade from the chart and find it in Trades and the Journal. - [Test your first trading idea](https://docs.chartnaut.com/guides/test-your-first-trading-idea/): Hand one trading idea to the agent: it finds every time it happened in two years of history, measures what came next, and puts the answer on your chart. - [Turn your trades into a playbook](https://docs.chartnaut.com/guides/turn-your-trades-into-a-playbook/): Create a BTC opening range playbook, set its R-levels and tags, file your trades into it, read its reports and see what Historical Intelligence needs. - [Backtest on random days](https://docs.chartnaut.com/guides/backtest-on-random-days/): Trade a week of BTC from a random Monday in Replay, log each trade into your playbook as you take it, and file the rest afterwards. - [Add your first view](https://docs.chartnaut.com/guides/add-your-first-view/): Build a view with the agent that shows how far price ran after you exited, in R, then publish it to every trade, change it and take it off. - [Build your own indicator](https://docs.chartnaut.com/guides/build-your-own-indicator/): Describe a session VWAP with standard deviation bands to the agent, check it on the chart, save it and add it to Charts. - [Build your first app](https://docs.chartnaut.com/guides/build-your-first-app/): Build a pre-market briefing with the agent, test it against the chart, publish it and open it from Tools → Apps. - [How Charts works](https://docs.chartnaut.com/guides/how-charts-works/): Real-time and replay, panels side by side, chartbooks, what a chart shows, trading from the chart and what your plan allows. - [Chartbooks](https://docs.chartnaut.com/guides/chartbooks/): Save a Charts layout as a chartbook, keep variations with Duplicate, and switch between them from one menu. - [Panels](https://docs.chartnaut.com/guides/panels/): Add charts and tools to your layout, split them where you want, and move, resize or remove them. - [Chart types](https://docs.chartnaut.com/guides/chart-types/): Every chart type, how to pair a profile with price, and where each type's settings live. - [Indicators on the chart](https://docs.chartnaut.com/guides/indicators-on-the-chart/): Add an indicator to one chart or several, change its settings, and hide or remove it from the legend. - [Definitions on the chart](https://docs.chartnaut.com/guides/definitions-on-the-chart/): Add a definition to a chart, choose its profile and events, and read the marks it draws. - [Forward Insights on the chart](https://docs.chartnaut.com/guides/forward-insights-on-the-chart/): Make a Forward Insight active on a definition and the latest setup shows its answer by itself. Choosing one, the limit per plan, replays, and what each message means. - [Drawing tools](https://docs.chartnaut.com/guides/drawing-tools/): Every drawing tool on the rail, how to edit, lock and clear drawings, and where they are saved. - [Replay](https://docs.chartnaut.com/guides/replay/): Open a backtest session in Charts, control playback from the replay bar, and trade history bar by bar. - [Trading from the chart](https://docs.chartnaut.com/guides/trading-from-the-chart/): Pick an account, place a draft from the trade bar or the Position Manager, confirm it on the chart, and manage it. - [Chart Settings and themes](https://docs.chartnaut.com/guides/chart-settings-and-themes/): Pick a theme and set colours, grid, crosshair, numbers and trade drawing for a chartbook, then save them as a template. - [Market data](https://docs.chartnaut.com/guides/market-data/): Find an instrument, read the Live, Slow and Offline status, and what to do when data stalls or a source goes down. - [Options levels on the chart](https://docs.chartnaut.com/guides/options-levels-on-the-chart/): Add the Options levels indicator to SP500: the call wall, put wall, gamma flip, absolute gamma strike, expected move and gamma profile, and what each setting does. - [Options calendar](https://docs.chartnaut.com/guides/options-calendar/): Mark monthly options expiration, quad witching, VIX expiration and quarter-end on any chart, with the next 45 days ahead. - [How options levels are calculated](https://docs.chartnaut.com/guides/how-options-levels-are-calculated/): The data behind Chartnaut's options levels, when they change, how each level is worked out, the dealer sign assumption and why another vendor's levels can differ. - [Research with options levels](https://docs.chartnaut.com/guides/research-with-options-levels/): Use the call wall, put wall and gamma flip in your own indicators, definitions, studies and backtests, with scripts you can paste. - [How accounts work](https://docs.chartnaut.com/guides/how-accounts-work/): MetaTrader, cTrader, TradeLocker and Chartnaut Demo accounts, live slots per plan, pausing, symbol mapping, history import and what each status means. - [14-day live trial](https://docs.chartnaut.com/guides/live-trial/): Trade one cTrader or TradeLocker account live on Free for 14 days, once. What happens on day 14, and how to keep the account with Pro. - [Connect MetaTrader](https://docs.chartnaut.com/guides/connect-metatrader/): Connect an MT4 or MT5 login with its server, import your past trades and fix a failed connection. - [Connect cTrader](https://docs.chartnaut.com/guides/connect-ctrader/): Sign in with your cTrader ID, pick which accounts to trade, import your past trades and re-authorize when access expires. - [Connect TradeLocker](https://docs.chartnaut.com/guides/connect-tradelocker/): Log in with your TradeLocker email, password and server, pick which accounts to trade, and fix a login that stopped working. - [Connect Chartnaut Demo](https://docs.chartnaut.com/guides/connect-chartnaut-demo/): Open a virtual-money account that trades live prices, with the label, leverage and starting balance you choose. - [Symbol mapping](https://docs.chartnaut.com/guides/symbol-mapping/): Link your broker's symbols to Chartnaut instruments during an import, from the trade bar, or on an unmapped trade. - [History import](https://docs.chartnaut.com/guides/history-import/): Bring a MetaTrader, cTrader or TradeLocker account's closed trades, open positions and pending orders into Chartnaut, and re-sync later. - [Manage an account](https://docs.chartnaut.com/guides/manage-an-account/): An account's own tabs and reports, and how to rename, pause, reconnect or delete it. - [How your trades are recorded](https://docs.chartnaut.com/guides/how-your-trades-are-recorded/): Where trades come from, what Chartnaut saves with each one, and how the dashboard, journal and trades library fit together. - [Dashboard](https://docs.chartnaut.com/guides/dashboard/): The page Chartnaut opens on: your stats for a period, a calendar per account, and dashboards of your own apps. - [Trades library](https://docs.chartnaut.com/guides/trades-library/): Find any trade by asking for it or by filtering, and choose how trades are shown and sorted. - [Trade detail](https://docs.chartnaut.com/guides/trade-detail/): Everything on one trade: details, P&L path, playbook, tags, properties, notes, snapshots and fills. - [Snapshots and replay](https://docs.chartnaut.com/guides/snapshots-and-replay/): See your charts at entry and exit, step back into the trade on its chart, and export it as a video. - [Daily journal](https://docs.chartnaut.com/guides/daily-journal/): One page per trading day with its P&L, trades and orders beside what you wrote about it. - [Notes, tags and templates](https://docs.chartnaut.com/guides/notes-tags-and-templates/): Write notes on a trade, reuse note templates, tag trades from their playbook and add your own properties. - [AI trade search](https://docs.chartnaut.com/guides/ai-trade-search/): Ask about your trades in plain words, get the matching trades back and apply them to Trades. - [Pinned collections](https://docs.chartnaut.com/guides/pinned-collections/): Sets of trades kept from trade studies, to open in Trades or study again. - [Sharing a trade](https://docs.chartnaut.com/guides/sharing-a-trade/): Save a trade as a styled image card or an MP4 video of it playing out on its chart. - [How playbooks work](https://docs.chartnaut.com/guides/how-playbooks-work/): What a playbook holds, how R-levels and tags work, how trades get into it, its reports, and what Historical Intelligence needs to train. - [Create a playbook](https://docs.chartnaut.com/guides/create-a-playbook/): Create a playbook with its name, colour and three R-level targets, then write its entry rule. - [Tags and criteria](https://docs.chartnaut.com/guides/tags-and-criteria/): Add checkbox and group tags to a playbook, tick them on trades from the chart or afterwards, and see which ones matter. - [Playbook reports](https://docs.chartnaut.com/guides/playbook-reports/): What each playbook report shows, how to run a Monte Carlo simulation and how to add your own report. - [Historical Intelligence](https://docs.chartnaut.com/guides/historical-intelligence/): Train a model on a playbook's tagged trades for one instrument, read its performance and see the odds of each R-level as you trade. - [How backtesting works](https://docs.chartnaut.com/guides/how-backtesting-works/): Trade past market data bar by bar: how sessions differ from Chartnaut Demo, how to set one up, random dates, reports and where the trades go. - [Start a session](https://docs.chartnaut.com/guides/start-a-session/): Set up a backtest in Quickstart, add margin, costs, slippage and risk rules in Advanced, and fix a session that will not start. - [Session reports](https://docs.chartnaut.com/guides/session-reports/): What a backtest session's five tabs and ten reports show, and how to add your own report. - [How research works](https://docs.chartnaut.com/guides/how-research-works/): How definitions, events, versions, studies and Forward Insights fit together, from a trading idea to an answer on your chart. - [Build a definition](https://docs.chartnaut.com/guides/build-a-definition/): Ask the Agent to build a definition or use the definition builder, then check its marks on real days before you measure anything. - [Versions and profiles](https://docs.chartnaut.com/guides/versions-and-profiles/): How a definition's versions keep your answers fixed, and how profiles let you study different settings side by side. - [Run a definition over history](https://docs.chartnaut.com/guides/run-over-history/): Run a definition over the instrument, interval and dates you choose to find every time its setup happened. - [Browse events](https://docs.chartnaut.com/guides/browse-events/): Open a dataset's events, filter them by anything the definition recorded, and check each one on a chart. - [Build and run a study](https://docs.chartnaut.com/guides/build-and-run-a-study/): Ask the Agent a question about a definition's events, approve the study it writes and run it over your datasets. - [Read the results](https://docs.chartnaut.com/guides/read-the-results/): Where a study's results appear, what each kind shows, and how to judge a number by the sample behind it. - [Forward Insights](https://docs.chartnaut.com/guides/forward-insights/): Put a study's answer on the chart as a Forward Insight, choose how it splits and manage it on the definition. - [Forward Insights on live events](https://docs.chartnaut.com/guides/forward-insights-on-live-events/): Why a Forward Insight can show the wrong reading on a live event, and how Update fixes the study behind it. - [In sample and out of sample](https://docs.chartnaut.com/guides/in-sample-and-out-of-sample/): What in sample and out of sample mean, explained for beginners, why it matters more than the percentage, and why a replay hides an insight until you pass the date its data ends. - [Definition alerts](https://docs.chartnaut.com/guides/definition-alerts/): Get a notification when a definition fires on a market. A Pro feature: 12 alerts at once, deep and 1-minute alerts included, more with an add-on. - [How indicators work](https://docs.chartnaut.com/guides/how-indicators-work/): Built-in and custom indicators, where they appear, how definitions use them, and the limits on each plan. - [Build a custom indicator](https://docs.chartnaut.com/guides/build-a-custom-indicator/): Build an indicator with the Agent or the indicator builder, or write it yourself, and manage its versions, sharing and limits. - [Indicators inside definitions](https://docs.chartnaut.com/guides/indicators-inside-definitions/): How a definition reads indicator values, how to approve the ones the agent adds, and why the version it reads stays fixed. - [Build your own pages](https://docs.chartnaut.com/guides/build-your-own-pages/): Describe a view once and the agent builds it onto every trade, journal day, backtest session, playbook, account or instrument, each showing that page's own data. - [Add a view](https://docs.chartnaut.com/guides/add-a-view/): Start a view from + View or Create custom report, build it with the agent, and change or remove it later. - [Views on trades](https://docs.chartnaut.com/guides/views-on-trades/): What a view on a closed trade can read, and six views worth building on your trades. - [Views on journal days](https://docs.chartnaut.com/guides/views-on-journal-days/): What a view on a journal day can read, and six views worth building on your trading days. - [Views on backtest sessions](https://docs.chartnaut.com/guides/views-on-backtest-sessions/): What a view on a backtest session can read, and six reports worth building on your sessions. - [Views on playbooks](https://docs.chartnaut.com/guides/views-on-playbooks/): What a view on a playbook can read, and six reports worth building on your setups. - [Views on accounts](https://docs.chartnaut.com/guides/views-on-accounts/): What a view on an account can read, and six reports worth building on your accounts. - [Views on instruments](https://docs.chartnaut.com/guides/views-on-instruments/): What a view on an instrument can read, and six views worth building for the markets you trade. - [Build an app](https://docs.chartnaut.com/guides/build-an-app/): Build a page of your own with the agent or from Tools → Apps, publish it, open it and share it. - [What views and apps can see and change](https://docs.chartnaut.com/guides/app-permissions/): What views and apps can read and change, the data they ask to collect, and where to check before adding one. - [Community views](https://docs.chartnaut.com/guides/community-views/): Find public views for a page, try them on your own data, add them, and share your own. - [How the agent works](https://docs.chartnaut.com/guides/how-the-agent-works/): What the agent builds, Supervised and Autonomous modes, the approval cards, the builders' own agents, and running it on credits or your own subscription. - [Work with your data](https://docs.chartnaut.com/guides/work-with-your-data/): Ask the agent questions about your study results: it runs a program over your data, keeps what it works out as files, and builds on them. - [Approvals](https://docs.chartnaut.com/guides/approvals/): Every card the agent stops on, the button that answers it, and how to ask for a change instead. - [The builders' agents](https://docs.chartnaut.com/guides/builder-agents/): The agents in the indicator, definition and app builders, what each asks before changing, and the preview's agent buttons. - [AI credits](https://docs.chartnaut.com/guides/ai-credits/): What AI credits pay for, what a message costs, and how to check and top up your balance. - [Use your own AI subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription/): Run Chartnaut's AI on your own Claude or ChatGPT subscription in Chartnaut Desktop, without spending credits. - [Community library](https://docs.chartnaut.com/guides/community-library/): Browse Discover, add indicators, definitions and apps to your library, clone them to make them yours, and choose who sees your own work. ## Scripting Write and debug indicators, definitions and studies. - [Overview](https://docs.chartnaut.com/scripting/overview/): This section is the code reference for indicator, definition and study scripts: every declaration, hook and ctx call, with examples you can paste into a builder's Code tab. - [Overview](https://docs.chartnaut.com/scripting/choose-your-dsl-overview/): This page tells you which kind of script to write before you open a builder's Code tab. - [Script anatomy](https://docs.chartnaut.com/scripting/script-anatomy/): Every Chartnaut script has two parts: top-level declarations that say what exists (settings, outputs, events, results, dependencies), then hooks that run over bars or events. - [First indicator guide](https://docs.chartnaut.com/scripting/first-indicator-guide/): This walkthrough builds an overlay indicator by hand: an EMA with a length and a colour setting, and an arrow on every bar that closes up through it. - [First definition guide](https://docs.chartnaut.com/scripting/first-definition-guide/): This walkthrough builds a small definition by hand: it marks every bar that closes above its open, with a label on each mark, ready to run over history and measure with a study. - [First study guide](https://docs.chartnaut.com/scripting/first-study-guide/): This walkthrough builds a small study by hand: it reads the events of the Bull bar definition from the first definition guide, counts them, and publishes a count, a table and a ... - [What Chartnaut guarantees](https://docs.chartnaut.com/scripting/what-chartnaut-guarantees/): One answer per bar: the same value in the browser and on the server, on every chart timeframe, live, in replay and over history, with no look-ahead and no repainting. - [Bars and clocks](https://docs.chartnaut.com/scripting/bars-and-clocks/): Confirmed and forming bars, when onBar runs, what a higher or lower timeframe can know at a bar, the UTC time grids, and sessions. - [Warmup and memory](https://docs.chartnaut.com/scripting/warmup-and-memory/): What warmup guarantees, how to declare it with warmup(...) and retain(...), how it resolves on each timeframe, memory limits per plan, and how to spot a warmup that is too short. - [Seams and anchors](https://docs.chartnaut.com/scripting/seams-and-anchors/): Where computed history joins, why every value starts its memory from a fixed point on a time grid, what is guaranteed at the straddling bucket, and what your script must do to keep it. - [Limits and errors](https://docs.chartnaut.com/scripting/limits-and-errors/): Every limit a script or run can reach, per plan where it varies, what you see when you reach it, and the errors and warnings script authors meet with what to do about each. - [Nuances worth knowing](https://docs.chartnaut.com/scripting/nuances/): Subtle behaviours that surprise script authors: forming-bar re-runs, barIndex, UTC days, Monday weeks, "max" per plan, oncePer across runs, errors on the chart and the server. - [Overview](https://docs.chartnaut.com/scripting/runtime-overview/): Most of the scripting API is the same whether you write an indicator or a definition: reading price, declaring settings, drawing on the chart, reading other indicators, other ti... - [Price and bar data](https://docs.chartnaut.com/scripting/bar-fields/): Every call to onBar(ctx) hands you the current bar and the context around it: prices, volume, time, whether the bar has closed, the instrument and the chart. Indicators and defi... - [Remembering values across bars](https://docs.chartnaut.com/scripting/accum-state/): Anything your script remembers from one bar to the next, such as an EMA, a session open or a "closed above yesterday" flag, lives in ctx.accum. Never in a module-level let or var. - [Settings inputs and dialog](https://docs.chartnaut.com/scripting/inputs-dialog-layout/): Settings a trader can change without editing code, such as a length, a colour or a higher timeframe, are declared at the top of the script with input.*, arranged with dialog and... - [Declaring indicator dependencies](https://docs.chartnaut.com/scripting/indicators-declare/): A script can build on another indicator, such as ATR or VWAP, by declaring it once at the top of the file and reading its values on ctx.indicators. Indicators, definitions and s... - [Dependency outputs](https://docs.chartnaut.com/scripting/dependency-outputs/): A correct indicators.declare does not put a number on every bar. The dependency's warmup, bars it chose not to emit, and gaps in the data all read as undefined. Guard every read... - [Drawing on the chart](https://docs.chartnaut.com/scripting/drawings-and-paint/): Everything a script draws, whether a line, a marker, a level or a zone, follows one pattern: declare the output at the top of the file, then draw it from onBar with the matching... - [Layers & rows](https://docs.chartnaut.com/scripting/layers-and-rows/): output.layer is the fourth output family, after series, markers and the hline / range / trendline lane. Its output is rows: keyed, schema-typed records written from onBar / onRu... - [Timeframe handles and runOn](https://docs.chartnaut.com/scripting/mtf-and-runon/): To read another timeframe, such as a daily EMA on a 5-minute chart, declare a timeframe(...) handle at module scope. To limit which chart timeframes a script runs on, set runOn ... - [Summaries and long windows](https://docs.chartnaut.com/scripting/summary-and-long-windows/): ctx.summary answers "what was the highest high, lowest low, first open, last close or total volume over this span" without loading the span's bars. Use it for all-time highs, 52... - [Sessions](https://docs.chartnaut.com/scripting/session-api/): ctx.session tells a script when a session opens and closes, so you key logic off session boundaries instead of clock arithmetic. Indicators and definitions share one API; studie... - [Reference data](https://docs.chartnaut.com/scripting/datasets/): dataset(...) gives a script reference data that is not market prices: the economic calendar, daily rates and yields, options levels and the options chain. You declare a handle o... - [Economic calendar](https://docs.chartnaut.com/scripting/economic-calendar/): econ.calendar is one row per scheduled economic release, covering the G10 and more than 100 economies. It carries the schedule, the consensus forecast and the previous figure. T... - [Rates and yields](https://docs.chartnaut.com/scripting/rates-and-yields/): rates.daily is one row per series per day. The series are government bond yields, US Treasury curves, overnight reference rates (SOFR, ESTR, SONIA, EFFR) and central-bank policy... - [Options levels](https://docs.chartnaut.com/scripting/options-levels/): Read call wall, put wall, gamma flip, gamma exposure, expected move and the gamma profile with options.eod.levels. On Pro. - [Options contracts](https://docs.chartnaut.com/scripting/options-contracts/): Read the end-of-day US options chain, one row per contract, with options.eod.contracts: quotes, open interest, implied volatility and greeks. Pro and up. - [Budgets and limits](https://docs.chartnaut.com/scripting/budgets/): Chartnaut caps how much work a script can do, so a heavy loop cannot freeze Charts or stall a study run. A soft limit shows a warning and the script keeps running. A hard limit ... - [Lint and error codes](https://docs.chartnaut.com/scripting/lint-and-error-codes/): Every lint rule id and runtime error code Chartnaut reports for scripts, with its severity and the fix. Look up the id shown in the builder's Problems list or in an agent's tool... - [Overview](https://docs.chartnaut.com/scripting/indicator-api/): An indicator is a script that draws on Charts: moving averages, oscillators, bands, markers, custom overlays. This section covers what indicators add on top of the shared runtim... - [Overlay vs pane](https://docs.chartnaut.com/scripting/indicator-meta/): meta({...}) is the first call in every indicator. It names the indicator, decides where it draws and what data it reads. Call it exactly once: a second call is an error, and an ... - [Series types](https://docs.chartnaut.com/scripting/series-outputs/): Every series an indicator draws is declared with an output. call at the top of the script and fed from onBar with the matching ctx. verb. This page lists every kind, its verb an... - [Panes & scales](https://docs.chartnaut.com/scripting/panes-and-scales/): Panes decide where an output draws. Price scales decide which axis it is measured against. They are separate choices, and most indicators only need the first. - [onBar](https://docs.chartnaut.com/scripting/onbar-indicator/): onBar(ctx) is the function Chartnaut calls once per bar: read price and settings, update state, emit to your outputs. This page covers what is particular to an indicator's onBar... - [Layers](https://docs.chartnaut.com/scripting/layers/): A layer is a chart primitive you script yourself: keyed rows computed in onBar, drawn by your own paint (Canvas 2D) or paintGL (WebGL). Profiles, footprints, heatmaps, drawing t... - [Painting a layer](https://docs.chartnaut.com/scripting/layer-render/): The render half of a layer runs on the main thread inside one host primitive per pane. You register functions on the layer handle; the host owns scheduling, culling, memoisation... - [Examples](https://docs.chartnaut.com/scripting/indicator-examples/): Ten Chartnaut public library indicators, simple to complex, with the decisions in each script explained. - [Volume](https://docs.chartnaut.com/scripting/example-volume/): Public library Volume indicator — what it plots, key script decisions, full source. - [Moving Average](https://docs.chartnaut.com/scripting/example-moving-average/): Public library Moving Average indicator — what it plots, key script decisions, full source. - [Donchian Channels](https://docs.chartnaut.com/scripting/example-donchian-channels/): Public library Donchian Channels indicator — what it plots, key script decisions, full source. - [ATR](https://docs.chartnaut.com/scripting/example-atr/): Public library ATR indicator — what it plots, key script decisions, full source. - [RSI](https://docs.chartnaut.com/scripting/example-rsi/): Public library RSI indicator — what it plots, key script decisions, full source. - [Bollinger Bands](https://docs.chartnaut.com/scripting/example-bollinger-bands/): Public library Bollinger Bands indicator — what it plots, key script decisions, full source. - [Stochastic](https://docs.chartnaut.com/scripting/example-stochastic/): Public library Stochastic indicator — what it plots, key script decisions, full source. - [MACD](https://docs.chartnaut.com/scripting/example-macd/): Public library MACD indicator — what it plots, key script decisions, full source. - [Supertrend](https://docs.chartnaut.com/scripting/example-supertrend/): Public library Supertrend indicator — what it plots, key script decisions, full source. - [VWAP](https://docs.chartnaut.com/scripting/example-vwap/): Public library VWAP indicator — what it plots, key script decisions, full source. - [Overview](https://docs.chartnaut.com/scripting/definition-api/): A definition is a script that marks every bar where a setup appears. Run it over history and each mark becomes an event you can browse and study. - [Meta](https://docs.chartnaut.com/scripting/definition-meta/): meta({...}) names the definition, gives it a stable slug, and sets kind: "flow" so it can emit events. Call it once, at the top of the entry file. - [Events and snapshots](https://docs.chartnaut.com/scripting/events-and-snapshots/): Every event a definition emits needs an events.declare first. The declaration names the event, describes its payload, and sets how it paints on the chart. The payload schema is ... - [Emit and labels](https://docs.chartnaut.com/scripting/emit-and-labels/): ctx.emit records that the setup happened on this bar. On the chart it draws the event's paint. When the definition runs over history, each accepted emit becomes a stored event t... - [onBar](https://docs.chartnaut.com/scripting/onbar-flow-runtime/): A definition's onBar(ctx) runs once per bar, oldest first, exactly as an indicator's does. The difference is the goal: a definition calls ctx.emit when its condition is true, an... - [Multi-file packages and imports](https://docs.chartnaut.com/scripting/imports-and-modules/): A definition can be one file or several. Split it with relative ES module imports (./helpers.js) when a piece of logic is reusable or easier to read alone. Small definitions sta... - [Examples](https://docs.chartnaut.com/scripting/definition-examples/): Three runnable definition scripts, simple to complex: bull bar, EMA cross, session OR break. - [Bull bar](https://docs.chartnaut.com/scripting/example-bull-bar/): Definition example: events.declare, the required emit label, a one-line bull-bar condition. - [EMA cross](https://docs.chartnaut.com/scripting/example-ema-cross/): Definition example: indicator dependencies and cross detection with the previous value. - [Session OR break](https://docs.chartnaut.com/scripting/example-or-break/): Definition example: clock-based sessions, opening-range state in accum with warmup, oncePer per session. - [Overview](https://docs.chartnaut.com/scripting/study-api/): A study script reads the events a definition recorded over history and turns them into results you can read: counts, hit rates, forward returns, tables. This section is the code... - [Declarations](https://docs.chartnaut.com/scripting/declarations/): The top of a study declares everything it reads and publishes: its settings, the definitions whose events it measures, any indicators, the dimensions that split events into grou... - [scope](https://docs.chartnaut.com/scripting/study-scope/): scope(ctx) decides each event's group from what was known when it fired: the tuple it returns, what it can read, ctx.previous, report dimensions and pin cells. - [onEvent and onFinish](https://docs.chartnaut.com/scripting/onevent-and-onfinish/): A study has three handlers. scope runs first for each event, in time order, and decides which group the event belongs to. onEvent runs next for every event scope includes and me... - [Collect and publish](https://docs.chartnaut.com/scripting/collect-and-publish/): In onEvent you store each measurement with ctx.collect. In onFinish you read the rows back with ctx.collected and turn them into declared results with ctx.publish. Most measurem... - [Results and stats](https://docs.chartnaut.com/scripting/results-and-stats/): Each result has a kind, set in results.declare, and the kind fixes the payload shape ctx.publish accepts. This page lists those shapes and the helpers for computing them: ctx.st... - [Dependencies](https://docs.chartnaut.com/scripting/study-dependencies/): A study measures around its events using what its dependencies already produced: other events from declared definitions, the lines and boxes they drew, and indicator values at a... - [Forward Insights](https://docs.chartnaut.com/scripting/chart-pins-overview/): A Forward Insight puts a study's answer on the chart: click a definition's mark and a popover shows what happened next after events like it, with the sample behind each number. ... - [Outlooks](https://docs.chartnaut.com/scripting/outlooks/): An outlook draws a Forward Insight on the chart for the event you clicked: Keep or Reject it, manage kept outlooks in Insights, and write outlook.js beside a study. - [Show studies on charts](https://docs.chartnaut.com/scripting/show-studies-on-charts/): To see a study's numbers while you trade or replay, put the study on the chart as a Forward Insight. You do not edit the study code yourself: Put on chart has an agent update it... - [Examples](https://docs.chartnaut.com/scripting/study-examples/): Three runnable study scripts, simple to complex: event count, forward return, stop and target first hit. - [Event count](https://docs.chartnaut.com/scripting/example-event-count/): Study example: flows.declare, collect and publish, a weekday table and a written answer. - [Forward return](https://docs.chartnaut.com/scripting/example-forward-return/): Study example: a horizon setting, candles.forward and a distribution of forward returns. - [Stop / target first hit](https://docs.chartnaut.com/scripting/example-stop-target-first-hit/): Study example: a stop and target scan with firstHit, split by a direction dimension. - [Overview](https://docs.chartnaut.com/scripting/agents-overview/): Chartnaut's agents write the same scripts this section documents, and check them with lint, typecheck and a dry run before you see the result. This page shows which agent writes... - [Indicator authoring agent](https://docs.chartnaut.com/scripting/indicator-authoring-agent/): The indicator builder's agent writes and edits one indicator script: inputs, outputs, dependencies, layers and onBar. Its edits apply straight to the code, and the chart beside ... - [Definition authoring agent](https://docs.chartnaut.com/scripting/flow-authoring-agent/): The definition builder's agent writes and edits one definition: its events, the emits with their labels, what it draws, and every file of a multi-file package. Its edits apply s... - [Study authoring agent](https://docs.chartnaut.com/scripting/study-authoring-agent/): The study builder's agent writes one study: which definitions it reads, what it collects per event, and what it publishes. Unlike the indicator and definition agents, it never a... - [Forward insight agent](https://docs.chartnaut.com/scripting/pin-orchestrator/): The Forward Insight agent works inside the Put on chart sheet. It adds a pin_cell result to a finished study so that the study's answer shows on Charts, on the bar where the set... - [Agent lint and dry-run](https://docs.chartnaut.com/scripting/agent-lint-and-dry-run/): Every agent checks its code before you see the result: lint for shape, typecheck for the values passed to the DSL, then a dry run that executes the saved script on real market d... - [Overview](https://docs.chartnaut.com/scripting/troubleshooting-overview/): Find what you see in the left column. The cause and the fix are in the same row; the link is only for more depth. - [FAQ](https://docs.chartnaut.com/scripting/faq/): Answers to the questions people ask most about scripting in Chartnaut. Each answer is complete here; links go to the full reference. - [Budget exceeded](https://docs.chartnaut.com/scripting/budget-exceeded/): A budget error means the script did more work than Chartnaut allows for one run, so it was stopped to keep the chart or the study responsive. The message names the budget and gi... - [Dependency unavailable](https://docs.chartnaut.com/scripting/dependency-unavailable/): Your script declares another indicator or definition and reads its output, but the value is empty. The plot is blank, study rows are skipped, or the chart legend shows dependenc... - [Emit not collected](https://docs.chartnaut.com/scripting/emit-not-collected/): Your definition calls ctx.emit, but no events appear on the chart, after running the definition over history, or in a study. Every emit that does not become an event was either ... - [Forward Insight errors](https://docs.chartnaut.com/scripting/pin-validation-errors/): This page covers what goes wrong when you put a study on the chart as a Forward Insight, and what goes wrong when you click an event afterwards. Each message is quoted as the ap... ## CLI, MCP & APIs Run your scripts from a terminal, a coding agent, an AI app like Claude or ChatGPT, or your own code. - [Overview](https://docs.chartnaut.com/cli/overview/): Run your indicators, definitions and studies on Chartnaut's servers from a terminal, a coding agent, an AI app over MCP, or your own code. - [Install](https://docs.chartnaut.com/cli/install/): Install the Chartnaut CLI on macOS, Linux or Windows with one command, then update or remove it. - [Sign in](https://docs.chartnaut.com/cli/sign-in/): Connect the CLI to your account by approving a code in the browser, or with an API key for CI. - [Your first run](https://docs.chartnaut.com/cli/your-first-run/): Set up a folder, write an EMA, validate it, run it on 30 days of BTC and save it. - [Working with Claude Code and Codex](https://docs.chartnaut.com/cli/claude-code-and-codex/): What chartnaut init gives Claude Code and Codex, the loop they follow, and how they read full results. - [Command reference](https://docs.chartnaut.com/cli/command-reference/): Every chartnaut command and flag, with defaults and limits. - [Saving and versions](https://docs.chartnaut.com/cli/saving-and-versions/): Push and pull scripts, resolve version conflicts, and go back to an older version. - [Runs and results](https://docs.chartnaut.com/cli/runs-and-results/): List runs, compare instruments, and fetch full results, study blocks and CSV, including study runs made in the app. - [Definition events](https://docs.chartnaut.com/cli/events-and-collect/): Read, filter and export a definition's stored events from the CLI, and run it over more history. - [Connect Chartnaut to an AI app](https://docs.chartnaut.com/cli/mcp-overview/): Let Claude, ChatGPT, Cursor or Codex read the docs, write scripts and run them on your account over MCP. - [MCP, the Agent or the CLI](https://docs.chartnaut.com/cli/mcp-vs-agent-vs-cli/): Three ways to have an AI build and run your scripts: an AI app over MCP, Chartnaut's own Agent, or the CLI with a coding agent. When to use which. - [Claude](https://docs.chartnaut.com/cli/mcp-claude/): Add Chartnaut as a custom connector in claude.ai and Claude Desktop, or as an MCP server in Claude Code. - [ChatGPT](https://docs.chartnaut.com/cli/mcp-chatgpt/): Add Chartnaut to ChatGPT as a custom MCP connector and sign in with your Chartnaut account. - [Cursor and Codex](https://docs.chartnaut.com/cli/mcp-cursor-and-codex/): Add Chartnaut's MCP server to Cursor's mcp.json or Codex's config.toml, with a browser sign-in or an API key. - [What you can ask](https://docs.chartnaut.com/cli/mcp-what-you-can-ask/): Requests that work well in Claude, ChatGPT or Cursor once Chartnaut is connected, with the tools each one uses, and the three built-in prompts. - [Permissions and connected apps](https://docs.chartnaut.com/cli/mcp-permissions/): What an AI app can do once you click Allow, how long it stays signed in, and how to disconnect it. - [Security and privacy](https://docs.chartnaut.com/cli/mcp-security-and-privacy/): What a connected AI app sees and never sees, how the sign-in and its tokens are protected, and how to cut an app off. - [Limits and cost](https://docs.chartnaut.com/cli/mcp-limits-and-cost/): What a connected AI app costs against your plan: what each plan allows, API requests per tool, heavy calls, long polls, runs at once and compute. - [MCP tools reference](https://docs.chartnaut.com/cli/mcp-tools/): Every tool, prompt and resource Chartnaut's MCP server offers, with inputs, outputs, limits and errors. - [Troubleshooting MCP](https://docs.chartnaut.com/cli/mcp-troubleshooting/): Fix an AI app that will not connect, keeps asking you to sign in, or gets plan_limit, forbidden_scope, rate_limited, busy or cut-off results from Chartnaut. - [How the MCP server works](https://docs.chartnaut.com/cli/mcp-how-it-works/): The transport, what happens on each tool call, the OAuth sign-in step by step, and what Chartnaut stores for a connection. - [API keys](https://docs.chartnaut.com/cli/api-keys/): Create, scope and revoke the keys the CLI and your own code use to act as you. - [API overview](https://docs.chartnaut.com/cli/api-overview/): What the Chartnaut API is for, how to authenticate, and a first call to check your key and start a run. - [Getting started](https://docs.chartnaut.com/cli/api-reference/): Base URL, keys, scopes, heavy calls, paging, errors and idempotency, with an index of every endpoint. - [Get the current key](https://docs.chartnaut.com/cli/api-get-current-key/): The username, plan and scopes of the key making the call. - [Get usage](https://docs.chartnaut.com/cli/api-get-usage/): Compute used this month, every plan cap with its count, and your API limits. - [List timeframes](https://docs.chartnaut.com/cli/api-list-timeframes/): The nine timeframes a run or a definition run over history can use. - [Search instruments](https://docs.chartnaut.com/cli/api-search-instruments/): Find instruments you can run on by text and category, with your coverage on each. - [Get an instrument](https://docs.chartnaut.com/cli/api-get-instrument/): One instrument by canonical or short symbol, with the coverage your plan can reach. - [The Instrument object](https://docs.chartnaut.com/cli/api-object-instrument/): The fields of an instrument: symbols, category, order flow, coverage and sessions. - [List doc topics](https://docs.chartnaut.com/cli/api-list-doc-topics/): Every page of the scripting reference, in sidebar order. - [Get a doc topic](https://docs.chartnaut.com/cli/api-get-doc-topic/): One scripting reference page as markdown. - [List scripts](https://docs.chartnaut.com/cli/api-list-scripts/): Your indicators, definitions and studies, most recently changed first. - [Get a script](https://docs.chartnaut.com/cli/api-get-script/): One of your scripts at its latest or a given version, optionally with source. - [List versions](https://docs.chartnaut.com/cli/api-list-script-versions/): A script's versions, newest first, with who saved each and what changed. - [Validate a script](https://docs.chartnaut.com/cli/api-validate-script/): Check code without saving or running it: diagnostics, interface and dependencies. - [Create a script](https://docs.chartnaut.com/cli/api-create-script/): Create an indicator, definition or study and save its first version. - [Save a script version](https://docs.chartnaut.com/cli/api-save-script-version/): Save new files as the next version, refused if someone saved first. - [Update script details](https://docs.chartnaut.com/cli/api-update-script-metadata/): Change a script's name, description or visibility without adding a version. - [Delete a script](https://docs.chartnaut.com/cli/api-delete-script/): Delete one of your scripts. - [The Script object](https://docs.chartnaut.com/cli/api-object-script/): The fields of a script, in its list form and its full form. - [The File object](https://docs.chartnaut.com/cli/api-object-file/): One source file of a script: path, code and entry flag. - [The Interface object](https://docs.chartnaut.com/cli/api-object-interface/): What Chartnaut read from a script: settings, outputs, events, results and timeframes. - [The Dependency object](https://docs.chartnaut.com/cli/api-object-dependency/): Another script a script's version reads, with its alias and pinned version. - [The Version object](https://docs.chartnaut.com/cli/api-object-version/): One saved version of a script: number, summary, author and time. - [The Diagnostic object](https://docs.chartnaut.com/cli/api-object-diagnostic/): One finding from checking a script's code. - [List events](https://docs.chartnaut.com/cli/api-list-events/): A definition's stored events, filtered by instrument, timeframe, time, version and payload. - [Summarise events](https://docs.chartnaut.com/cli/api-summarise-events/): A definition's event totals per instrument and timeframe, and runs over history still going. - [Run a definition over history](https://docs.chartnaut.com/cli/api-run-definition-over-history/): Run a definition over a window and store its events for studies to read. - [The Event object](https://docs.chartnaut.com/cli/api-object-event/): One event a definition found: id, instrument, times and payload. - [Create a run](https://docs.chartnaut.com/cli/api-create-run/): Start an indicator, definition or study run on an instrument and window. - [List runs](https://docs.chartnaut.com/cli/api-list-runs/): Your runs, newest first, from the API, the app or both. - [Get a run](https://docs.chartnaut.com/cli/api-get-run/): One run's status, progress and summary, optionally waiting for it to finish. - [Get run results](https://docs.chartnaut.com/cli/api-get-run-results/): What a succeeded run produced: points, events or study result blocks. - [Cancel a run](https://docs.chartnaut.com/cli/api-cancel-run/): Cancel a queued or running run. - [The Run object](https://docs.chartnaut.com/cli/api-object-run/): The fields of a run: what ran, its status, progress, summary and usage. - [The Failure object](https://docs.chartnaut.com/cli/api-object-failure/): Why a run failed or was cancelled, and whether to retry. - [The Summary object](https://docs.chartnaut.com/cli/api-object-summary/): The counts from a succeeded run, by kind. - [Create a Forward Insight](https://docs.chartnaut.com/cli/api-create-insight/): Save a study run's pin_cell answer to your library as a Forward Insight, or dry-run it to see the card first. - [List Forward Insights](https://docs.chartnaut.com/cli/api-list-insights/): Your Forward Insights, newest change first, filtered by definition, study, instrument or timeframe. - [Get a Forward Insight](https://docs.chartnaut.com/cli/api-get-insight/): One of your Forward Insights by its id. - [Update a Forward Insight](https://docs.chartnaut.com/cli/api-update-insight/): Rename a Forward Insight or change its description. - [Activate a Forward Insight](https://docs.chartnaut.com/cli/api-activate-insight/): Make a Forward Insight active, so the latest setup of its definition shows it on your charts. - [Deactivate a Forward Insight](https://docs.chartnaut.com/cli/api-deactivate-insight/): Stop a Forward Insight showing on your charts. It stays in your library. - [Remove a Forward Insight](https://docs.chartnaut.com/cli/api-delete-insight/): Archive a Forward Insight from your library. The study and its runs are kept. - [The Forward Insight object](https://docs.chartnaut.com/cli/api-object-insight/): The fields of a Forward Insight: its definition, study, instrument, timeframe, breakdown and window. - [Search the library](https://docs.chartnaut.com/cli/api-search-library/): Find indicators, definitions and studies you can run: yours, Chartnaut's built-ins and the community's. - [Get a library script](https://docs.chartnaut.com/cli/api-get-library-script/): One library script's description, interface and dependencies, by author and slug. Never its source. - [Check what a script needs](https://docs.chartnaut.com/cli/api-get-library-requirements/): What adding another author's script to your library would add with it, and anything that stops it. Changes nothing. - [Add to your library](https://docs.chartnaut.com/cli/api-add-to-library/): Add another author's indicator or definition to your library, with the scripts it needs, once the person has agreed to them. - [Remove from your library](https://docs.chartnaut.com/cli/api-remove-from-library/): Take another author's script out of your library. The scripts it brought along stay. - [The Library script object](https://docs.chartnaut.com/cli/api-object-library-script/): The fields of a script as the library describes it, in its list form and its full form. - [Start a sign-in](https://docs.chartnaut.com/cli/api-start-sign-in/): Start the browser sign-in behind chartnaut login and get the codes to show and poll with. - [Poll a sign-in](https://docs.chartnaut.com/cli/api-poll-sign-in/): Check whether a sign-in was approved and receive the new API key. - [Revoke the current key](https://docs.chartnaut.com/cli/api-revoke-key/): Revoke the key making the call. - [Call the MCP server](https://docs.chartnaut.com/cli/api-call-mcp-server/): Send MCP JSON-RPC requests to Chartnaut's remote MCP server over Streamable HTTP. - [Get protected resource metadata](https://docs.chartnaut.com/cli/api-get-protected-resource-metadata/): Discover which authorization server issues tokens for the MCP server, and its scopes. - [Get authorization server metadata](https://docs.chartnaut.com/cli/api-get-authorization-server-metadata/): Discover Chartnaut's OAuth endpoints, grant types and PKCE method. - [Register a client](https://docs.chartnaut.com/cli/api-register-client/): Register an MCP client dynamically and get its client_id. - [Start an authorization](https://docs.chartnaut.com/cli/api-start-authorization/): Send the person to Chartnaut's consent page and get an authorization code back. - [Get a token](https://docs.chartnaut.com/cli/api-get-token/): Exchange an authorization code, or a refresh token, for an access token and a new refresh token. - [Revoke a token](https://docs.chartnaut.com/cli/api-revoke-token/): Revoke an access token, or end a connection with its refresh token. - [Webhooks](https://docs.chartnaut.com/cli/api-webhooks/): Notices when a run finishes: not built yet, answers 501. - [Limits](https://docs.chartnaut.com/cli/limits/): How request, heavy-call, long-poll and runs-at-once limits behave, and how to retry. - [Errors and exit codes](https://docs.chartnaut.com/cli/errors-and-exit-codes/): Every API error code, run failure kind and CLI exit code, and which to retry. - [Partner API overview](https://docs.chartnaut.com/cli/partner-overview/): Link your users' Chartnaut accounts, run backtests and demo accounts for them, and embed Chartnaut in your site. - [Partner keys](https://docs.chartnaut.com/cli/partner-keys/): Make, rotate and revoke the secret keys your server uses for the partner API. - [Linking users](https://docs.chartnaut.com/cli/partner-linking/): Link a user's Chartnaut account to their account on your site, with the scopes they approve. - [The frame and embed.js](https://docs.chartnaut.com/cli/partner-frame/): Put Chartnaut's backtest screen on your page with one script or the @chartnaut/charts package, sign users in once, receive its events and send it commands. - [Backtest sessions](https://docs.chartnaut.com/cli/partner-sessions/): Create backtests for your users, read their results, list them by label and lock or end many at once. - [Demo accounts](https://docs.chartnaut.com/cli/partner-demo-accounts/): Create simulated-money accounts on live prices for your users, lock and unlock them, and close them all at once. - [Rules](https://docs.chartnaut.com/cli/partner-rules/): Daily loss, drawdown, position limits, profit targets and slippage on sessions and demo accounts, and what happens on a breach. - [Webhooks](https://docs.chartnaut.com/cli/partner-webhooks/): The events Chartnaut sends your server, how to verify their signature and how retries work. - [Alerts](https://docs.chartnaut.com/cli/partner-alerts/): Read when a linked user's own Chartnaut alerts fire. - [Limits and errors](https://docs.chartnaut.com/cli/partner-limits-and-errors/): The partner API's rate limits and caps, the rate-limit headers, and every error code. ## Account Profile, billing, plans and limits, and support. - [Profile](https://docs.chartnaut.com/account/profile/): Set your avatar, username, bio and links, and see what you have published. - [Subscription and billing](https://docs.chartnaut.com/account/subscription-and-billing/): Upgrade to Pro, buy add-ons, cancel or reactivate, and find invoices and usage. - [Preferences](https://docs.chartnaut.com/account/preferences/): Set the timezone your charts, trades and journal use, and pick a theme. - [Support](https://docs.chartnaut.com/account/support/): Ask the help chat, email support, send feedback and check system status. - [Plans and limits](https://docs.chartnaut.com/account/plans-and-limits/): What Free and Pro include and every limit on each in one table, with what happens when Pro ends. - [Add-ons](https://docs.chartnaut.com/account/add-ons/): Nine monthly add-ons that raise a Pro limit: MetaTrader, cTrader and TradeLocker accounts, events, studies, definitions, runs at once, alerts, multistream hours and private stream seats. - [Library limits](https://docs.chartnaut.com/account/library-limits/): How many definitions, studies, custom indicators, apps, dashboards and stored trades each plan keeps, and what happens at the cap. - [Definition events](https://docs.chartnaut.com/account/definition-events-limit/): How many events your definitions can collect on each plan, what uses the allowance and why events are kept. - [Historical data](https://docs.chartnaut.com/account/historical-data/): Three years of history on Free and all of it on Pro, where backtest sessions can start, and what that means for charts, definitions and indicators. - [Datasets by plan](https://docs.chartnaut.com/account/datasets-by-plan/): Which reference data your scripts can read on each plan: the economic calendar, rates and yields, options levels and options contracts, and how many datasets one script may read. - [Chart limits](https://docs.chartnaut.com/account/chart-limits/): Panels open, indicators per chart and timeframes per indicator on each plan, and what Charts does at each limit. - [Indicator memory](https://docs.chartnaut.com/account/indicator-memory/): How many bars an indicator can remember on each plan, and what you see when it asks for more. - [Runs at once](https://docs.chartnaut.com/account/runs-at-once/): How many script runs your account can have going at once, shared by the app, the Agent and the API. - [Agent workspace](https://docs.chartnaut.com/account/agent-workspace/): How much space the agent has for the files it works out, how long they are kept, and what each program it runs may use. - [Live accounts](https://docs.chartnaut.com/account/live-accounts/): How many live broker accounts Free's trial and Pro allow at once, MetaTrader's own allowance, add-ons for more, and what happens when Pro ends. - [Historical Intelligence limits](https://docs.chartnaut.com/account/historical-intelligence-limits/): How many playbooks Historical Intelligence learns from on each plan, and how many markets in each. - [API limits](https://docs.chartnaut.com/account/api-limits/): Requests a minute, heavy calls and long polls for the CLI, MCP and API on each plan. - [AI credits](https://docs.chartnaut.com/account/ai-credits-billing/): AI credits are pay as you go: pricing, bonuses and what spends them. - [Hitting a limit](https://docs.chartnaut.com/account/hitting-a-limit/): Every plan limit message with what to do, and what happens to your work when Pro ends. # Full content # Overview URL: https://docs.chartnaut.com/sdk/overview/ Updated: 2026-11-22T22:29:00Z Put Chartnaut's trading terminal inside your own app with @chartnaut/charts, and drive it from your code: charts, scripts, drawings, replay and orders. The Terminal SDK puts Chartnaut's trading terminal inside your own app. Your page shows the charts, your code drives them, and every click your user makes reaches your code as an event. Two packages do it: | Package | Runs on | What it does | |---|---|---| | `@chartnaut/charts` | Your page | The terminal as a React component (``) or a plain JavaScript object, with hooks for charts, scripts, drawings, replay, orders and the account | | `@chartnaut/node` | Your server | Mints the terminal's sign-in for the user on your site (`frameRoute`), calls the partner API and checks webhooks | Your secret key stays on your server. The page only ever holds a short-lived frame address. ## The whole thing in two files With Next.js, one route on your server and one component on your page: ```ts // app/api/chartnaut/frame/route.ts import { frameRoute } from "@chartnaut/node"; export const GET = frameRoute({ getUser: async () => (await auth())?.user.id ?? null, // your own sign-in whenNotLinked: { link: { scopes: ["frame:instant", "terminal:read", "terminal:write"] } }, }); ``` ```tsx // app/trade/page.tsx "use client"; import { Terminal, useChart, useTerminal } from "@chartnaut/charts/react"; export default function TradePage() { const terminal = useTerminal(); const main = useChart(terminal, "main"); return (
); } ``` `` asks your server for its address at `/api/chartnaut/frame`, which `frameRoute` answers. The first time someone opens it, the terminal shows **Sign in with Chartnaut** and opens once they approve. [Getting started](https://docs.chartnaut.com/sdk/getting-started) sets this up for you in one command. ## Three layers, one channel | Layer | What you write | Use it for | |---|---|---| | Friendly | ``, `terminal.chart("main").setSymbol("NAS100")`, `terminal.orders.buy(...)`, hooks | Nearly everything | | Raw | `terminal.send("set_symbol", {...})`, `terminal.on("symbol_changed", ...)` | Any command or event, including new ones before they get a friendly name | | Protocol | `postMessage` with `v: 1` | Pages with no JavaScript tooling. See [The frame and embed.js](https://docs.chartnaut.com/cli/partner-frame) | Every friendly call is a thin wrapper over one command or event, so you can mix them freely. The terminal stays in charge of prices, rules and limits: the SDK never decides anything the terminal doesn't check again. ## What you can build - **Your own terminal.** Hide Chartnaut's toolbars and put your own around the charts: [Layout and charts](https://docs.chartnaut.com/sdk/layout-and-charts). - **Scripts as components.** Add an indicator when a component mounts, read its values, react to a definition's events: [Scripts](https://docs.chartnaut.com/sdk/scripts). - **Your data on the chart.** Lines, zones and markers from your own database: [Drawings and overlays](https://docs.chartnaut.com/sdk/drawings-and-overlays). - **Drills and journals.** Pause the replay on an event until your user answers, journal every closed trade: [Replay, orders and the account](https://docs.chartnaut.com/sdk/replay-orders-account). - **Saved setups.** Keep each user's layout in your own database: [Workspace and persist](https://docs.chartnaut.com/sdk/workspace-and-persist). ## Where to go next | You want to | Read | |---|---| | Get a terminal on your page | [Getting started](https://docs.chartnaut.com/sdk/getting-started) | | Learn the React component and hooks | [React](https://docs.chartnaut.com/sdk/react) | | Understand projects, Test and Live, keys and sites | [Projects](https://docs.chartnaut.com/sdk/projects) | | Know who signs in, and how | [Users](https://docs.chartnaut.com/sdk/users) | | Look up an error code | [Errors](https://docs.chartnaut.com/sdk/errors) | | Test your app without a terminal | [Testing](https://docs.chartnaut.com/sdk/testing) | | See what changed | [Changelog](https://docs.chartnaut.com/sdk/changelog) | Coding agents can start from [llms.txt](https://docs.chartnaut.com/llms.txt), an index of these docs, or read every page as one file in [llms-full.txt](https://docs.chartnaut.com/llms-full.txt). --- # Getting started URL: https://docs.chartnaut.com/sdk/getting-started/ Updated: 2026-11-22T22:29:00Z A working terminal on localhost in a few minutes: npm create @chartnaut/app, chartnaut init --project in an existing project folder, or by hand. Three ways to a working terminal on `http://localhost`. All of them end with the same files: a Test key in `.env.local`, one route on your server and `` on a page. | Start from | Run | Best when | |---|---|---| | Nothing | `npm create @chartnaut/app my-app` | You want a new app to build on | | Your own project folder | `chartnaut init --project` | You already have an app, or a coding agent is working in it | | Your own project folder, by hand | `npm install @chartnaut/charts @chartnaut/node` | You want to see every step | You need a Chartnaut account. Any plan works, Free included. Each of these makes or picks a [project](https://docs.chartnaut.com/sdk/projects): the Chartnaut side of your app, with its keys and sites. A project starts in Test: localhost is allowed and only you and your team can sign in. Test usage counts against nothing. Each project counts toward your [plan's](https://docs.chartnaut.com/sdk/plans-and-limits) projects. ## A new app ```sh npm create @chartnaut/app my-app ``` 1. Your browser opens on Chartnaut. Check the code matches the one in your terminal, then approve. The approval asks for one extra permission: creating developer projects and Test keys. 2. It creates a project for you (or pass `--app ` to use one you have), writes its Test key into `my-app/.env.local` and copies in the template. 3. It installs the packages and prints what to run next. ```sh cd my-app npm run dev ``` Open http://localhost:3000. The terminal asks you to sign in with Chartnaut the first time; approve, and it opens. | Option | What it does | |---|---| | `--template next` | Next.js with the app router (the default) | | `--template vite-express` | Vite and React on the page, Express on the server. Vite sends `/api` to Express on port 3001 | | `--app ` | Use a project you already have instead of creating one | | `--name ` | The new project's name | | `--no-browser` | Print the sign-in link instead of opening it | | `--no-install` | Skip `npm install` | The sign-in key it uses is short-lived and is revoked when it finishes. With `CHARTNAUT_TOKEN` set in your shell it uses that key and leaves it alone. ## An existing app, with the CLI Install the [CLI](https://docs.chartnaut.com/cli/install) and run this in your project folder: ```sh chartnaut init --project ``` It does each of these, and tells you what it did: 1. Signs you in through your browser with the permission to create projects and Test keys. If you were signed in without it, the new sign-in replaces the old one. 2. Picks your project, or creates one. Pass a slug (`chartnaut init --project acme-desk-k3p9`) or `--name "Acme Desk"` to skip the question. 3. Makes a Test key and writes it to `.env.local` as `CHARTNAUT_SECRET_KEY`, with `CHARTNAUT_APP` set to the project's slug. The key is never printed. `.env.local` is added to `.gitignore` if it isn't there. 4. Checks localhost is allowed. In Test every `http://localhost` and `http://127.0.0.1` port is, with nothing to add. 5. Writes the project's slug into `chartnaut.json`, which links this folder to the project. Adds a short guide for coding agents to `AGENTS.md` and `CLAUDE.md` (between `chartnaut-app:begin` and `chartnaut-app:end`), and a skill at `.claude/skills/chartnaut-sdk/SKILL.md`. 6. In an empty folder, copies in a template. 7. Runs `chartnaut project check`. | Option | What it does | |---|---| | `--name ` | Create a project with this name | | `--template ` | The template to copy in. Default: `next` in an empty folder, `none` otherwise | | `--port ` | Your dev server's port. Default 3000 for `next`, 5173 for `vite-express` | | `--no-browser` | Print the sign-in link instead of opening it | | `--no-check` | Skip `chartnaut project check` at the end | Other project commands: | Command | What it does | |---|---| | `chartnaut project list` | Your projects | | `chartnaut project create ` | A new project | | `chartnaut project key [slug]` | A new Test key, written to `.env.local` in place of the old one | | `chartnaut project check [slug]` | The checklist below | | `chartnaut login --projects` | Sign in with the permission to create projects and Test keys | The CLI and the MCP server never make Live keys. Those are made in Developers, in your browser. ## By hand ### Install the packages ```sh npm install @chartnaut/charts @chartnaut/node ``` ### Add your Test key Open the menu under your name, then **Developers**, and **Create project**. Copy its Test key (it is shown once) into `.env.local`: ```sh CHARTNAUT_SECRET_KEY=cn_partner_test_... ``` ### Add the route `` asks your server for its address. In Next.js: ```ts // app/api/chartnaut/frame/route.ts import { frameRoute } from "@chartnaut/node"; export const GET = frameRoute({ getUser: async () => (await auth())?.user.id ?? null, whenNotLinked: { link: { scopes: ["frame:instant", "frame:live", "terminal:read", "terminal:write"] } }, frameOptions: { mode: "live" }, }); ``` With Express: ```ts // server.ts import express from "express"; import { frameRouteExpress } from "@chartnaut/node"; const app = express(); app.get( "/api/chartnaut/frame", frameRouteExpress({ getUser: (req) => req.user?.id ?? null, // your own sign-in, e.g. Passport whenNotLinked: { link: { scopes: ["frame:instant", "frame:live", "terminal:read", "terminal:write"] } }, frameOptions: { mode: "live" }, }), ); app.listen(3001); ``` `frameOptions` says what the terminal opens. `{ mode: "live" }` is live charts, which needs `frame:live` in the scopes. `{ session: "ses_…" }` opens a backtest your server made with `cn.sessions.create`. With neither, the terminal waits for a backtest and shows no chart. To pick per page, read it from the request: `frameOptions: (req) => ({ session: new URL(req.url, "http://localhost").searchParams.get("session") ?? undefined })`. ### Put the terminal on a page `` fills its parent, so give the parent a height: ```tsx "use client"; import { Terminal } from "@chartnaut/charts/react"; export default function TradePage() { return ; } ``` One terminal per page. For several charts, give it a [layout](https://docs.chartnaut.com/sdk/layout-and-charts#the-layout) instead of a second ``. `getUser` returns your own id for the person signed in to your site, or null when nobody is (the route answers 401). Your id becomes `ext:` on the API. [Users](https://docs.chartnaut.com/sdk/users) covers linking and managed users. ## Check it works ```sh chartnaut project check ``` It reads your project's quickstart and prints each step, done or not, with what to do next: | Step | Done when | |---|---| | Test key made | The project has a Test key | | First frame | A terminal opened from your app on localhost or a Test site | | Your account linked | You signed in with your own Chartnaut account from your app in Test | | Developer terms accepted | Live only: you accepted the developer terms | | An https site added | Live only: your app's https address is on the project's Sites tab | | Live key made | Live only: you made a Live key | The same checklist is the **Quickstart** on your project's **Overview** tab in Developers. Once the three Test steps are done, your app works on localhost. The Live steps happen in Developers: see [Projects](https://docs.chartnaut.com/sdk/projects#going-live). --- # React URL: https://docs.chartnaut.com/sdk/react/ Updated: 2026-11-22T22:29:00Z The component, its props and events, and the hooks that turn the terminal's charts, scripts, replay and account into React state. `@chartnaut/charts/react` gives you one component, ``, and hooks that read the terminal as React state. React 18 or later. It works in Next.js (as a client component) and in plain Vite. ## `` ```tsx "use client"; import { Terminal, useTerminal } from "@chartnaut/charts/react"; export function Desk() { const terminal = useTerminal(); return (
console.log("Filled", e.data.order_id)} onSessionEnded={(e) => console.log("Session over", e.data.status)} />
); } ``` It fills its parent, so the parent needs a height. With `dev` on, a parent with no height gets a warning in the console. Where the terminal gets its address: | Prop | What it does | |---|---| | none | Asks your own server at `/api/chartnaut/frame`, which `frameRoute` from `@chartnaut/node` answers ([Users](https://docs.chartnaut.com/sdk/users)) | | `getFrameUrl={({ refresh }) => ...}` | Your own fetch. `refresh` is true when the terminal refused the last address's sign-in and needs a fresh one | | `frameUrl` | A frame address you already have | What it opens with. Change `layout`, `charts`, `interface` or `appearance` later and the terminal follows: the SDK sends only what changed, as one change. The other props are read when the terminal opens. | Prop | What it sets | |---|---| | `layout` | A preset (`"1"`, `"2h"`, `"2v"`, `"3"`, `"1+2"`, `"1+3"`, `"2x2"`, `"2+3"`, `"3x2"`, `"2x4"`) or your own split tree. [Layout and charts](https://docs.chartnaut.com/sdk/layout-and-charts) | | `charts` | Each chart by your own id: `{ main: { symbol, timeframe, type } }` | | `panels` | Panels by id: `{ book: { kind: "order-book" } }` | | `interface` | Switches for everything around the charts, such as `onlyCharts` | | `appearance` | A theme preset and your own colours | | `persist` | Where the layout is kept: `"device"`, `"account"`, `"none"` or `{ load, save }`. [Workspace and persist](https://docs.chartnaut.com/sdk/workspace-and-persist) | | `locale`, `timezone`, `numberFormat` | How numbers and times show, for this terminal only | | `dev` | Logs every command, reply and event, names ignored options and adds a `fix` line to errors | Events as props: `onReady`, `onFill`, `onPositionClosed`, `onBreach`, `onSessionEnded`, `onError` and `onEvent` (every event). Changing a callback never reloads anything. ## The terminal handle `useTerminal()` gives you the terminal: pass its `ref` to ``, and use it anywhere in the component. It has everything [the terminal object](https://docs.chartnaut.com/sdk/terminal) has, and re-renders the component when its status moves from booting to ready. Calls you make before the terminal is ready wait for it. ## Hooks Each hook reads once the terminal is ready, then follows the terminal's events. Nothing polls, and a hook re-renders only when its own part changes. | Hook | Gives you | |---|---| | `useChart(terminal, id?)` | One chart's `symbol`, `timeframe`, `type`, `status` and its handle. No id: the chart in focus | | `useLayout(terminal)` | `charts` (ids in layout order), `focusedChart`, `panels`, the tree | | `useScript(chart, source, inputs?)` | Adds a script on mount, updates its inputs when they change, removes it on unmount | | `useQuote(terminal, symbol)` | The newest live quote, at most once a frame (live terminals only) | | `useReplay(terminal)` | `time`, `playing`, `speed` and the replay's controls | | `useAccount(terminal)` | `balance`, `equity`, `openPnl` | | `usePositions(terminal)` | Open positions, each with its P&L as it moves | | `useFills(terminal, { last })` | The latest fills | | `useWorkspace(terminal)` | The save status with `persist={{ load, save }}` | ```tsx import { useChart, useLayout, useTerminal } from "@chartnaut/charts/react"; export function ChartTabs() { const terminal = useTerminal(); const { charts, focusedChart } = useLayout(terminal); const focused = useChart(terminal); return ( ); } ``` Hooks take the terminal from `useTerminal()`. To use one in a child component, pass the terminal down as a prop or through your own context. ## Waiting for things to be ready Every handle and hook carries a `status`: `booting`, `loading`, `calculating`, `ready`, or `refused` and `error` with a `reason`. `` shows its children once everything listed is ready, a fallback before, and the reason when something fails: ```tsx import { Ready, useChart, useScript, useTerminal } from "@chartnaut/charts/react"; export function RsiReadout() { const terminal = useTerminal(); const main = useChart(terminal, "main"); const rsi = useScript(main.chart, "RSI", { length: 14 }); return ( Calculating…}> ); } ``` `settled` waits until the numbers won't shift any more: the script has calculated its whole history. ## Next.js Use `` in a client component (`"use client"`). On the server it renders an empty box and loads the terminal in the browser. The route it asks for its address is one file: see [Getting started](https://docs.chartnaut.com/sdk/getting-started). ## Without React Everything here has a plain JavaScript version: `createTerminal(element, options)` returns the same terminal object. See [The terminal object](https://docs.chartnaut.com/sdk/terminal). --- # The terminal object URL: https://docs.chartnaut.com/sdk/terminal/ Updated: 2026-11-22T22:29:00Z createTerminal and the terminal it returns: ready and status, events with on, once and off, raw commands with send, can, apply, and dev mode. The terminal object is what ``'s `useTerminal()` gives you, and what `createTerminal()` returns without React. Everything else hangs off it: `terminal.chart(id)`, `terminal.orders`, `terminal.replay` and the rest. ## Without React ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { charts: { main: { symbol: "NAS100", timeframe: "15m" } }, timezone: "America/New_York", }); terminal.chart("main").setTimeframe("1h"); // waits until the terminal is ready terminal.on("session_ended", (e) => console.log("Session over:", e.data.status)); ``` It takes the same options as [``](https://docs.chartnaut.com/sdk/react)['s props](https://docs.chartnaut.com/sdk/react). With no `frameUrl` or `getFrameUrl` it asks your server at `/api/chartnaut/frame`. Without a bundler, load it from a script tag: `` puts `Chartnaut.createTerminal` on `window`. ## Ready and status ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, {}); terminal.subscribe((s) => console.log(s.status, s.reason ?? "")); terminal.ready.then((ready) => console.log("Session", ready.session_id)); ``` `terminal.status` is `{ status, ready, settled, reason }`. It starts at `booting` and becomes `ready` once the terminal is open, or `refused` with a reason. `terminal.ready` is a promise for the same moment. Calls made before ready are held and sent once it is, for up to 30 seconds (`readyTimeoutMs`), then they fail with `not_ready`. ## Events `on` returns a function that stops listening. `once` hears the next one only. `off(type)` stops every listener of that type. ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, {}); const off = terminal.on("symbol_changed", (e) => { if (e.data.cause === "command") return; // an echo of your own setSymbol console.log(`${e.data.chart_id} now shows ${e.data.symbol}`); }); terminal.once("ready", () => console.log("Open")); terminal.on("*", (e) => console.log(e.type)); off(); ``` Every change event carries `cause`: `user` (the person did it), `command` (your code), `link` (a linked chart followed another) or `upgrade`. Every event carries `seq` and `event_id`, and `time` in unix seconds: replay time in a backtest. Events are hints for your interface. For anything that matters, such as prizes or payouts, read the facts from your server with `@chartnaut/node`. The handles have events on the thing they're about, with camelCase names: `chart.on("symbolChange")`, `script.on("event")`, `position.on("pnl")`. The global names are the wire's, in snake_case. ## Raw commands Every command the terminal takes is one `send` away, typed for the ones the SDK knows: ```ts import { ChartnautCommandError, createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { charts: { main: { symbol: "NAS100", timeframe: "15m" } }, }); async function onlyTheTradesPanel() { try { await terminal.send("open_panel", { panel: "trades" }); } catch (e) { if (e instanceof ChartnautCommandError && e.is("notAllowed")) console.log(e.reason, e.message); } } onlyTheTradesPanel(); ``` The commands this terminal takes are in `ready.commands`. A command it refuses with `rate_limited`, and a read it refuses with `not_ready` while the session loads, are sent again for up to 15 seconds. Pass `{ retry: false }` as the third argument to get the first refusal. Reads wait 5 seconds for a reply, orders and closes 20, `close_all` 30. ## What the user may do: `can` ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, {}); terminal.ready.then(() => { const orders = terminal.can("orders.place"); if (!orders.yes) console.log("No orders here:", orders.reason); console.log("Order flow:", terminal.can("features.order_flow").yes); }); ``` `can` answers from the capabilities the terminal sent on ready and updates when they change (`capabilities_changed`): the mode, the session, the user's plan, the scopes they granted and the features they have. ## Many changes as one: `apply` ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, {}); terminal.apply({ layout: "2h", charts: { main: { symbol: "EURUSD", timeframe: "15m" }, htf: { symbol: "EURUSD", timeframe: "4h" } }, appearance: { preset: "Chalk" }, }).then((r) => r.warnings.forEach((w) => console.warn(w.path, w.message))); ``` The layout, every chart's change, the appearance and the interface land as one change, each chart loading once. Parts that couldn't apply come back in `warnings`; the rest applies. ## Dev mode `dev: true` logs every command, reply and event, names options the terminal ignored, adds a `fix` line to each error, and warns when the terminal's parent has no height. Turn it off in production. ## The rest of the object | Property | What it is | Page | |---|---|---| | `chart(id)`, `layout`, `links`, `appearance` | Charts, the layout, link groups and the look | [Layout and charts](https://docs.chartnaut.com/sdk/layout-and-charts) | | `scripts` | Every script on every chart | [Scripts](https://docs.chartnaut.com/sdk/scripts) | | `symbols`, `bars`, `quotes`, `screenshot`, `watchlists` | Market data | [Symbols and data](https://docs.chartnaut.com/sdk/symbols-and-data) | | `replay`, `orders`, `account` | Backtests | [Replay, orders and the account](https://docs.chartnaut.com/sdk/replay-orders-account) | | `workspace` | The saved setup | [Workspace and persist](https://docs.chartnaut.com/sdk/workspace-and-persist) | | `openPanel("trades" \| "none")` | Chartnaut's Trades panel over the charts | | | `load(frameUrl)`, `destroy()` | Load another address, or take the terminal off the page | | --- # Layout and charts URL: https://docs.chartnaut.com/sdk/layout-and-charts/ Updated: 2026-11-22T22:29:01Z Lay out up to 8 charts and panels, drive each chart by its id, link them, switch our interface off and match your colours. A terminal is a layout of charts and panels. You name each chart with your own id (`main`, `htf`) and drive it through `terminal.chart(id)`. ## Charts by id ```tsx import { Terminal, useTerminal } from "@chartnaut/charts/react"; export function TwoCharts() { const terminal = useTerminal(); return (
); } ``` Charts are always keyed by id, never a list. Name yours when you want to drive them; charts the user adds get ids of their own (`chart-3`). `useLayout` and `terminal.layout.charts` list every chart's id in layout order. ## One chart ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { charts: { main: { symbol: "NAS100", timeframe: "15m" } }, }); const main = terminal.chart("main"); async function drive() { const { affected } = await main.setSymbol("EURUSD"); // resolves when the chart shows it console.log("Changed:", affected); await main.setTimeframe("1h", { link: false }); await main.setType("heikin-ashi"); await main.setVisibleRange("2026-09-15T09:30-04:00", "2026-09-15T16:00-04:00"); main.on("symbolChange", (e) => console.log("Now", e.data.symbol)); } drive(); ``` | Call | What it does | |---|---| | `setSymbol(symbol)` | Shows a market. Linked charts follow unless `{ link: false }`; `affected` names every chart that changed | | `setTimeframe(tf)` | `1m`, `5m`, `15m`, `30m`, `1h`, `2h`, `4h`, `1d`, `1w`, `1mo` | | `setType(type)` | `candlesticks`, `hollow-candlesticks`, `bars`, `line`, `area`, `heikin-ashi`, `volume-footprint`, `volume-profile`, `time-price-opportunity`, `volume-bubbles`, `liquidity-heatmap` | | `setVisibleRange(from, to)`, `scrollTo(time)`, `zoom(bars)`, `resetView()` | The view | | `focus()` | The terminal's focus ring, and the chart commands go to by default. Never takes your page's keyboard | | `pickSymbol({ apply })` | Opens Chartnaut's market search over the terminal and resolves with the choice, or null | | `pickScript()` | Opens Chartnaut's script picker and resolves with the script the person added, or null | | `get()` | Reads the chart again | Calls resolve when the chart shows the change. Pass `{ wait: "settled" }` to wait for the whole history to load, or `{ wait: "accepted" }` to only wait for the terminal to take it. A change that hasn't shown in 10 seconds answers with `pending: true`. Times are unix seconds, a `Date`, or ISO text with an offset (`2026-09-15T13:30-04:00`). Where a call takes `{ tz }`, local text with a time zone works too. Text with neither is refused, because it could mean any time zone. Chart events: `symbolChange`, `timeframeChange`, `typeChange`, `visibleRangeChange`, `scaleChange`, `focus`, `remove`, `barClose` and `resize`. ## Your own controls over a chart `chart.rect` is the chart's box inside the terminal, in CSS pixels, and `resize` fires when it moves. Float your own UI over a chart with it: ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { charts: { main: { symbol: "NAS100", timeframe: "15m" } }, }); const badge = document.createElement("div"); terminal.chart("main").on("resize", (e) => { badge.style.left = `${e.data.rect.x + e.data.rect.width - 120}px`; badge.style.top = `${e.data.rect.y + 8}px`; }); ``` ## The layout ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, {}); async function build() { await terminal.layout.set( { direction: "row", sizes: [60, 40], children: ["main", { direction: "column", children: ["htf", "book"] }] }, { charts: { main: { symbol: "NAS100", timeframe: "5m" }, htf: { symbol: "NAS100", timeframe: "1h" } }, panels: { book: { kind: "order-book", settings: { symbol: "NAS100" } } }, }, ); await terminal.layout.addChart({ id: "daily", symbol: "NAS100", timeframe: "1d", nextTo: "htf", side: "bottom" }); terminal.layout.on("chartRemoved", (e) => console.log("Closed", e.data.chart_id)); } build(); ``` A layout is a preset or a split tree whose leaves are chart and panel ids, with sizes in percent. Up to 8 charts, and up to 4 panels in a frame. This is how a page gets more charts: a page holds one terminal, and a second one is refused with [`not_allowed`](https://docs.chartnaut.com/sdk/errors#not_allowed). Past the user's plan, `set` is refused with `plan_limit` and the charts the plan allows still show. Panels: `watchlist`, `order-book`, `position-manager`, `economic-calendar`, `options-levels`. ## Linking charts Linked charts follow each other's symbol, timeframe, crosshair or time: ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { layout: "2h", charts: { main: { symbol: "NAS100", timeframe: "5m" }, htf: { symbol: "NAS100", timeframe: "4h" } }, }); terminal.links.set([{ id: "a", charts: ["main", "htf"], link: ["symbol"] }]); ``` `chart.link("a")` puts one chart in a group, `chart.link(null)` takes it out. ## The terminal's interface, on or off `interface` switches every part around the charts. `onlyCharts` turns them all off, for when you build your own toolbar: ```tsx import { onlyCharts } from "@chartnaut/charts"; import { Terminal, useChart, useTerminal } from "@chartnaut/charts/react"; export function MyTerminal() { const terminal = useTerminal(); const chart = useChart(terminal); return (
{(["5m", "15m", "1h", "4h"] as const).map((tf) => ( ))}
); } ``` The parts you can switch: `top_toolbar`, `chart_toolbar`, `drawing_rail`, `drawing_toolbar`, `context_menu`, `legend`, `price_axis`, `time_axis`, `chart_tabs`, `replay_bar`, `order_bar`, `account_card`, `trades_panel`, `frame` (padding, gap, border, transparent background), `layout.resizable` and `keyboard`. Most take `true` or `false`, and some go deeper: `{ chart_toolbar: { timeframe: false } }`. "Powered by Chartnaut" stays unless your plan removes it ([Plans and limits](https://docs.chartnaut.com/sdk/plans-and-limits)). ## Your colours ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { appearance: { preset: "Carbon", trading: { buy: "#22c55e", sell: "#f43f5e" } }, }); terminal.appearance.presets().then((presets) => console.log(presets.map((p) => p.label))); ``` `appearance` takes one of Chartnaut's theme presets plus anything a chartbook can set: theme colours, trading colours, chart and series settings. It applies to this terminal only and is never saved into the user's own Chartnaut. `appearance.applyPreset(name)` switches preset; `appearance.set(null)` goes back to the user's own look. --- # Scripts URL: https://docs.chartnaut.com/sdk/scripts/ Updated: 2026-11-22T22:29:01Z Add indicators, definitions, insights and Pine scripts to a chart, read their values, react to their events and hold the replay on them. Any script a Chartnaut chart can run, your code can add: a built-in [indicator](https://docs.chartnaut.com/guides/how-indicators-work) by name, a [definition](https://docs.chartnaut.com/guides/build-a-definition) or insight from the user's library, your app's own scripts, or source code you send, in Chartnaut's [scripting language](https://docs.chartnaut.com/scripting/overview) or Pine Script. ## Add one ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { charts: { main: { symbol: "NAS100", timeframe: "15m" } }, }); const main = terminal.chart("main"); async function addScripts() { const rsi = await main.scripts.add("RSI", { length: 14 }); // a built-in, by name const breakout = await main.scripts.add({ id: "flw_4" }); // a definition from the library const mid = await main.scripts.add({ source: '//@version=5\nindicator("Mid")\nplot(hl2)', language: "pine" }); await rsi.update({ inputs: { length: 21 } }); await mid.hide(); breakout.on("event", (e) => console.log("Breakout at", e.data.start_time)); } addScripts(); ``` What `add` takes: | You pass | What it adds | |---|---| | `"RSI"` | A built-in, by name | | `"ind_61"`, `{ id: "flw_4", version: 3 }` | A script from the user's library or your app, by id (`ind_` indicators, `flw_` definitions, `ins_` insights), optionally pinned to a version | | `{ source, language: "pine" }` | Pine Script v5 or v6, run without saving | | `{ source }` | Chartnaut code, run without saving | `add` resolves with a script handle once the script is drawn. `{ wait: "settled" }` waits until it has calculated its whole history. Someone else's script from the community opens Chartnaut's consent sheet first, so `add` waits for the person's answer. | On the handle | What it does | |---|---| | `update({ inputs, style, profile })` | Changes its settings; only what you pass changes | | `hide()`, `show()`, `remove()` | | | `values({ from, to })`, `values({ at })` | Its outputs over a window, or at one moment | | `ready({ wait: "settled" })` | Resolves once it's ready, or settled | | `on("event" \| "ready" \| "error" \| "change" \| "removed")` | Its events | | `status`, `instance`, `inputs`, `visible` | Where it is now. `instance` is its `si_` id on this chart | ## In React `useScript` adds a script when the component mounts, updates its inputs when they change and removes it when the component goes: ```tsx import { useState } from "react"; import { Ready, useChart, useScript, useTerminal } from "@chartnaut/charts/react"; export function RsiControl() { const terminal = useTerminal(); const main = useChart(terminal, "main"); const [length, setLength] = useState(14); const rsi = useScript(main.chart, "RSI", { length }); return ( Adding RSI…}> setLength(Number(e.target.value))} /> ); } ``` ## Read the values ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { charts: { main: { symbol: "NAS100", timeframe: "1h" } }, }); async function lastRsi() { const rsi = await terminal.chart("main").scripts.add("RSI", { length: 14 }, { wait: "settled" }); const out = await rsi.values({ from: 1789400000, to: 1789471800 }); const points = out.series[0]?.points ?? []; console.log("Last RSI", points[points.length - 1]?.value); } lastRsi(); ``` `values` answers `series` (an indicator's lines), `events` (a definition's), `markers` and `layers`, never past the replay clock. In a backtest, the script's numbers stop where the replay is: nothing from the future reaches your code. ## React to events, and hold the replay A definition fires `event` each time its setup happens on a closed bar. In a backtest, `{ hold: true }` pauses the replay on that bar until your handler is done, so a drill can ask a question before the next bar: ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { charts: { main: { symbol: "NAS100", timeframe: "5m" } }, }); async function drill() { const breakout = await terminal.chart("main").scripts.add({ id: "flw_4" }); breakout.on( "event", async (e) => { const answer = await askTrader("Breakout. Long, short or wait?"); await saveToJournal({ at: e.data.start_time, answer }); }, { hold: true }, ); await terminal.replay.play({ speed: 4 }); } drill(); ``` Only script events and fills can hold. If your handler throws, the replay stays paused and the error goes to the console. The terminal gives up after 60 seconds and stays paused. In a partner session the hold needs the session's `page_control` to allow the replay. `terminal.scripts.on("event", ...)` hears every script on every chart; `chart.scripts.on("added", ...)` hears the scripts the person adds themselves. ## Check and save your own code ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, {}); const source = '//@version=5\nindicator("Mid")\nplot(hl2)'; async function check() { const result = await terminal.scripts.validate(source, "pine"); console.log(result); await terminal.scripts.save(source, "Mid", "pine"); // into the person's library, private } check(); ``` ## Your app's scripts Indicators, definitions and insights you publish to your app show in the script picker under your app's name, only inside your app, and never in the community. You can keep their source hidden: they run, but nobody can open them. Publish them from your server with `cn.scripts.publish` ([`@chartnaut/node`](https://docs.chartnaut.com/sdk/users)) or the partner API's `/scripts` routes. Any developer plan can publish them. `cn.scripts.publish({ script })` takes the script's id. `chartnaut ls` lists it, and `chartnaut push` prints it after a save: ```sh chartnaut push ./acme-vwap # pushed acme-vwap@1 # id: ind_1298 ``` --- # Drawings and overlays URL: https://docs.chartnaut.com/sdk/drawings-and-overlays/ Updated: 2026-11-22T22:29:01Z Draw lines, zones, fibs, text and markers with the chart's own tools, hear the drawings your users make, and show your own data as overlays. Two ways to put your own marks on a chart: | | Drawings (`chart.draw`) | Overlays (`chart.overlays`) | |---|---|---| | What they are | The chart's own drawing tools: a line looks and behaves like one the person drew | Your data, drawn by the chart: many points at once | | Saved | Yes, with the chart, like the person's own | Never. Gone when the terminal reloads | | The person can | Select and move them, unless you lock them | Only look at them | | Use them for | A stop line, a zone to watch, a note | Signals from your database, a series of levels, your own indicator's line | ## Drawings ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { charts: { main: { symbol: "NAS100", timeframe: "15m" } }, }); const main = terminal.chart("main"); async function mark() { const stop = await main.draw.hline(21480, { text: "Stop", style: { color: "#f43f5e", line_style: "dashed" }, locked: true }); await main.draw.zone({ time: 1789462800, price: 21540 }, { time: 1789471800, price: 21510 }, { style: { fill: "rgba(59,130,246,0.15)" } }); await main.draw.markers([ { time: 1789466400, price: 21512, text: "Entry", style: { shape: "arrow_up" } }, { time: 1789470000, price: 21590, text: "Exit", style: { shape: "arrow_down" } }, ]); await stop.update({ points: [{ price: 21495 }] }); // move it } mark(); ``` | Call | Draws | |---|---| | `draw.hline(price)`, `draw.vline(time)` | A horizontal or vertical line | | `draw.line(a, b)`, `draw.ray(a, b)`, `draw.arrow(a, b)` | Between two points | | `draw.rect(a, b)`, `draw.zone(a, b)` | A box; a zone has a fill and no border | | `draw.fib(a, b)` | A Fibonacci retracement | | `draw.text(at, text)`, `draw.priceLabel(at)` | Text at a point | | `draw.marker(at)`, `draw.markers([...])` | A dot or an arrow; many in one call | | `draw.many([...])` | Any kinds in one call. One bad drawing refuses them all | A point is `{ time, price }`, with time in unix seconds, a `Date` or ISO text with an offset. Each call returns a handle with `update`, `remove` and `select`. Give a drawing your own `id` to find it after a reload with `chart.drawings.handle(id)`, and `clientId` so a retry never draws twice. ## The person's drawings ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { charts: { main: { symbol: "NAS100", timeframe: "15m" } }, }); const main = terminal.chart("main"); main.drawings.on("created", (e) => { if (e.data.by === "user") console.log("They drew", e.data.drawing?.kind, e.data.drawing?.points); }); async function tidy() { const all = await main.drawings.get(); console.log(all.length, "drawings"); await main.drawings.clear({ onlyMine: true }); // only yours, the person's stay } tidy(); ``` `get` lists every drawing on the chart with `by: "user"` or `by: "app"`. Events: `created`, `updated`, `removed`, `selected`. ## Overlays ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { charts: { main: { symbol: "NAS100", timeframe: "5m" } }, }); async function showSignals() { const signals = await terminal.chart("main").overlays.add( "markers", [ { time: 1789466400, price: 21512, text: "Long" }, { time: 1789470000, price: 21590, text: "Flat" }, ], { style: { color: "#22c55e" } }, ); await signals.append([{ time: 1789471800, price: 21600, text: "Long" }]); } showSignals(); ``` Four kinds: `markers` (`time`, `price`, `text`), `line` (`time`, `value`, up to 5,000 points), `levels` (`price`, optionally `from` and `to`) and `zones` (`from`, `to`, `top`, `bottom`). `update` replaces the data, `append` adds to it, `remove` takes it off. --- # Symbols and data URL: https://docs.chartnaut.com/sdk/symbols-and-data/ Updated: 2026-11-22T22:29:01Z Search markets, read what a user may open, order sizes in lots, contracts or units, closed bars, live quotes, screenshots and watchlists. The terminal hands your code the same market data its charts show: what each market is, its order sizes, closed bars, live quotes and pictures of the charts. Everything is cut at the replay clock in a backtest. ## Find a market ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, {}); async function find() { const hits = await terminal.symbols.search("nasdaq", { market: "index", limit: 5 }); console.log(hits.map((h) => `${h.symbol} ${h.name}`)); const nas = await terminal.symbols.get("NAS100"); console.log(nas.tick_size, nas.coverage, nas.available.history_start, nas.egress); } find(); ``` `search` matches the way Chartnaut's market picker does and only returns markets this user can see here. `get` takes a symbol, an alias or a `sym_` id and answers what the market is (`tick_size`, `contract_multiplier`, `sessions`, `coverage`), what this user may open (`available`: how far back their plan's history goes, futures, order flow) and `egress`: how far its numbers may leave the terminal for your code. | `egress` | Your code gets | |---|---| | `full` | Bars, quotes and script values | | `images` | Screenshots only | | `none` | Nothing beyond the chart itself | A read refused for this reason fails with [`data_not_exportable`](https://docs.chartnaut.com/sdk/errors#data_not_exportable). ## Order sizes: lots, contracts or units Every size carries its unit, and each market takes one. Ask the market before you send a size: ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, {}); async function smallestBuy(symbol: string) { const { order_size } = await terminal.symbols.get(symbol); if (!order_size) return; // EURUSD: { unit: "lots", min: 0.01, max: 100, step: 0.01 } await terminal.orders.buy(symbol, { quantity: { quantity: order_size.min, unit: order_size.unit } }); } smallestBuy("EURUSD"); ``` `order_size` is `{ unit, min, max, step }`, where `unit` is `lots`, `contracts` or `units`. The unit belongs to the account, not the instrument: MetaTrader accounts trade lots. A size outside these is refused with [`invalid_args`](https://docs.chartnaut.com/sdk/errors#invalid_args), and the market's sizes come with the error in `details.order_size`. ## Bars ```ts import { createTerminal, rows } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { charts: { main: { symbol: "NAS100", timeframe: "15m" } }, }); async function lastBars() { const bars = await terminal.chart("main").bars({ count: 200 }); const last = rows(bars).pop(); console.log(bars.symbol, bars.timeframe, last?.c); const daily = await terminal.bars({ symbol: "EURUSD", timeframe: "1d", from: "2026-09-01T00:00Z" }); console.log(daily.t.length, "days"); } lastBars(); ``` Bars come in columns (`t`, `o`, `h`, `l`, `c`, `v`, time in unix seconds); `rows()` turns them into one object per bar. Only closed bars, never past the replay clock. `chart.bars()` reads a chart's market and timeframe, or another timeframe with `{ timeframe }`. `chart.on("barClose")` hears each new closed bar. Bars count against your plan's data allowance: `capabilities.sdk_limits` says how many a request and an hour ([Plans and limits](https://docs.chartnaut.com/sdk/plans-and-limits)). ## Live quotes In a live terminal (not a backtest, where prices are the replay's): ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, {}); async function ticker() { await terminal.ready; if (terminal.capabilities?.mode !== "live") return; // a backtest's prices are the replay's const off = await terminal.quotes.subscribe(["BTC", "ETH"], (q) => console.log(q.symbol, q.last, q.change_percent)); setTimeout(off, 60_000); } ticker(); ``` In React, `useQuote(terminal, "BTC")` re-renders at most once a frame. A backtest refuses quotes with [`not_allowed`](https://docs.chartnaut.com/sdk/errors#not_allowed). ## Screenshots ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { charts: { main: { symbol: "NAS100", timeframe: "15m" } }, }); async function snap() { const shot = await terminal.screenshot({ chart: "main", scale: 2 }); const img = document.createElement("img"); img.src = URL.createObjectURL(shot.image); document.body.append(img); } snap(); ``` The whole layout, or one chart, as Chartnaut draws it, with the date only. At most one every 2 seconds. ## Watchlists In a live terminal, `terminal.watchlists` reads and edits the person's own watchlists: `list`, `get`, `create`, `rename`, `add`, `remove`, `reorder`, and `on("change")`. --- # Replay, orders and the account URL: https://docs.chartnaut.com/sdk/replay-orders-account/ Updated: 2026-11-22T22:29:01Z Drive a backtest from your code: play and step the replay, place orders by size or risk, move stops, close half, lock trading and read the account. In a backtest your code can run the replay, trade, and read the account. Orders go through the same backtest engine as Chartnaut's own order ticket: the same prices, the same rules. None of this reaches a broker. Your code can use these in the user's own backtests, and in a partner session whose `page_control` allows it: `"replay"` for the replay, `"replay_and_orders"` for both. Otherwise they are refused with [`not_allowed`](https://docs.chartnaut.com/sdk/errors#not_allowed) and `reason: "partner_session"`. `terminal.can("orders.place")` and `terminal.can("replay.control")` say which before you try. Users can't start a backtest inside your terminal. Your server opens one for them by key: see [Users](https://docs.chartnaut.com/sdk/users#backtests-by-key). ## The replay ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { charts: { main: { symbol: "NAS100", timeframe: "5m" } }, }); async function openingHour() { await terminal.replay.jumpTo("2026-09-15T09:30-04:00"); await terminal.replay.play({ speed: 4 }); // bars a second, 0.5 to 10 await terminal.replay.until("2026-09-15T10:30-04:00"); await terminal.replay.pause(); console.log("Stopped at", terminal.replay.time); } openingHour(); ``` | Call | What it does | |---|---| | `play({ speed })`, `pause()` | Plays at `speed` bars a second, or stops | | `step(bars)` | Steps 1 to 500 closed bars | | `setSpeed(barsPerSecond)` | 0.5 to 10 | | `jumpTo(time)` | Jumps. Refused with open positions unless `{ positions: "close" }` | | `until(time)` | Resolves when the replay reaches `time`, by playing, stepping or jumping. Doesn't move it | | `time`, `playing`, `speed` | Where it is now. `useReplay(terminal)` gives the same as React state | Events: `tick` (at most 10 a second), `play`, `pause`, `speed`, and `end` when the session ends. To pause on a script's event until your code is done, see [holding the replay](https://docs.chartnaut.com/sdk/scripts#react-to-events-and-hold-the-replay). ## Orders ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { charts: { main: { symbol: "NAS100", timeframe: "5m" } }, }); async function trade() { const pos = await terminal.orders.buy("NAS100", { quantity: { quantity: 2, unit: "contracts" }, stop: 21480, target: 21620, clientId: "setup-41" }); pos.on("pnl", (e) => console.log(`${e.data.r}R`)); await pos.moveStop(21500); await pos.close({ half: true }); // Or let the terminal size it: lose 1% of the balance if the stop is hit. await terminal.orders.sell("EURUSD", { risk: "1%", stop: 1.095 }); } trade(); ``` `buy` and `sell` take a size or a risk: | Option | What it does | |---|---| | `quantity: { quantity, unit }` | A size, always with its unit. [Order sizes](https://docs.chartnaut.com/sdk/symbols-and-data#order-sizes-lots-contracts-or-units) | | `risk: "1%"` or `risk: 250` | Sized by the terminal so hitting `stop` loses 1% of the balance, or 250 in the account's currency. Needs `stop`. Uses the ticket's own maths, so currency and contract sizes match the app | | `stop`, `target` | Prices | | `type: "limit" \| "stop"`, `price` | A resting order; market by default | | `clientId` | A retry with the same id, even after a reload, answers the first order instead of placing another | Each resolves with a position handle: `moveStop`, `moveTarget`, `setProtection`, `close()` (all of it, `{ half: true }` rounded down to the size step, or `{ quantity }`), `get()`, and events `pnl` (at most 4 a second), `fill` and `closed`. Also on `terminal.orders`: `place` (the raw order), `modify`, `cancel`, `cancelAll` (resting entries; stops and targets stay), `closeAll`, `list`, `position(id)` for a position you already have the id of, and events `placed`, `fill`, `changed`, `cancelled`, `closed`, `locked`, `unlocked` and `refused`. `await terminal.orders.next("fill")` resolves with the next one. ## Your own risk lock ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, {}); terminal.account.on("change", (e) => { const open = e.data.open_pnl?.amount ?? 0; if (open < -300 && !terminal.orders.locked) void terminal.orders.lock("Daily loss limit reached"); }); ``` While locked, every new order is refused with [`locked_by_app`](https://docs.chartnaut.com/sdk/errors#locked_by_app), from your code and from the terminal's order ticket, and the ticket shows your reason. Closing, moving a stop or target and cancelling still work: a lock never keeps someone in a losing trade. `unlock()` lifts it. The lock lives in the terminal's page, so a reload or another session clears it: lock again on load if you still want it. Rules a partner sets on a session are separate and live on the server. ## The account ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, {}); async function report() { const account = await terminal.account.get(); const open = await terminal.account.positions(); const closed = await terminal.account.trades({ from: 1789400000 }); console.log(account, open.length, "open,", closed.length, "closed"); } report(); ``` `account.get()` reads the balance, equity and open P&L. `positions()` and `trades()` read once; `watchPositions` (or `usePositions` in React) keeps the open positions live, with each position's P&L merged in as it moves. Everything is cut at the replay clock. Prices and P&L reach your code only when the user granted the read permission. Without it, events carry ids only. ## An auto-journal ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, { charts: { main: { symbol: "NAS100", timeframe: "5m" } }, }); terminal.orders.on("closed", async (e) => { const image = await terminal.screenshot({ chart: "main" }); await saveToJournal({ trade: e.data, image: image.image }); }); ``` Events are hints. For a record that matters, run the backtest as a session your server creates ([`cn.sessions.create`](https://docs.chartnaut.com/sdk/users)) and read the trade with `cn.sessions.trades(id)` once the event arrives, or when `session.ended` reaches your webhook. A backtest your page opens by key belongs to the user: your server can't read its trades, so the page's own record is the one you keep. --- # Workspace and persist URL: https://docs.chartnaut.com/sdk/workspace-and-persist/ Updated: 2026-11-22T22:29:01Z Where each user's layout, charts, scripts and drawings are kept: their browser, their Chartnaut account, your own database, or nowhere. The workspace is everything a user sets up in the terminal: the layout, each chart's market, timeframe and scripts, their drawings, the panels and link groups. `persist` decides where it is kept. | `persist` | Kept in | Use it when | |---|---|---| | `"device"` (the default) | The user's browser | You want nothing to set up | | `"account"` | A chartbook in the user's own Chartnaut account, named after your app | Your users are linked to Chartnaut and should find their setup on chartnaut.com too | | `{ load, save }` | Your own database | You want each user's setup on your side, on any device | | `"none"` | Nowhere | Every visit starts fresh, such as a drill | `"account"` works for linked users only: [managed users](https://docs.chartnaut.com/sdk/users) have no chartbooks. ## In your own database ```tsx import { Terminal, useTerminal, useWorkspace } from "@chartnaut/charts/react"; export function SavedTerminal({ userId }: { userId: string }) { const terminal = useTerminal(); const saving = useWorkspace(terminal); return (
{saving.status === "saved" ? "Saved" : saving.status === "saving" ? "Saving…" : ""} loadWorkspace(userId), save: (w) => saveWorkspace(userId, w) }} />
); } ``` `load` runs once before the terminal opens; return the workspace you saved, or nothing for a first visit. `save` runs on every change with the whole workspace and `{ revision, changes, cause, keepalive }`. A failed save is tried again with backoff, and `status` shows `error` until one succeeds. When the tab closes, `keepalive` is true: start a `fetch(..., { keepalive: true })` or a beacon right away. Chartnaut keeps nothing in this mode. ## The format ```json { "v": 1, "layout": { "direction": "row", "sizes": [60, 40], "children": ["main", "htf"] }, "charts": { "main": { "instrument": { "id": "sym_4812", "symbol": "NAS100" }, "timeframe": "5m", "type": "candlesticks", "scripts": [{ "ref": { "id": "ind_61" }, "inputs": { "length": 14 } }] }, "htf": { "instrument": { "id": "sym_4812", "symbol": "NAS100" }, "timeframe": "4h", "type": "candlesticks" } }, "links": [{ "id": "a", "charts": ["main", "htf"], "link": ["symbol"] }], "focused_chart": "main" } ``` Store it as it is. `v` is the format's version: Chartnaut loads every version it has ever written, forever, so a workspace you saved years ago still opens. Markets are kept by their stable id and symbol, so a renamed market still loads. A script ref without a version follows the script's updates; with one, it stays pinned. Parts that can't load any more (a script that was deleted, a market the user's plan no longer reaches) are skipped, and the terminal says which in `workspace_warning` events. ## Read or change it from code ```ts import { createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, {}); async function resetCharts() { const { workspace, revision } = await terminal.workspace.get(); console.log("Revision", revision, Object.keys(workspace)); const result = await terminal.workspace.patch({ charts: { htf: null } }); // drops one chart result.warnings.forEach((w) => console.warn(w.path, w.message)); } resetCharts(); ``` `get` reads it, `set` replaces all of it, `patch` merges: sections you leave out stay, and `charts` and `panels` merge by id, with `null` removing one. --- # Testing URL: https://docs.chartnaut.com/sdk/testing/ Updated: 2026-11-22T22:29:01Z Test your app's terminal code without a terminal: createMockTerminal records every command, answers them, and emits events when your test says. `@chartnaut/charts/testing` gives you a terminal without a frame, for your own tests. `createMockTerminal()` returns the same terminal object your code gets from `` or `createTerminal`. It records every command your code sends, answers it, and emits events when your test tells it to. ## A first test Write your terminal code as functions that take a terminal. Your page passes the real one; your tests pass the mock. ```ts import { expect, test } from "vitest"; import type { Terminal } from "@chartnaut/charts"; import { createMockTerminal } from "@chartnaut/charts/testing"; // Your code: lock trading once open losses pass 300. function lockOnLoss(terminal: Terminal) { return terminal.account.on("change", (e) => { if ((e.data.open_pnl?.amount ?? 0) < -300) void terminal.orders.lock("Daily loss limit reached"); }); } test("locks orders past a 300 loss", async () => { const terminal = createMockTerminal(); lockOnLoss(terminal); terminal.emit("ready"); terminal.emit("account_changed", { at: 1789471800, open_pnl: { amount: -320, currency: "USD" } }); await Promise.resolve(); expect(terminal.commands).toContainEqual(expect.objectContaining({ name: "lock_orders", args: { reason: "Daily loss limit reached" } })); }); ``` | On the mock | What it does | |---|---| | `emit(type, fields)` | Emits an event as the terminal would, with `seq`, `event_id` and `time` filled in. Fields you pass win | | `commands` | Every command sent, in order: `{ id, name, args }` | | `events` | Every event emitted, in order | | `handle(name, fn)` | Answers a command your way from now on: return the result, or throw a `ChartnautCommandError` | | `reload()` | A new frame load: a new boot, `seq` back to 1, `hello` emitted | | `setTime(seconds)` | The time events get when you don't give one | The mock is booting until you `emit("ready")`, as a real terminal is. Unlike a real one, it answers commands at once, ready or not. ## Refusals ```ts import { expect, test } from "vitest"; import { ChartnautCommandError } from "@chartnaut/charts"; import { createMockTerminal } from "@chartnaut/charts/testing"; test("an order the session's rules refuse", async () => { const terminal = createMockTerminal({ handlers: { place_order: () => { throw new ChartnautCommandError("rule_blocked", "The daily loss rule stops new orders today.", "place_order"); }, }, }); terminal.emit("ready"); await expect(terminal.orders.buy("NAS100", { quantity: { quantity: 1, unit: "contracts" } })).rejects.toMatchObject({ code: "rule_blocked" }); }); ``` ## What the user may do The mock starts as a Pro user in a partner session who may place orders and drive the replay. Change any part with `capabilities`: ```ts import { expect, test } from "vitest"; import { createMockTerminal } from "@chartnaut/charts/testing"; test("hides the Buy button when orders aren't allowed", async () => { const terminal = createMockTerminal({ capabilities: { orders: { place: { yes: false, reason: "Orders are off in this session" } } } }); terminal.emit("ready"); await terminal.ready; expect(terminal.can("orders.place")).toEqual({ yes: false, reason: "Orders are off in this session" }); }); ``` ## Charts, scripts and orders The mock keeps a small model of the terminal. The `layout` and `charts` you give it are laid out at once, and chart commands answer with their events (`setSymbol` sends `symbol_changed` with `cause: "command"`). Scripts, drawings, bars, the replay and orders answer with plausible results, so code that reads them runs end to end. ```ts import { expect, test } from "vitest"; import { createMockTerminal } from "@chartnaut/charts/testing"; test("follows the chart's symbol", async () => { const terminal = createMockTerminal({ charts: { main: { symbol: "NAS100", timeframe: "5m" } } }); const seen: (string | null)[] = []; terminal.chart("main").on("symbolChange", (e) => seen.push(e.data.symbol)); terminal.emit("ready"); await terminal.chart("main").setSymbol("EURUSD"); expect(seen).toEqual(["EURUSD"]); }); ``` ## React Hooks take the terminal as their first argument, so a component under test can use the mock where your page uses `useTerminal()`. Pass it in as a prop, or through your own context. The examples on these docs pages are checked the same way: each one compiles against the SDK's types, and the plain TypeScript ones run against `createMockTerminal()`. --- # Users URL: https://docs.chartnaut.com/sdk/users/ Updated: 2026-11-22T22:29:02Z Who signs in to your terminal: linked users with their own Chartnaut account, or managed users you create on Business. frameRoute, cn.links, cn.users and cn.frames. Every terminal opens for one user. Your server decides who, per person, with `@chartnaut/node`. Your page's code is the same either way. | | Linked users | Managed users | |---|---|---| | Who they are | People with their own Chartnaut account, any plan, who link it to their account on your site | Accounts you create for your customers, with no Chartnaut sign-up | | How they start | Your terminal shows **Sign in with Chartnaut**; they approve what your app may do | Your server creates them; the terminal opens straight away | | Plan | Their own Chartnaut plan | A Free-level or Pro-level seat you choose per user | | Their setup | `persist: "account"` keeps it in their own Chartnaut | No chartbooks: use `"device"`, `"none"` or your own `{ load, save }` | | Needs | Any developer plan | Business | Both get their terminal address from the same call, and your page renders the same ``. ## The route `` asks `` with no `frameUrl` asks `/api/chartnaut/frame` on your own site. `frameRoute` answers it for whoever is signed in: ```ts // app/api/chartnaut/frame/route.ts import { frameRoute } from "@chartnaut/node"; export const GET = frameRoute({ getUser: async () => (await auth())?.user.id ?? null, whenNotLinked: { link: { scopes: ["frame:instant", "terminal:read", "terminal:write"] } }, }); ``` `getUser` returns your own id for the person, which becomes `ext:` on the API, or null when nobody is signed in (the route answers 401). It can also return a Chartnaut id (`usr_…`), or a whole grant: `{ user, session }` or `{ user, backtest }`. What happens to someone not linked yet: | `whenNotLinked` | What they get | |---|---| | `"error"` (the default) | `404 not_linked` | | `{ link: { scopes } }` | A link: the terminal shows **Sign in with Chartnaut** and opens once they approve | | `"managed"` | A managed user is created for your id (Business), then the terminal | Frame addresses are cached in memory until an hour before they expire, so the route calls Chartnaut about once a day per user, not once a visit. When the terminal's sign-in is refused it asks again with `?refresh=1`, and the route skips the cache. With Express use `frameRouteExpress`, and with a plain Node `http` server or the Next.js Pages Router `frameRouteNode`. Both take the same options. ## Permissions A link asks the user for scopes. They see them on the consent screen and can untick any you don't mark `required_scopes`. | Scope | What the user sees | |---|---| | `frame:instant` | Open Chartnaut inside your app without signing in each time | | `terminal:read` | See what they do in your app's Chartnaut: charts, scripts, drawings, watchlists and backtest trades | | `terminal:write` | Change their charts, scripts, drawings and watchlists, and place orders in their own backtests | | `frame:live` | Show them live Chartnaut charts inside your app | | `sessions:write`, `sessions:read` | Create backtests for them, and see their trades, P&L and rule breaks | | `demo_accounts:write`, `demo_accounts:read` | Create demo accounts for them, and see them | | `accounts:read` | See their own broker accounts: balances, open positions and closed trades, any broker. Read only | | `alerts:read` | See when their Chartnaut alerts go off | [Linking](https://docs.chartnaut.com/cli/partner-linking) has the consent flow in full. You switch on the frame, terminal and sessions scopes yourself. The demo account, broker account and alert scopes work in Test, and need Chartnaut's approval before your app can ask for them in Live: request them on your [project's](https://docs.chartnaut.com/sdk/projects) **Permissions** tab in Developers. ## Linking from your own button ```ts import { Chartnaut } from "@chartnaut/node"; const cn = new Chartnaut(); // reads CHARTNAUT_SECRET_KEY export async function connectUrl(userId: string, email: string) { const link = await cn.links.create({ external_user_ref: userId, scopes: ["frame:instant", "terminal:read", "terminal:write"], account_label: email, }); return link.connect_url; // or link.frame_url in an iframe } ``` `account_label` is your name for the person, shown masked beside their Chartnaut account on the consent screen, so nobody links someone else's account by mistake. ## Managed users ```ts import { Chartnaut } from "@chartnaut/node"; const cn = new Chartnaut(); export async function openFor(customerId: string) { await cn.users.create({ external_ref: customerId, name: "Sam" }); await cn.users.update(`ext:${customerId}`, { level: "pro", features: { order_flow: false } }); const { frame_url } = await cn.frames.url({ user: `ext:${customerId}`, persist: "none" }); return frame_url; } ``` A managed user is a seat on your Business bundle, at Free level or Pro level. You can switch features off per user at no charge. Seats count only when the user is active that month. [Plans and limits](https://docs.chartnaut.com/sdk/plans-and-limits) ## Backtests by key Users can't start a backtest inside your terminal: your server gives them one. Name it with your own key. The first time, Chartnaut creates it (a normal backtest owned by the user, tagged with your app so your page may trade in it); every later time, it opens the same one. ```ts import { frameRoute } from "@chartnaut/node"; export const GET = frameRoute({ getUser: async () => (await auth())?.user.id ?? null, frameOptions: (req) => ({ backtest: { key: `drill-${new URL(req.url).searchParams.get("drill")}`, start: "2026-09-01", end: "2026-09-05" }, }), }); ``` Use a new key for a new attempt. The user's plan still applies: a start before their plan's history is refused with `plan_limit`. For competitions and other sessions with rules, create a partner session on your server with `cn.sessions.create` and open it with `{ user, session }`. See [Sessions](https://docs.chartnaut.com/cli/partner-sessions) and [Rules](https://docs.chartnaut.com/cli/partner-rules). ## Their accounts Demo accounts you create for a user, and the user's own broker accounts you can read (balances, open positions and closed trades), are on [Accounts](https://docs.chartnaut.com/sdk/accounts). ## The client `new Chartnaut({ key })` wraps every partner API route, with retries, typed errors and an `Idempotency-Key` on every POST: | Area | Methods | |---|---| | `cn.users` | `create` (managed), `get`, `list`, `iterate`, `update` (managed), `export`, `getExport`, `delete` (managed), `disconnect` (linked), `alertFires` | | `cn.links` | `create` | | `cn.frames` | `url`, `forget` | | `cn.sessions` | `create`, `createBatch`, `list`, `iterate`, `get`, `update`, `trades`, `breaches`, `actions`, `end`, `lock`, `unlock` | | `cn.accounts` | Demo accounts: `create`, `list`, `get`, `trades`, `lock`, `unlock`, `closeAll` and more. The user's own: `listUserAccounts`, `getUserAccount`, `positions`, `trades` | | `cn.scripts` | `publish`, `list`, `unpublish` | | `cn.webhooks` | `verify`, `verifyRequest`, `test` | Every failure is a `ChartnautApiError` with a `code` from [Errors](https://docs.chartnaut.com/sdk/errors). The full partner API is in the [API reference](https://docs.chartnaut.com/sdk/api-and-openapi). --- # Accounts URL: https://docs.chartnaut.com/sdk/accounts/ Updated: 2026-11-22T22:29:02Z Demo accounts you create for challenges and live competitions, and the user's own broker accounts you can read: balances, open positions and closed trades. cn.accounts. Two kinds of account reach your server: **demo accounts** you create for a user, to run a challenge or a live competition, and **the user's own broker accounts**, which you can read. Both are `cn.accounts` in `@chartnaut/node`, and both take ids like `acc_5521`. | | Demo accounts you create | The user's own accounts | |---|---|---| | What they are | Chartnaut demo accounts trading live prices with simulated money | Their Chartnaut Demo account and every broker account they linked (MT4, MT5, cTrader, TradeLocker, Rithmic) | | Permissions the user grants | `demo_accounts:write` to create and act, `demo_accounts:read` to read | `accounts:read` | | You can | Create, read, lock, unlock, close everything, label | Read the balance, open positions and closed trades. Nothing else | | Where the user trades | In Chartnaut, among their accounts | Wherever they trade today | All three permissions are restricted. They work in Test straight away; for Live, open your project's **Permissions** tab and click **Request access** beside each under **Ask us for more**. Add them to the scopes your [link](https://docs.chartnaut.com/sdk/users#permissions) asks for. A user who linked before you added one links again to grant it. ## Demo accounts ```ts import { Chartnaut } from "@chartnaut/node"; const cn = new Chartnaut(); // reads CHARTNAUT_SECRET_KEY const account = await cn.accounts.create({ user: "ext:user-8812", display_name: "Live week", starting_balance: 25_000, leverage: 100, rules: [ { type: "daily_loss", limit: 1000, on_breach: "block_order" }, { type: "max_drawdown", limit: 2500, mode: "trailing", on_breach: "close_and_end" }, ], labels: { event: "live-week" }, }); console.log(account.id); // acc_… ``` - **Locked by default.** A new account is locked until you unlock it, so a whole event opens at once. Send `locked: false` to open it straight away. While it's locked, the user sees it among their accounts marked **Locked by** your project's name. - **Defaults:** USD, a starting balance of 100,000 and leverage of 50. `display_name` is required, up to 64 characters. - **Rules** are the same as for backtests: daily loss, max drawdown, max position size, max open positions and profit target. See [rules](https://docs.chartnaut.com/cli/partner-rules). - **Limits:** each user holds up to 5 active or locked accounts from you, and you 2,000 in all. Demo accounts never use the user's plan slots. - **In batches:** `cn.accounts.createBatch(items)` takes up to 500 and answers each one on its own. The user trades the account in Chartnaut itself, not in the terminal on your page: in your page's terminal, orders place in backtests only. ### Read them ```ts import { Chartnaut } from "@chartnaut/node"; const cn = new Chartnaut(); const id = "acc_5521"; const live = await cn.accounts.get(id); console.log(live.balance, live.valuation?.equity, live.positions?.length); const { data: closed } = await cn.accounts.trades(id, { since: "2026-11-17T00:00:00Z" }); const { data: breaches } = await cn.accounts.breaches(id); const { data: entrants } = await cn.accounts.list({ labels: { event: "live-week" } }); ``` `get` has the balance, a `valuation` (equity, floating P&L and margin at the latest prices), the open `positions`, lock state, rules and a breaches summary. A list item has the balance, lock state and rules only: read each account for its equity. Trades and breaches come newest first, a page at a time. ### Lock, unlock and close everything ```ts import { Chartnaut } from "@chartnaut/node"; const cn = new Chartnaut(); const cup = { labels: { event: "live-week" }, expected_count: 120 }; await cn.accounts.unlock(cup); // the event opens await cn.accounts.closeAll(cup); // the event ends: locks, then closes every position at market ``` By labels, `expected_count` is required: if a different number of accounts match, nothing happens and you get `409 expected_count_mismatch`, so a mistyped label can't touch the wrong accounts. Each account answers on its own: `locked`, `unlocked`, `closed`, `closing` (positions still closing, for example in a closed market: read it later), `already`, `not_found` or `error`. - **Lock** freezes the account. Nothing places, changes, cancels or fills. A margin stop-out still runs. - **Unlock** lets trading resume. - **Close everything** locks the account, cancels entries that haven't filled and closes the rest at market. It's safe to run twice. When a user unlinks, the accounts you made for them lock. Full field-by-field detail: [Demo accounts](https://docs.chartnaut.com/cli/partner-demo-accounts). ## Their own broker accounts ```ts import { Chartnaut } from "@chartnaut/node"; const cn = new Chartnaut(); const { data: accounts } = await cn.accounts.listUserAccounts("ext:user-8812"); for (const a of accounts) { const { data: open } = await cn.accounts.positions(a.id); const { data: closed } = await cn.accounts.trades(a.id, { since: "2026-11-01T00:00:00Z" }); console.log(a.broker, a.display_name, a.balance, open.length, "open,", closed.length, "closed"); } ``` - **The list** has each account's `broker` (such as `chartnaut_demo`, `mt5` or `ctrader`), `display_name`, `currency`, `balance`, `equity`, `starting_balance`, `leverage` and `created_at`, oldest first. Accounts you created aren't in it. - **One account:** `cn.accounts.getUserAccount(id)`. - **Open positions:** `cn.accounts.positions(id)`, each with the instrument, the broker's own symbol, side, quantity, entry price and when it opened. - **Closed trades:** `cn.accounts.trades(id)`, newest first, in the same shape as a demo account's. Balances and positions are as Chartnaut last stored them from the broker. It's read only: nothing here can place, change or close anything on a user's own account. An account of someone who isn't linked to your project reads as `404 not_found`; a linked user who didn't grant `accounts:read` is `403 scope_not_granted`. Every call above is in the [API reference](https://docs.chartnaut.com/sdk/api-and-openapi), with the [errors](https://docs.chartnaut.com/sdk/errors) it can answer. --- # Webhooks URL: https://docs.chartnaut.com/sdk/webhooks/ Updated: 2026-11-22T22:29:02Z Hear on your server when a user links, a session ends or a rule breaks, and check each delivery's signature in one line with verifyRequest. Webhooks tell your server that something changed: a user linked or unlinked, a session ended, a rule broke. They name it by type and id; read the object with the API before you act on it. Deliveries come at least once, in no set order, and can be late. Add endpoints on your [project's](https://docs.chartnaut.com/sdk/projects) **Webhooks** tab in Developers. Each has its own signing secret. Put it in your server's environment as `CHARTNAUT_WEBHOOK_SECRET`. ## Check the signature Verify the raw body, before anything parses it: ```ts // app/api/chartnaut/webhooks/route.ts import { ChartnautWebhookError, verifyRequest } from "@chartnaut/node"; export async function POST(req: Request) { try { const event = await verifyRequest(req, process.env.CHARTNAUT_WEBHOOK_SECRET!); if (event.type === "session.ended") await journal(String(event.data.session)); return new Response(null, { status: 204 }); } catch (e) { if (e instanceof ChartnautWebhookError) return new Response(e.message, { status: 400 }); throw e; } } ``` With Express, mount `express.raw()` on the webhook route. `express.json()` throws the original bytes away, and the signature is over those bytes. ```ts import express from "express"; import { Chartnaut } from "@chartnaut/node"; const cn = new Chartnaut({ webhookSecret: process.env.CHARTNAUT_WEBHOOK_SECRET }); const app = express(); app.post("/webhooks/chartnaut", express.raw({ type: "application/json" }), async (req, res) => { const event = cn.webhooks.verify(req.body, req.get("chartnaut-signature")); if (event.type === "user.disconnected") await cn.frames.forget({ user: String(event.data.user) }); res.sendStatus(204); }); ``` The signature header is `Chartnaut-Signature: t=,v1=`: an HMAC-SHA256 of `"."` with your endpoint's secret. `t` must be within 5 minutes of your clock. While you rotate a secret, deliveries are signed with both, and either matches. ## Events | Type | Means | |---|---| | `user.connected`, `user.disconnected`, `user.deleted` | A user linked, unlinked or deleted their account | | `session.ended` | A partner session ended | | `rule.breached` | A session's or account's rule broke | | `alert.fired` | A linked user's own Chartnaut alert went off (with `alerts:read`) | | `test.ping` | **Send test event** on the Webhooks tab | [Webhooks in the partner API](https://docs.chartnaut.com/cli/partner-webhooks) has each event's `data`, the retry schedule and the delivery log. Deduplicate on `event.id`. Answer with any 2xx within 10 seconds; anything else is retried for about a week. An endpoint that fails 25 times in a row over more than an hour is paused: its events wait up to 3 days, and **Resume** on the Webhooks tab starts it again. ## Over your plan's endpoint limit Live endpoints count against your [plan](https://docs.chartnaut.com/sdk/plans-and-limits) across all your projects. Test endpoints count against nothing. When a downgrade leaves you with more live endpoints than your plan allows: 1. Nothing stops at once. You get 7 days, an email, and a banner on the Webhooks tab saying the date. 2. When the 7 days end, your oldest endpoints up to the limit keep delivering. The rest pause with the reason `over_plan_limit`. Their events wait 3 days, and **Send test event** still reaches them. 3. **Choose which to keep** on the Webhooks tab picks the endpoints that stay active instead, at any time, during the 7 days too. In Developers it lists the endpoints of all your projects; on partners.chartnaut.com, the one project you are in. 4. **Resume** on an endpoint paused over the limit works only when there is room: otherwise it is refused (`409`) with how many your plan allows and how many are delivering. 5. Upgrade, and the pauses lift by themselves, oldest first. An endpoint paused because it kept failing still counts towards the limit: it is one you keep, just broken. Events from the terminal on your page (`order_filled`, `position_closed`) are hints for your interface. Webhooks and API reads are the facts. --- # Projects URL: https://docs.chartnaut.com/sdk/projects/ Updated: 2026-11-22T22:29:02Z A project is what you set up on Chartnaut for something you build: Test and Live keys, the sites a terminal may open on, localhost in Test, View as, and what it takes to go live. A project is everything you set up on Chartnaut for something you build: its keys, the sites its terminal may open on, its webhooks, its profile and its permissions. Your app is what your users open; the project is the Chartnaut side of it. People who connect see your app's name and icon ("Acme wants to connect"), never the word project. Make and manage projects in **Developers**: open the menu under your name, then **Developers**, and **New project**. Each project has the tabs **Overview**, **Keys**, **Sites**, **Webhooks**, **Profile**, **Permissions** and **Usage and logs**. ## Test and Live Every project has two environments, like a payments provider's test mode. | | Test | Live | |---|---|---| | Keys | `cn_partner_test_…` | `cn_partner_live_…` | | Who can sign in | You and your team only | Anyone | | Sites | `http://localhost` and `http://127.0.0.1` on any port, with nothing to add; any https site, wildcards included | https sites only | | Counts against your plan | The project itself, toward your plan's projects | The project, plus users, managed users, webhooks and data | | Made with | Developers, the CLI, `@chartnaut/create-app` or the MCP server | Developers only | Build in Test. When you go live, the code stays the same: swap the key in your server's environment. ## Keys A key is your server's secret: it mints frame addresses and calls the partner API. It never goes to a browser, and `@chartnaut/node` refuses to start in one. - A new key is shown once. Copy it into your server's environment as `CHARTNAUT_SECRET_KEY` (`.env.local` on your machine). - Up to 20 keys per environment. Rotate one on the **Keys** tab, or revoke it. - Test keys can be made from the CLI (`chartnaut project key`) and the MCP server. **Live keys are made only in Developers**, in your browser. The CLI and AI assistants are refused with `live_keys_browser_only` and the page's address. ## Sites A site is an address your terminal may open on. A frame on any other page doesn't open. | | Test | Live | |---|---|---| | localhost | Every `http://localhost:*` and `http://127.0.0.1:*`, automatically | Never | | Exact | `https://staging.myapp.com` | `https://myapp.com` | | Wildcard | `https://*.vercel.app`, anywhere | `https://*.myapp.com`, only on a domain that isn't shared: never `*.vercel.app`, `*.netlify.app`, `*.pages.dev`, `*.github.io` and the like | A site is the address alone: no path, no query. Chartnaut's own addresses are never allowed. Up to 20 sites per environment. ## Going live The project's **Overview** tab shows a quickstart for each environment. Live needs: 1. **Developer terms accepted.** 2. **An https site added**, on the **Sites** tab under Live. 3. **A Live key made**, on the **Keys** tab. Until Chartnaut verifies your app, the consent screen marks it **Unverified app**. Once it is live, **Request verification** on the **Permissions** tab, with your app's icon, website, support and privacy links filled in on the **Profile** tab. Chartnaut checks the site is yours and the name and icon don't copy another brand. A project you no longer need goes with **Archive project**. That frees its place in your [plan](https://docs.chartnaut.com/sdk/plans-and-limits). ## View as In Test, **View as** on the Overview tab shows your app as someone else would see it, without a second account: | Option | What you see | |---|---| | Yourself | Your own account, as it is | | A Free user | Chartnaut's Free plan: its chart and history limits, and upgrade prompts | | A capped user | What a new Free user sees when your project is at its limit for free Chartnaut accounts | | A managed user | Someone you create on Business, on a Free-level seat: no Chartnaut prompts | Reload your app on localhost: every Test frame your server mints for your team carries the preview, with no change to your code. A frame-token request with a Test key can also pass `"view_as": "free" | "capped" | "managed"` for one frame. ## From the CLI, an AI assistant or your own scripts The CLI's `chartnaut init --project` and `chartnaut project` commands, `npm create @chartnaut/app` and the MCP server's `list_projects`, `create_project` and `create_test_key` tools use these routes on the public API, with a key that has the `apps:write` permission: | Method | Path | What it does | |---|---|---| | GET | `/v1/projects` | Your projects, and how many your plan allows | | POST | `/v1/projects` | A new project `{ name }`, with its first Test key (shown once) | | GET | `/v1/projects/{slug}` | One project | | POST | `/v1/projects/{slug}/keys` | A new Test key | | GET | `/v1/projects/{slug}/sites` | Its sites, and the ones Test allows automatically | | POST | `/v1/projects/{slug}/sites` | A Test site `{ origin }` | | GET | `/v1/projects/{slug}/quickstart` | The quickstart: what `chartnaut project check` prints | The same routes answer under `/v1/apps`, with the same shapes. That old path keeps working and is marked deprecated in the OpenAPI file: use `/v1/projects` in new code. `apps:write` ("Create and manage your developer projects") is never in a key's default permissions: the CLI asks for it by name when it signs you in, and the approval page shows it. The MCP server's tools need a connection that granted it. | Code | Why | |---|---| | `invalid_request` | A field is wrong; the message says which. Project names are 2 to 60 characters | | `name_reserved` | The name starts with a reserved word, such as Chartnaut. Pick your own | | `app_limit` | Your developer plan's project count is reached (`details`: `used`, `cap`). [Plans and limits](https://docs.chartnaut.com/sdk/plans-and-limits) | | `rate_limited` | 5 new projects a day | | `site_refused` | The site breaks a rule above; the message says which | | `key_limit` | 20 keys in that environment. Revoke one first | | `forbidden`, `owner_only` | Your role on the project's team doesn't allow it | | `live_keys_browser_only`, `test_only` | Live keys and Live sites are made in Developers; `details.url` is the page | | `forbidden_scope` | The key or connection lacks `apps:write`. Sign in again with `chartnaut login --projects` | The codes and the `apps:write` name stay as they are, so code that checks them keeps working. --- # Plans and limits URL: https://docs.chartnaut.com/sdk/plans-and-limits/ Updated: 2026-11-22T22:29:02Z What Free, Pro and Business developer plans include, whose limit a refusal is (the user's or yours), and what happens at the cap. Your developer plan follows your own Chartnaut plan. On Free you build on Free; when your Chartnaut plan is Pro, so is your developer plan. Business is a bundle you add in **Developers → Plan and billing**. Prices are on [chartnaut.com/developers](https://chartnaut.com/developers). | | Free | Pro | Business | |---|---|---|---| | [Projects](https://docs.chartnaut.com/sdk/projects) | 1 | 3 | 3, 10, 25 or 50 by bundle | | Linked users on a paid Chartnaut plan | Unlimited | Unlimited | Unlimited | | Linked users on Chartnaut's Free plan, active a month | 25 (100 in all) | 250 | 250, 2,500, 10,000 or unlimited by bundle | | Managed users | No | No | By bundle | | Webhook endpoints | 1 | 3 | 3 or 10 by bundle | | Your app's scripts, run-only allowed | Yes | Yes | Yes | | Test environment and the whole SDK | Yes | Yes | Yes | | "Powered by Chartnaut" removable | No | No | Yes | One plan covers all your projects, and its limits count across all of them. Test usage counts against nothing. Each project counts toward your plan's projects, Test-only ones included. Users, managed users, webhooks and data count only in Live. **Archive project** frees a project's place. ## Paying for it Pro isn't bought in Developers: it is your Chartnaut plan, in **Settings → Billing**. Business is billed monthly on the same subscription when you choose a bundle in **Developers → Plan and billing**, with Chartnaut Pro included. Your card, invoices and cancelling are in **Settings → Billing**. Want an annual contract or to pay by invoice? Email [help@chartnaut.com](mailto:help@chartnaut.com). ## After a downgrade What you already have keeps working where it can. Live webhook endpoints over your new limit keep delivering for 7 days, then the oldest up to the limit stay on and the rest pause until you choose others, remove some or upgrade. [Webhooks](https://docs.chartnaut.com/sdk/webhooks#over-your-plans-endpoint-limit) has the details. ## Business bundles | Bundle | Active managed users | Of which Pro-level | Projects | |---|---|---|---| | Launch | 5 | 5 | 3 | | Starter | 250 | 10 | 10 | | Growth | 1,000 | 30 | 25 | | Scale | 5,000 | 75 | 50 | A managed user is a seat at Free level or Pro level, set per user (`cn.users.update(user, { level })`). Seats count only when the user is active that month. Extra Pro-level seats can be added on any bundle, and packs of 100 Free-level seats on every bundle but Launch. There is no automatic top-up: a new managed user past your seats is refused with `seat_limit` until you add seats, and users already active this month carry on. ## Whose limit it is Two kinds of limit apply in your terminal, and every refusal says whose it is in `details.owner`: | `owner` | Whose | Examples | |---|---|---| | `user` | The person's own Chartnaut plan | Charts at once, how far back history goes, order flow | | `developer` | Your developer plan | Projects, Free-linked users, managed-user seats, data | ```ts import { ChartnautCommandError, createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, {}); terminal.layout.set("2x4").catch((e: unknown) => { if (!(e instanceof ChartnautCommandError) || !e.is("planLimit")) throw e; if (e.details?.owner === "user") showBanner("Upgrade your Chartnaut plan for more charts."); else showBanner("This app has reached its limit. Try again later."); }); ``` `terminal.capabilities.plan` says what the user's plan allows now (`charts_max`, `panels_max`), and `capabilities.sdk_limits` your plan's data limits: bars per request and per hour, and how many markets' live quotes at once. ## At the Free-linked cap Users on a paid Chartnaut plan are never capped. When your project has as many Free-plan users this month as your plan allows, a new Free user opening your terminal is told your app is at its limit for free Chartnaut accounts, and offered Chartnaut Pro to use it now. People who used your app last month keep their places. You get an email, and the count is on the project's **Usage and logs** tab. --- # Errors URL: https://docs.chartnaut.com/sdk/errors/ Updated: 2026-11-22T22:29:02Z Every error code the terminal and the partner API send, what each means and what to do about it. Every failure carries a stable `code`, a plain `message`, and a `docs` link to its heading on this page. Branch on `code`, never on the message. ```ts import { ChartnautCommandError, createTerminal } from "@chartnaut/charts"; const terminal = createTerminal(document.getElementById("terminal")!, {}); terminal.orders.buy("NAS100", { risk: "1%", stop: 21480 }).catch((e: unknown) => { if (!(e instanceof ChartnautCommandError)) throw e; if (e.is("ruleBlocked") || e.is("lockedByApp")) showBanner(e.message); else console.warn(e.code, e.reason, e.details, e.docs); }); ``` In the terminal (`@chartnaut/charts`) a failure is a `ChartnautCommandError`; on your server (`@chartnaut/node`) a `ChartnautApiError`. Both have `code`, `message`, `reason` (why, where the code alone doesn't say), `details`, `docs` and `is()`, which takes the code in either spelling: `is("rule_blocked")` or `is("ruleBlocked")`. In dev mode, the terminal's errors also carry `fix`, a line on what to change. For limits, `details` says whose limit it is: `{ limit, owner, used, cap }`, where `owner` is `"user"` (the person's Chartnaut plan) or `"developer"` (yours). [Plans and limits](https://docs.chartnaut.com/sdk/plans-and-limits) ## From the terminal ### unknown_command The terminal doesn't take that command: a typo, or an SDK newer than the terminal. The commands it takes are in `ready.commands`. Check the name, or update the page's terminal to the newest. ### invalid_args An argument is wrong or missing, and the message names it. A size the market doesn't take comes with the market's sizes in `details.order_size` (`{ unit, min, max, step }`): see [order sizes](https://docs.chartnaut.com/sdk/symbols-and-data#order-sizes-lots-contracts-or-units). A time without an offset is refused too: pass unix seconds, a `Date` or ISO text with an offset. ### not_ready The terminal isn't ready yet, or the session is still loading. `createTerminal` and `` hold calls made before ready for 30 seconds, and send reads again while the session loads, for 15 seconds, so you see this only when it takes longer. With `reason: "caught_up"`, a replay reached the present on a live market and the next bar doesn't exist yet: step again after it closes. ### not_allowed This mode, session, permission or plan doesn't allow it. `reason` says which: | `reason` | Means | |---|---| | `partner_session` | A partner session whose `page_control` doesn't allow orders or the replay from the page | | `wrong_mode` | Backtest only (orders, the replay) or live only (quotes, watchlists) | | `scope_missing` | The user didn't grant the permission it needs | | `session_locked`, `session_ended` | The session is locked or over | | `orders_off_in_session` | The session takes no orders | | `blind_mode` | A blind session hides the market | | `not_in_frames` | Chartnaut doesn't offer that inside an app, such as broker accounts or the journal | | `declined` | The person said no on Chartnaut's sheet | | `one_terminal_per_page` | Another terminal is already on the page | | `one_connect_card_per_page` | Another Connect card is already on the page | `terminal.can("orders.place")` answers before you try. A page holds one terminal at a time. While one is on the page, `createTerminal` and `embed` throw `not_allowed` with `reason: "one_terminal_per_page"`, and a second `` shows nothing, calls `onError` and logs the message once. For more charts, use [the layout](https://docs.chartnaut.com/sdk/layout-and-charts#the-layout): `layout="2x2"` puts four charts in the one terminal, `interface={onlyCharts}` hides everything around them, and [linked charts](https://docs.chartnaut.com/sdk/layout-and-charts#linking-charts) follow each other. Unmounting or `destroy()` frees the page for the next one, so moving between pages and React's strict mode work as they are. A Connect card, the sign-in frame from a link's `frame_url` ([linking from your own button](https://docs.chartnaut.com/sdk/users#linking-from-your-own-button)), isn't a terminal: one can sit beside the terminal while someone connects. A second Connect card is refused the same way, with `reason: "one_connect_card_per_page"`. A link made with a session opens that session's charts, so it counts as the terminal. ### plan_limit A plan's limit. `details.owner` is `"user"` when it is the person's Chartnaut plan (charts at once, history, order flow): they can upgrade. It is `"developer"` when it is yours (projects, Free-linked users, data): upgrade in **Developers → Plan and billing**. From the API, also a start date before the user's plan's history. [Plans and limits](https://docs.chartnaut.com/sdk/plans-and-limits) ### seat_limit Your Business seats are full this month (`details.limit` is `seats` or `pro_seats`, with `used` and `cap`). A new managed user can't start until you add seats; users already active this month carry on. ### rate_limited Too fast. The terminal takes 20 commands a second and 5 orders; `retryAfter` is the wait in seconds. `createTerminal` and `` wait and send again for up to 15 seconds, and `@chartnaut/node` waits on `Retry-After` up to 30 seconds. From the API, `details.limit` is `rate_minute` or `rate_burst`. ### rule_blocked The session's own rules refuse the order: a block after a broken rule, the most positions, or the largest size it allows. The message says which. Show it to the person. ### locked_by_app Your own [order lock](https://docs.chartnaut.com/sdk/replay-orders-account#your-own-risk-lock) is on, set with `orders.lock(reason)`. Call `orders.unlock()` to take orders again. ### insufficient_margin The account hasn't the free margin for that size. Place a smaller size, or close something first. ### market_closed The market is closed, so it takes no orders now. ### not_installed The script isn't in the user's library, and only scripts in their library (or your app's own) can run. Add it from the community, or publish it to your app. ### data_not_exportable This market's data source doesn't let its numbers leave Chartnaut's charts in your app. `details` names the source and the level needed. Screenshots may still work where the source allows images. `capabilities.data_sources` lists every source's level, and [Symbols and data](https://docs.chartnaut.com/sdk/symbols-and-data) explains `egress`. ### not_found No such chart, script, drawing, order or position. From the API: no such object of yours, or an id of the wrong shape. Check the id; `useLayout` and the `list` and `get` calls give the ones that exist. ### failed Anything else; the message says what. Try again. If it keeps failing, send help@chartnaut.com the message and the time it happened. ### timeout No reply in time. Reads wait 5 seconds, orders and closes 20, `close_all` 30. Pass your own `timeoutMs` for a longer wait. From `@chartnaut/node`, the request got no answer in time (`timeoutMs`, default 30 seconds), after its retries. ### destroyed The terminal was taken off the page (`destroy()`, or the component unmounted) while the call waited. ### reloaded The terminal reloaded while the call waited. Read the state again and carry on: the SDK sends `init` to the new load, and a `resynced` event says what was missed. ### not_mounted The frame isn't on the page, so the call had nowhere to go: its iframe was removed from the document. With `embed()`, keep the element on the page while you send to it. ## From your server These come from the partner API, through `@chartnaut/node` or your own HTTP calls. `plan_limit`, `seat_limit`, `rate_limited`, `not_found` and `timeout` are above. ### unauthorized The key is missing, wrong or revoked (401). Check `CHARTNAUT_SECRET_KEY`, and that a Test key isn't being used for Live. ### forbidden Your account or role isn't allowed this (403): live frames (`frame:live`) before they are switched on for your project, or a change your role on the project's team can't make. The message says which. ### scope_not_granted The user didn't grant the permission in `details.scope` (403). Make a new [link](https://docs.chartnaut.com/sdk/users#linking-from-your-own-button) that asks for it. ### switched_off That part of the API is paused for your account (403). Write to partners@chartnaut.com. ### not_linked The user isn't linked to your app (404). Send them through a link, or use `whenNotLinked` in `frameRoute`: [Users](https://docs.chartnaut.com/sdk/users). ### not_managed The call is for managed users, and this user is linked: their own Chartnaut account and plan apply (409). ### conflict The `external_ref` is already used, the same `Idempotency-Key` is still running, or the session has already ended (409). ### expected_count_mismatch A bulk action by labels matched `details.actual`, not the count you sent (409). Nothing was done. List the matches and send again. ### invalid_request The request is wrong: a bad field, id or rule, an unknown field, or no `Idempotency-Key` on a POST (400). `details.field` or the message names it. A body over 2 MiB is 413. ### idempotency_key_reused That `Idempotency-Key` was used for a different path or body (422). Use a fresh key for a new request. ### partner_limit One of your project's own limits, named in `details.limit` (422). [Limits and errors](https://docs.chartnaut.com/cli/partner-limits-and-errors) lists them. ### permission_denied The key doesn't have the permission this call needs, named in `details.permission` (403). Use a key that has it, or add it to the key. ### internal Something went wrong on Chartnaut's side (500). Retry with the same `Idempotency-Key`; `@chartnaut/node` already has. If it keeps happening, write to partners@chartnaut.com. ### network_error `@chartnaut/node` got no answer at all, after its retries: check your server can reach `api.chartnaut.com`. ### bad_response `@chartnaut/node` got an answer that isn't the API's JSON, such as a proxy's error page. --- # API reference and OpenAPI URL: https://docs.chartnaut.com/sdk/api-and-openapi/ Updated: 2026-11-22T22:29:02Z The partner API behind @chartnaut/node and the public API behind the CLI, as OpenAPI 3.1 files you can download, generate clients from or hand to a coding agent. Two HTTP APIs sit behind the SDK. Each has a full reference, every endpoint with its parameters, bodies, answers and a `curl` example, and an OpenAPI 3.1 file to download, generate a client from, or give to a coding agent. | API | Called by | Base URL | Reference | OpenAPI | |---|---|---|---|---| | Partner API | Your server, with your project's secret key (`@chartnaut/node` wraps it) | `https://api.chartnaut.com/partner/v1` | [Partner API reference](https://docs.chartnaut.com/api/partner) | [partner-api.yaml](https://docs.chartnaut.com/openapi/partner-api.yaml) | | Public API | The CLI, the MCP server and your own scripts, with a personal API key | `https://api.chartnaut.com/v1` | [Public API reference](https://docs.chartnaut.com/api/public) | [public-api.yaml](https://docs.chartnaut.com/openapi/public-api.yaml) | The partner API creates users, links, frame addresses, sessions and demo accounts, and sends webhooks. Its pages, from [the overview](https://docs.chartnaut.com/cli/partner-overview) to [limits and errors](https://docs.chartnaut.com/cli/partner-limits-and-errors), explain each part with examples. Bodies and answers in `@chartnaut/node` use the API's own field names, so the file and the package's types read the same. The public API runs scripts and manages developer projects for the CLI and the MCP server: see the [API overview](https://docs.chartnaut.com/cli/api-overview) and [Projects](https://docs.chartnaut.com/sdk/projects#from-the-cli-an-ai-assistant-or-your-own-scripts). The terminal on your page has no HTTP API. Its commands and events go over `postMessage`, typed in `@chartnaut/charts`; [The frame and embed.js](https://docs.chartnaut.com/cli/partner-frame) describes the messages for pages without JavaScript tooling. ## For coding agents | File | What it is | |---|---| | [llms.txt](https://docs.chartnaut.com/llms.txt) | An index of every docs page, the Terminal SDK first | | [llms-full.txt](https://docs.chartnaut.com/llms-full.txt) | Every docs page in one file, with code examples | | [partner-api.yaml](https://docs.chartnaut.com/openapi/partner-api.yaml), [public-api.yaml](https://docs.chartnaut.com/openapi/public-api.yaml) | The two APIs | `chartnaut init --project` also writes a guide for coding agents into your project folder's `AGENTS.md` and `CLAUDE.md`, and a skill at `.claude/skills/chartnaut-sdk/SKILL.md`. [Getting started](https://docs.chartnaut.com/sdk/getting-started) --- # Changelog URL: https://docs.chartnaut.com/sdk/changelog/ Updated: 2026-11-22T22:29:02Z What changed in each version of @chartnaut/charts and @chartnaut/node, and how the terminal tells you when your SDK is out of date. What changed in each version of the two packages. While a version starts with `0.`, a minor version may rename or remove something; from 1.0, names only grow. The same notes ship in each package as `CHANGELOG.md`. ## When your SDK is out of date The terminal says which SDK versions it supports in its first event, `hello`, as `sdk: { min, latest }`. An SDK older than `min` logs a warning in the browser console: update it now, because some calls may fail. An SDK older than `latest` logs a note once, with a link to this page. Your users never see either. ```sh npm install @chartnaut/charts@latest @chartnaut/node@latest ``` `SDK_VERSION` from `@chartnaut/charts` is the version your page runs. ## @chartnaut/charts ### 0.1.6 (2026-11-22) **Fixed** - `useLayout().focusedChart` is always one of the layout's charts. Going from 6 charts to 1 could leave it naming a chart that was gone (`No chart "c6"`); it now falls back to the first chart. - The terminal's iframe no longer logs "Allow attribute will take precedence over 'allowfullscreen'" on every load. Fullscreen still works. ### 0.1.5 (2026-11-21) **Changed** - The `error` event for a frame refused because the user already has your app open in 3 places (`reason: "frame_sockets"`, with `details.cap`) now says so: "The user has your app open in 3 other places. Close one, then open the terminal again." Before, it read "The terminal stopped". ### 0.1.4 (2026-11-20) **Changed** - One terminal per page. While a terminal is on the page, `createTerminal` and `embed` throw `not_allowed` with `reason: "one_terminal_per_page"`, and a second `` or `` renders nothing, calls `onError` and logs once. Unmounting or `destroy()` frees the page at once, so page changes and React's strict mode work as before. Use the [layout](https://docs.chartnaut.com/sdk/layout-and-charts#the-layout) for more charts. A Connect card (a link's sign-in frame) doesn't count and can sit beside the terminal; a second Connect card is refused with `reason: "one_connect_card_per_page"`. See [not_allowed](https://docs.chartnaut.com/sdk/errors#not_allowed). ### 0.1.3 (2026-11-20) **Added** - `SDK_VERSION`, this package's version. - A console warning when this SDK is older than the oldest version the terminal supports, and a one-time note when a newer version is out. The terminal's `hello` event carries `sdk: { min, latest }`. ### 0.1.2 (2026-11-20) **Added** - `symbols.get(symbol).order_size`: the sizes a market takes in a backtest, `{ unit, min, max, step }` (`unit` is `"lots"`, `"contracts"` or `"units"`). A size refusal carries the same object in `error.details.order_size`. New types `SizeUnit` and `OrderSizeRules`. - `terminal.openPanel("trades" | "none")` opens or closes the Trades panel. - `useLayout` returns `{ layout, charts, panels, focusedChart, handle }`. The layout is read once when the terminal is ready and then kept by its events; an unchanged layout keeps the same objects. New type `LayoutState`. - `useAccount` and `usePositions` take `{ onError }`, and the account carries `error` when a read failed after retrying. - `COMMAND_TIMEOUTS_MS`: reads wait 5 seconds for a reply, orders and closes 20, `close_all` and `cancel_all` 30, bars, trades, screenshots and layout and workspace changes 15. - `share()`, the structural sharing helper the hooks use. **Changed** - `createTerminal` and `` send a command again when the terminal refuses it with `rate_limited` (after `retry_after`), and a read again when it is refused with `not_ready`, for up to 15 seconds. `send(name, args, { retry: false })` answers the first refusal. `embed()` still sends once. - `terminal.account` keeps the balance and the open positions live: read when the terminal is ready, read again on order and position events, with each position's P&L merged in as it moves. - The layout handle follows events instead of reading the layout after every change. **Fixed** - `useLayout`, `useAccount` and `usePositions` no longer read again on every render when given an inline callback. ### 0.1.1 (2026-11-19) - The README leads with React, with eleven examples. No code changes. ### 0.1.0 (2026-11-19) The first release under this name. It was published briefly as `@chartnaut/embed` 0.1.0, which is deprecated. - `` and `createTerminal()`: the terminal in an iframe, with calls before it is ready queued until it is, a status on everything, typed events and typed errors (`code`, `message`, `reason`, `details`, `docs`, `is()`). - Hooks: `useTerminal`, `useChart`, `useLayout`, `useScript`, `useQuote`, `useReplay`, `useAccount`, `usePositions`, `useFills`, `useWorkspace`, and ``. - Charts and layout: `terminal.chart(id)`, layout presets and split trees, panels, link groups, `pickSymbol` and `pickScript`, chart rects. - Scripts, drawings and overlays: `chart.scripts.add`, script handles with `values()` and `{ hold: true }` events, `chart.draw.*`, the user's drawings and their events, `chart.overlays`. - Data: `symbols.search` and `symbols.get`, bars, live quotes, screenshots. - Replay, orders and the account in backtests: `orders.buy` and `sell` by size or risk, position handles, `orders.lock`, `replay.until`. - `interface` switches (`onlyCharts`), `appearance` and theme presets, `persist`, the workspace. - `@chartnaut/charts/testing`: `createMockTerminal()` for tests without a terminal. - `ChartnautFrame`, `useChartnautFrame` and `embed()` from the earlier frame SDK still work. ## @chartnaut/node ### 0.1.3 (2026-11-22) **Fixed** - Cleaner type definitions: comments only, nothing your code uses changed. ### 0.1.2 (2026-11-21) **Fixed** - `frameRoute` with `whenNotLinked: { link }` reuses the open Connect link for the same user and permissions until a minute before it expires, and requests at the same moment share one. Before, every request from an unlinked user made a new link, and a user can have 5 open: a few screen switches ran into `partner_limit`. **Added** - The user's own broker accounts (`accounts:read`): `cn.accounts.getUserAccount(id)` and `cn.accounts.positions(id)`; `cn.accounts.trades(id)` reads their closed trades too. See [Their own broker accounts](https://docs.chartnaut.com/sdk/accounts#their-own-broker-accounts). ### 0.1.1 (2026-11-20) **Added** - `account_label` on `cn.links.create`: your name for the person (a username or email, up to 200 characters). The consent screen shows it masked beside their Chartnaut account, so nobody connects someone else's account by mistake. ### 0.1.0 (2026-11-20) The first release. - `new Chartnaut({ key })`: a typed client for every partner API route (users, managed users, links, frames, sessions, demo accounts, scripts, webhooks). It reads `CHARTNAUT_SECRET_KEY` by default. - `cn.frames.url()` caches each frame URL until an hour before it expires, with a pluggable `FrameCache` for several server instances. - Retries: `429` after `Retry-After` (up to 30 seconds), `5xx` and no answer with backoff, one `Idempotency-Key` per POST across its retries. - `ChartnautApiError` with `code`, `reason`, `details`, `retryAfter`, `docs` and `is()`. - `frameRoute` (Next.js), `frameRouteExpress` and `frameRouteNode`: the route `` asks for its frame URL, with `whenNotLinked` and backtests by key (`backtest: { key, start }`). - `verifyRequest` and `verifyWebhook`: webhook signature checks for Fetch requests, Express `raw()` bodies and Node streams. --- # What Chartnaut is URL: https://docs.chartnaut.com/start/what-chartnaut-is/ Updated: 2026-11-22T22:28:21Z Chartnaut is a trading terminal you can build into whatever you need: building blocks and agents that shape the charts and everything around them to how you trade. Chartnaut is a trading terminal you can build into whatever you need. It is made for the manual trader today, with automated traders next. On the charts and beyond them, if you can describe it, you can have it. It is designed to run on the AI subscription you already pay for, so the agents [build on your own plan](https://docs.chartnaut.com/guides/use-your-own-ai-subscription): - Claude Code - Codex - Grok, coming soon - Kimi, coming soon That runs in [Chartnaut Desktop](https://docs.chartnaut.com/start/chartnaut-desktop), the app Chartnaut recommends you install. [Ways to use Chartnaut](https://docs.chartnaut.com/start/ways-to-use-chartnaut) compares it with the browser and the CLI. Serious market research has always belonged to funds with a quant desk. We are building the harness and the scripting language that let agents do that work properly, so a retail trader gets the same depth of analysis from a laptop. The goal is agents that work for you on their own, test your ideas while you sleep, and make you a better trader for it. ## The two halves of trading Trading comes down to two questions. Is your edge real? And are you actually trading it? Almost everything in Chartnaut exists to help with one or the other. ![Research and you, side by side, meeting on the chart](https://docs.chartnaut.com/images/two-halves.svg) *Each step of research has a partner on your side.* We understand manual traders, and they have been underserved for a long time. The serious research tools are built for people who automate everything, and the trader making the calls by hand gets a charting package and a spreadsheet. Whether you trade on discretion or mechanically from a set of rules, Chartnaut helps you pull together the data points that anchor you to your best opportunities. It covers both sides of the equation. **Confidence in your strategy.** Before you trust a setup, test it against the market. A [study](https://docs.chartnaut.com/guides/how-research-works) measures what actually followed every time it happened across years of history, and a [backtest](https://docs.chartnaut.com/guides/start-a-session) lets you trade it yourself on past sessions, bar by bar. You go into the next trade knowing the numbers behind it. **Executing against it.** Then Chartnaut helps you trade what you proved. A [Forward Insight](https://docs.chartnaut.com/guides/forward-insights) puts the evidence on the chart as the setup forms, every [trade](https://docs.chartnaut.com/guides/trades-library) is saved with its chart, your [playbook](https://docs.chartnaut.com/guides/how-playbooks-work) shows where you follow your plan and where you drift, and [Historical Intelligence](https://docs.chartnaut.com/guides/historical-intelligence) learns how you trade it. ## Building blocks, not opinions Most trading platforms decide how you should work: these charts, these panels, this way of journaling. Chartnaut takes the opposite approach. We build small, unopinionated pieces, and agents that know how to put them together for you. [Indicators](https://docs.chartnaut.com/guides/how-indicators-work), [definitions](https://docs.chartnaut.com/guides/how-research-works), [studies](https://docs.chartnaut.com/guides/how-research-works) and [apps](https://docs.chartnaut.com/guides/build-your-own-pages) are the pieces. Ask the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) for a session VWAP with two bands, a way to mark every failed breakout of the Asia session high, or a desk that shows BTC and ETH against VWAP with your open positions underneath. It builds it, checks it against real market data and hands it to you to approve. Over time the terminal becomes yours, shaped around how you actually trade. ## In the charts [Charts](https://docs.chartnaut.com/guides/how-charts-works) is a full trading workspace: up to eight [panels](https://docs.chartnaut.com/guides/panels) side by side, footprint, volume profile and TPO, your own indicators, and orders placed straight from the chart. A script can even be a whole new [chart type](https://docs.chartnaut.com/guides/chart-types). Research lives here too. A [Forward Insight](https://docs.chartnaut.com/guides/forward-insights) puts a study's answer on the bar where your setup forms, so when the market does the thing you studied, you see what usually happened next before you decide. ## Beyond the charts [Apps](https://docs.chartnaut.com/guides/build-your-own-pages) are panels the agent writes for you: a morning briefing, a scoreboard for your playbooks, a screener for your watchlist. Each opens as its own page, and can also appear as a tab on every trade, journal day and report. You can work from outside the app as well. The [Chartnaut CLI](https://docs.chartnaut.com/cli/overview) runs your indicators, definitions and studies from a terminal, Claude Code or Codex, and Claude, ChatGPT or Cursor can [connect over MCP](https://docs.chartnaut.com/cli/mcp-overview) and do the same from their own chat. ## Find your way around | Area | What it is for | Where | |---|---|---| | [Charts](https://docs.chartnaut.com/guides/how-charts-works) | Chart, trade live and replay history | **Trading → Charts** | | [Accounts](https://docs.chartnaut.com/guides/how-accounts-work) | Connect a MetaTrader account, a cTrader account or Chartnaut Demo | **Trading → Accounts** | | [Journal](https://docs.chartnaut.com/guides/daily-journal) | A page for each trading day | **Trading → Journal** | | [Trades](https://docs.chartnaut.com/guides/trades-library) | Every trade, with its chart, notes and tags | **Trading → Trades** | | [Playbooks](https://docs.chartnaut.com/guides/how-playbooks-work) | One setup's rules, trades and reports | **Trading → Playbooks** | | [Backtest](https://docs.chartnaut.com/guides/start-a-session) | Trade past market days as if they were live | **Tools → Backtest** | | [Definitions](https://docs.chartnaut.com/guides/how-research-works) | Find a setup in history and study what followed | **Tools → Definitions** | | [Indicators](https://docs.chartnaut.com/guides/how-indicators-work) | Build your own indicators | **Tools → Indicators** | | [Apps](https://docs.chartnaut.com/guides/build-your-own-pages) | Panels the agent writes for you | **Tools → Apps** | | [Agent](https://docs.chartnaut.com/guides/how-the-agent-works) | Ask for any of the above in plain words | **Agent**, top of the sidebar | | [CLI, MCP & APIs](https://docs.chartnaut.com/cli/overview) | Run your scripts from a terminal, a coding agent, an AI app like Claude or ChatGPT, or your own code | Menu under your name → **Developers** | You never have to write code. Every piece is a script the agent writes, and the code is there if you want it: [Scripting](https://docs.chartnaut.com/scripting/overview) documents all of it. --- # Ways to use Chartnaut URL: https://docs.chartnaut.com/start/ways-to-use-chartnaut/ Updated: 2026-11-22T22:28:22Z Chartnaut Desktop, a web browser, the CLI and API, or an AI app over MCP: what each is for, what it needs, and why Desktop is the one to install. You can use Chartnaut in the desktop app, in a web browser, or from a terminal and your own code. Install [Chartnaut Desktop](https://docs.chartnaut.com/start/chartnaut-desktop). It is the same Chartnaut you get in a browser, and it is the only way to run the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) on a Claude or ChatGPT subscription you already pay for, instead of buying [AI credits](https://docs.chartnaut.com/guides/ai-credits). ![The Chartnaut download page](https://docs.chartnaut.com/captures/ways-to-use-download-page.png) *The download page: Windows, Mac, web and the CLI.* ## Compare the options | | Use it for | You need | Get it | |---|---|---|---| | [Chartnaut Desktop for Windows](https://docs.chartnaut.com/start/chartnaut-desktop) (recommended) | Everything in Chartnaut, plus running its AI on your own Claude or ChatGPT subscription | Windows 10 or later | [Download](https://chartnaut.com/download) | | Chartnaut Desktop for Mac | The same as Windows | Coming soon | Use the browser until it ships | | [Chartnaut in your browser](https://docs.chartnaut.com/start/chartnaut-in-your-browser) | Everything in Chartnaut except running its AI on your own subscription | A web browser, nothing to install | [terminal.chartnaut.com](https://terminal.chartnaut.com) | | [CLI and API](https://docs.chartnaut.com/start/for-developers) | Writing and running indicators, definitions and studies from a terminal, a coding agent or your own code | macOS, Linux or Windows for the CLI | [Install the CLI](https://docs.chartnaut.com/cli/install) | | [AI apps over MCP](https://docs.chartnaut.com/cli/mcp-overview) | Asking Claude, ChatGPT or Cursor to write, run and explain your scripts | A Claude, ChatGPT, Cursor or Codex account | [Connect an app](https://docs.chartnaut.com/cli/mcp-overview#connect-an-app) | You sign in with the same account everywhere, and your [plan](https://docs.chartnaut.com/start/plans) applies to all of them. The agent, the CLI, the MCP server and the API work on every plan, Free included. Trading from [Charts](https://docs.chartnaut.com/guides/how-charts-works) on Chartnaut Demo is on every plan too; trading through your own broker needs Pro, or the [14-day live trial](https://docs.chartnaut.com/guides/live-trial) on Free. ## Why Desktop - **The agent on your own subscription.** Connect Claude Code or Codex and every chat in Chartnaut runs on that subscription, with no credits spent. A browser cannot do this, because your provider sign-in stays on your computer. [Use your own AI subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription) shows how. - **Nothing is missing.** Desktop opens the same app as the browser, so charts, trading, the journal and research work exactly as they do there. - **A window of its own.** It reopens at the size and place you left it, and it keeps itself up to date. ## When to use something else Use the [browser](https://docs.chartnaut.com/start/chartnaut-in-your-browser) on a Mac until Desktop for Mac ships, or on a computer where you cannot install apps. Use the [CLI and API](https://docs.chartnaut.com/start/for-developers) when you want your scripts as files in your own editor, or want Claude Code or Codex to build them for you. [Connect an AI app](https://docs.chartnaut.com/cli/mcp-overview) when you would rather ask Claude or ChatGPT in its own chat. The CLI works alongside Desktop or the browser; it does not replace them. --- # Chartnaut Desktop URL: https://docs.chartnaut.com/start/chartnaut-desktop/ Updated: 2026-11-22T22:28:22Z Why Chartnaut recommends the desktop app, and how to install, sign in, update and remove it on Windows. Chartnaut Desktop is the Chartnaut app for Windows. It opens the same Chartnaut you use at terminal.chartnaut.com in a window of its own, and adds the one thing a browser cannot do: run Chartnaut's AI on your own Claude or ChatGPT subscription. Chartnaut recommends it for everyone who can install it. ![Chartnaut Desktop on Windows](https://docs.chartnaut.com/captures/chartnaut-desktop-window.png) *Chartnaut Desktop on Windows, open on Charts.* ## Why Chartnaut recommends it **Run the AI on a subscription you already pay for.** Connect Claude Code or Codex under **Settings → AI providers**, and the [agent](https://docs.chartnaut.com/guides/how-the-agent-works), the [builders' chats](https://docs.chartnaut.com/guides/builder-agents) and every other chat run on that subscription. No [AI credits](https://docs.chartnaut.com/guides/ai-credits) are spent. This works only in Desktop because your provider sign-in is stored on your own computer, where a web page cannot reach it. [Use your own AI subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription) walks through it. **Everything else is the same.** Desktop loads the same app as the browser, so [Charts](https://docs.chartnaut.com/guides/how-charts-works), trading, the [journal](https://docs.chartnaut.com/guides/daily-journal), research and [apps](https://docs.chartnaut.com/guides/build-your-own-pages) behave exactly as they do there. You give nothing up by switching. **A window of its own.** Chartnaut stays out of your browser tabs, reopens at the size and position you left it, and opening it a second time brings the open window forward. **It keeps itself up to date.** Updates download in the background, and Chartnaut asks before it restarts. ## Install on Windows Desktop runs on Windows 10 or later. One installer covers both regular (x64) and ARM PCs. 1. Open [chartnaut.com/download](https://chartnaut.com/download). 2. Under **Windows**, click **Download**. 3. A dialog, *Windows may ask you to confirm*, shows the Windows screen that can come next. Click **Got it, download**. The file is named `Chartnaut-Setup-` followed by the version, for example `Chartnaut-Setup-1.0.4.exe`. 4. Open the file. 5. If Windows shows *Windows protected your PC*, click **More info**, check that **Publisher** reads *TWO INFINITY LTD*, then click **Run anyway**. 6. The installer runs on its own, with no questions and no administrator prompt, and Chartnaut opens when it finishes. ![The Windows SmartScreen screen](https://docs.chartnaut.com/captures/chartnaut-desktop-smartscreen.png) *Windows protected your PC, with More info expanded and Run anyway.* Windows shows that blue screen because Chartnaut is a new publisher, and Windows warns about installers it has not seen many downloads of. The installer is signed by TWO INFINITY LTD, the company behind Chartnaut. If the publisher reads anything else, do not run it. Chartnaut installs for your Windows user only and appears in the Start menu. ## On a Mac Chartnaut Desktop for Mac is coming soon. Until then, use [Chartnaut in your browser](https://docs.chartnaut.com/start/chartnaut-in-your-browser): everything except running the AI on your own subscription works there. The [CLI](https://docs.chartnaut.com/start/for-developers) already runs on macOS. ## Sign in Sign in with the same account you use in the browser. - **Continue with Google** opens Google in your usual browser. Finish signing in there, and the Chartnaut window carries on by itself. If you do not finish within five minutes, the sign-in stops and you can try again. - Or type your email and password and click **Sign In**. Desktop keeps its own sign-in, separate from your browser, so you sign in once in each. Your [timezone and theme](https://docs.chartnaut.com/account/preferences) are saved separately too: set them again the first time you open Desktop. To use your own AI subscription, open **Settings → AI providers** in the sidebar and follow [Use your own AI subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription). This works on every plan, Free included. Desktop must be open for the subscription to serve your chats. ## Updates Chartnaut looks for an update when it opens and every six hours after that, and downloads it in the background. When one is ready, a dialog, *An update is ready*, offers **Restart now** or **Later**. **Later** installs it the next time you quit Chartnaut. Chartnaut never restarts in the middle of an AI reply running on your subscription, or while you are signing in to an AI provider. It waits for them to finish. If your version is too old for Chartnaut's servers, it installs the update without asking, as soon as nothing is running. ## The window | To | Press | |---|---| | Zoom in | Ctrl and = | | Zoom out | Ctrl and - | | Back to the automatic size | Ctrl and 0 | On a large or 4K monitor, Chartnaut picks a bigger zoom by itself so the app is not tiny, and it remembers your own zoom for next time. Links to other websites open in your browser, not in Chartnaut. Desktop needs an internet connection, the same as the browser. ## Uninstall 1. Open Windows **Settings → Apps → Installed apps**. On Windows 10 it is **Settings → Apps → Apps & features**. 2. Find **Chartnaut** and click **Uninstall**. Uninstalling leaves the folder `%APPDATA%\Chartnaut`, which holds your sign-in, the chart data Chartnaut cached and your connected AI provider accounts. Delete that folder to remove them from the computer. To revoke a provider's access completely, sign out with the provider as well. ## When it goes wrong - *Can't reach Chartnaut*: the window could not load Chartnaut. Check your internet connection and click **Retry**. - *Chartnaut couldn't open your browser*: open your browser yourself, then click **Continue with Google** again. - *Sign-in timed out waiting for your browser*: the five minutes ran out. Click **Continue with Google** again. - *Chartnaut Desktop needs an update to use it* in a chat: your provider has a model this version cannot serve yet. Chartnaut checks for an update straight away; restart when it offers. - Problems connecting Claude or Codex: see [Use your own AI subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription#when-it-goes-wrong). If you contact [support](https://docs.chartnaut.com/account/support), the app's log helps. It is at `%APPDATA%\Chartnaut\logs\main.log`. --- # Chartnaut in your browser URL: https://docs.chartnaut.com/start/chartnaut-in-your-browser/ Updated: 2026-11-22T22:28:22Z Use Chartnaut at terminal.chartnaut.com with nothing to install, and what needs Chartnaut Desktop instead. Chartnaut runs in a web browser at [terminal.chartnaut.com](https://terminal.chartnaut.com), with nothing to install. Open it, sign in, and you have the same Chartnaut as [Chartnaut Desktop](https://docs.chartnaut.com/start/chartnaut-desktop), with one difference: the browser cannot run Chartnaut's AI on your own Claude or ChatGPT subscription. ## What works the same Everything else. [Charts](https://docs.chartnaut.com/guides/how-charts-works), trading on your [accounts](https://docs.chartnaut.com/guides/how-accounts-work), the [journal](https://docs.chartnaut.com/guides/daily-journal), [playbooks](https://docs.chartnaut.com/guides/how-playbooks-work), [backtest](https://docs.chartnaut.com/guides/start-a-session) sessions, research and [apps](https://docs.chartnaut.com/guides/build-your-own-pages) are the same app in both places. The [agent](https://docs.chartnaut.com/guides/how-the-agent-works) and the [builders' chats](https://docs.chartnaut.com/guides/builder-agents) work too, and spend [AI credits](https://docs.chartnaut.com/guides/ai-credits). ## What needs Desktop Running the AI on a subscription you already pay for. Your Claude or ChatGPT sign-in has to stay on your own computer, and a web page cannot reach it. So the browser has no **Settings → AI providers** in the sidebar, and if you open that page from a link it says *Connecting a provider needs the Chartnaut desktop app.* ![AI providers in a browser](https://docs.chartnaut.com/captures/chartnaut-in-your-browser-ai-providers.png) *AI providers in a browser, explaining that it needs Desktop.* If you pay for Claude or ChatGPT already, install [Desktop](https://docs.chartnaut.com/start/chartnaut-desktop) and connect it there. [Use your own AI subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription) covers the rest. ## When the browser is the right choice - You are on a Mac. Chartnaut Desktop for Mac is coming soon; use the browser until it ships. - You are on a computer where you cannot install apps. - You want a quick look from a computer that is not your own. Sign out when you are done. ## Things to know Your [timezone and theme](https://docs.chartnaut.com/account/preferences) are saved in the browser, not your account. Set them again in another browser or in Desktop. Chartnaut keeps chart data it has already loaded in the browser's storage, so charts you have opened before load faster next time. Clearing the site's data in your browser removes it, and it downloads again. --- # For developers URL: https://docs.chartnaut.com/start/for-developers/ Updated: 2026-11-22T22:28:22Z The Chartnaut CLI, the API and coding agents: where to start with each. If you would rather work in a terminal, an editor or your own code, Chartnaut has a command-line tool and an API. Both run your [indicators](https://docs.chartnaut.com/guides/how-indicators-work), [definitions](https://docs.chartnaut.com/guides/build-a-definition) and [studies](https://docs.chartnaut.com/guides/build-and-run-a-study) on Chartnaut's servers and save them to your account, where they open in the app like anything you built there. They work on every plan, Free included, at its limits. They sit alongside [Chartnaut Desktop](https://docs.chartnaut.com/start/chartnaut-desktop) or the [browser](https://docs.chartnaut.com/start/chartnaut-in-your-browser), not in place of them: you still chart, trade and read results in the app. ![The Developers page](https://docs.chartnaut.com/captures/for-developers-page.png) *The Developers page: CLI install commands and API keys.* ## The CLI The Chartnaut CLI is one program for macOS, Linux and Windows. Install it with one command, then sign in: ``` curl -fsSL https://chartnaut.com/install.sh | sh chartnaut login ``` On Windows, install it in PowerShell with `irm https://chartnaut.com/install.ps1 | iex`. The same commands are on the **Developers** page, in the menu under your name. Start with [Install](https://docs.chartnaut.com/cli/install), [Sign in](https://docs.chartnaut.com/cli/sign-in) and [Your first run](https://docs.chartnaut.com/cli/your-first-run), which runs an EMA on 30 days of BTC. The [CLI overview](https://docs.chartnaut.com/cli/overview) lists everything it does. ## Coding agents Run `chartnaut init` in a folder and Claude Code or Codex can write a script, run it, read the results and fix it until the numbers make sense. [Working with Claude Code and Codex](https://docs.chartnaut.com/cli/claude-code-and-codex) explains the loop they follow. ## AI apps Claude, ChatGPT, Cursor and Codex can connect to Chartnaut's MCP server at `https://api.chartnaut.com/v1/mcp` and work on your account from their own chat: read the docs, write a script, run it and explain the results. You approve the connection once on a Chartnaut page, with no key to copy. [Connect Chartnaut to an AI app](https://docs.chartnaut.com/cli/mcp-overview) ## The API The CLI calls the same HTTP API your own code can use, at `https://api.chartnaut.com/v1`. Make a key on the **Developers** page, then read the [API overview](https://docs.chartnaut.com/cli/api-overview) for a first call and the [API reference](https://docs.chartnaut.com/cli/api-reference) for every endpoint. Your [plan](https://docs.chartnaut.com/start/plans) sets how many requests a minute you can make; [Limits](https://docs.chartnaut.com/cli/limits) explains the rest. ## Open source The CLI's code, its install scripts and a guide for coding agents are on GitHub at [chartnaut/cli](https://github.com/chartnaut/cli). Read what the installer runs, build it yourself, or open an issue there. --- # How the pieces fit URL: https://docs.chartnaut.com/start/how-the-pieces-fit/ Updated: 2026-11-22T22:28:22Z How Chartnaut turns a trading hunch into an answer: indicators and definitions find the setup, a study measures it, a Forward Insight brings it to your chart, and your own trades complete the picture. Every trader carries a few hunches around. The opening range break that seems to run on BTC. The London high that always gets taken out. Chartnaut is built to turn a hunch like that into an answer, and then put the answer where you trade. ## Start with a hunch Say you have noticed that when BTC breaks the first 15-minute range of the New York session above VWAP, it tends to keep going. You have seen it work. You have also seen it fail, and you are not sure how often. ## Show Chartnaut what you are looking at First, the ingredients. VWAP and the opening range are [indicators](https://docs.chartnaut.com/guides/how-indicators-work): values drawn on the chart, bar by bar. Chartnaut has plenty built in, and the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) will build any that are missing. Then the setup itself. A [definition](https://docs.chartnaut.com/guides/how-research-works) is your hunch written down precisely enough that Chartnaut can spot it: price breaks the first 15-minute range while above VWAP. Run it over two years of BTC and it marks every time that happened. In this case, 786 times. ## Ask your question Now you can ask what you actually wanted to know. A [study](https://docs.chartnaut.com/guides/how-research-works) takes those 786 breaks and measures what came next. How often did price reach the prior day's high? What came first, the target or the stop? Does it matter how far above VWAP the break started? The answers come with the evidence behind them. Breaks from above the upper VWAP band reached the prior day's high 51 times in 61, and you can open every one of those 61 on the chart and look at it yourself. ## Take the answer into your trading A number in a report is easy to forget. So you put the study on the chart as a [Forward Insight](https://docs.chartnaut.com/guides/forward-insights). Tomorrow, when BTC breaks its opening range above the band, the chart shows you 51 in 61 on the bar where it happens, before you decide anything. ## Learn from your own trades The market is half the story. The other half is you. Every [trade](https://docs.chartnaut.com/guides/trades-library) you take is saved with a snapshot of your chart. Put your opening range trades into one [playbook](https://docs.chartnaut.com/guides/how-playbooks-work) and you start to see your side of it: which ones you took well, which ones you chased, where your edge actually is. Once the playbook has enough trades, [Historical Intelligence](https://docs.chartnaut.com/guides/historical-intelligence) learns from them and tells you how your own version of the setup tends to play out. A study tells you what the market does. Your playbook tells you what you do. Chartnaut puts both on the chart, right where you make the call. --- # How to get the most out of Chartnaut URL: https://docs.chartnaut.com/start/get-the-most-out-of-chartnaut/ Updated: 2026-11-22T22:28:22Z Six workflows that make Chartnaut worth using, and where to start each one. Six workflows that make Chartnaut worth using, and where to start each one. Run them in [Chartnaut Desktop](https://docs.chartnaut.com/start/chartnaut-desktop) if you can: it is the same app as the browser, and it can run the agent on your own AI subscription. ## Test an idea before you trade it Describe a setup and the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) builds a [definition](https://docs.chartnaut.com/guides/how-research-works) that finds every time it happened over a few years of history. Then a [study](https://docs.chartnaut.com/guides/how-research-works) measures it: how often it worked, how far it went, when it failed. You get an answer with a sample size behind it before any money is at risk. Start with [Build a definition](https://docs.chartnaut.com/guides/build-a-definition). Free keeps 10 definitions. ## Bring the answer to your chart A study you trust can become a [Forward Insight](https://docs.chartnaut.com/guides/forward-insights). When the setup appears again, live or in a replay, the chart shows what usually happened next, right on the bar where it fired. Start with [Forward Insights](https://docs.chartnaut.com/guides/forward-insights). ## Log every trade without thinking about it Connect a MetaTrader account, a cTrader account or Chartnaut Demo and every trade is saved in [Trades](https://docs.chartnaut.com/guides/trades-library) with entry and exit [snapshots](https://docs.chartnaut.com/guides/snapshots-and-replay). Add a line to the day in the [Journal](https://docs.chartnaut.com/guides/daily-journal) and the record is complete. Start with [Connect an account](https://docs.chartnaut.com/guides/how-accounts-work). ## Turn your trades into a playbook Group the trades that belong to one setup into a [playbook](https://docs.chartnaut.com/guides/how-playbooks-work), set its R-level targets and [tag](https://docs.chartnaut.com/guides/tags-and-criteria) what you saw. Its [reports](https://docs.chartnaut.com/guides/playbook-reports) show where the setup pays and where it does not, and once it has enough trades, [Historical Intelligence](https://docs.chartnaut.com/guides/historical-intelligence) learns from them. Start with [Create a playbook](https://docs.chartnaut.com/guides/create-a-playbook). ## Practise on history A backtest session replays past market days on the chart and lets you trade them with the [replay controls](https://docs.chartnaut.com/guides/replay). Start on a random date so you cannot remember what happens next, and file the trades into your playbook as you go. Start with [Start a session](https://docs.chartnaut.com/guides/start-a-session). ## Let the agent build what you need Describe an [indicator](https://docs.chartnaut.com/guides/how-indicators-work), a definition, a study or an [app](https://docs.chartnaut.com/guides/build-your-own-pages), and the agent builds it, checks it against real data and waits for your [approval](https://docs.chartnaut.com/guides/approvals). Start with [The agent](https://docs.chartnaut.com/guides/how-the-agent-works). Uses [AI credits](https://docs.chartnaut.com/guides/ai-credits) or [your own AI subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription). --- # Plans URL: https://docs.chartnaut.com/start/plans/ Updated: 2026-11-22T22:28:23Z Compare Free and Pro: price, live accounts and the 14-day live trial, history, options data, research limits, add-ons and the CLI, MCP and API. Chartnaut has two plans, Free and Pro. Free includes the whole platform: real-time [Charts](https://docs.chartnaut.com/guides/how-charts-works), trading on [Chartnaut Demo](https://docs.chartnaut.com/guides/connect-chartnaut-demo), the [journal](https://docs.chartnaut.com/guides/daily-journal), your trades, backtest sessions, [research](https://docs.chartnaut.com/guides/how-research-works), apps, the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) and the [CLI, MCP server and API](https://docs.chartnaut.com/cli/overview). Pro adds trading through your own broker [accounts](https://docs.chartnaut.com/guides/how-accounts-work), all of the history, options data, alerts and higher limits. ## Compare plans | | Free | Pro | |---|---|---| | **Price** | $0 | $50/month | | **Chartnaut Demo accounts** | Unlimited | Unlimited | | [**Live broker accounts**](https://docs.chartnaut.com/account/live-accounts) | A [14-day live trial](https://docs.chartnaut.com/guides/live-trial) on 1 cTrader or TradeLocker account | 6 | | **Of those, MT4 or MT5** | None | 1 | | **Historical data** | 3 years | All, from 2015 | | **Backtest sessions start from** | Last 6 months | Any date | | **Economic calendar, rates and yields** | Yes | Yes | | [**Options Levels**](https://docs.chartnaut.com/guides/how-options-levels-are-calculated) | No | Yes | | [**Raw Option Chains**](https://docs.chartnaut.com/scripting/options-contracts) | No | Yes | | **Definitions** | 10 | 50 | | **Studies** | 50 | 1,000 | | **Definition events** | 15,000 | 150,000 | | [**Forward Insights**](https://docs.chartnaut.com/guides/forward-insights) | 5 | 25 | | [**Forward Insights on charts**](https://docs.chartnaut.com/guides/forward-insights-on-the-chart) | 1 | 5 | | [**Definition alerts**](https://docs.chartnaut.com/guides/definition-alerts) | None | 12 | | **Custom indicators** | 10 | Unlimited | | **Apps you build** | 5 | 15 | | **Dashboards** | 3 | 10 | | **Panels per dashboard** | 6 | 9 | | **Trades stored** | 250 | 12,000 | | **Panels open at once** | 4 | 8 | | **Indicators per chart** | 5 | 15 | | **Indicator memory** | 2,500 bars | 5,000 bars | | **Runs at once** | 1 | 3 | | **Playbooks with Historical Intelligence** | 3, on 3 markets | 5, on 5 markets | | **CLI, MCP and API** | 60 requests a minute | 300 requests a minute | How Options Levels are worked out, and the charts they cover, is on [How options levels are calculated](https://docs.chartnaut.com/guides/how-options-levels-are-calculated). Every other limit is on [Plans and limits](https://docs.chartnaut.com/account/plans-and-limits). ## Try live trading on Free Free comes with one [14-day live trial](https://docs.chartnaut.com/guides/live-trial): connect 1 cTrader or TradeLocker account and trade it from Charts. On day 14 the account disconnects. Your positions and orders at the broker are not closed. Buy Pro to keep it connected. ## Add-ons Pro can be topped up month by month with [add-ons](https://docs.chartnaut.com/account/add-ons): another MetaTrader account, more cTrader or TradeLocker accounts, more events, studies, definitions, runs at once, alerts, multistream hours or private stream seats. ## Paid separately [AI credits](https://docs.chartnaut.com/guides/ai-credits) pay for the agent on every plan, Free included, and are not part of any plan. You buy them as you need them, or [run the agent on your own Claude Code or Codex subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription) in [Chartnaut Desktop](https://docs.chartnaut.com/start/chartnaut-desktop). ## Check or change your plan Open the menu under your name at the bottom of the sidebar and choose **Subscription**. See [Subscription and billing](https://docs.chartnaut.com/account/subscription-and-billing). The **Limits** tab shows how much of each limit you have used. --- # Glossary URL: https://docs.chartnaut.com/start/glossary/ Updated: 2026-11-22T22:28:23Z Every Chartnaut term in one line, grouped by where you meet it. Every Chartnaut term in one line, grouped by where you meet it. Each entry links to the page that explains it in full. ## Charts ### Charts Where you chart, trade and replay. Open it from **Trading → Charts**. See [Charts](https://docs.chartnaut.com/guides/how-charts-works). ### Chartbook A saved Charts layout: its panels, indicators, theme and watchlist. See [Chartbooks](https://docs.chartnaut.com/guides/chartbooks). ### Panel One tile on Charts. A chart is a panel, and so are the watchlist, the order book, the Position Manager and the Chartnaut Assistant. See [Panels](https://docs.chartnaut.com/guides/panels). ### Real-time Charts on live markets. You trade on Chartnaut Demo on every plan, and through a connected broker account on Pro. ### Replay Charts on a past session, played forward bar by bar. See [Replay controls](https://docs.chartnaut.com/guides/replay). ## Options ### Options levels Prices on the chart where the options market's positioning is heaviest, worked out each night from the US options close. On Pro, as **Options Levels**; the per-contract data is **Raw Option Chains**, also on Pro. See [How options levels are calculated](https://docs.chartnaut.com/guides/how-options-levels-are-calculated). ### Call wall The strike at or above the price with the most call gamma exposure. Often watched as resistance. See [How options levels are calculated](https://docs.chartnaut.com/guides/how-options-levels-are-calculated). ### Put wall The strike at or below the price with the most put gamma exposure. Often watched as support. See [How options levels are calculated](https://docs.chartnaut.com/guides/how-options-levels-are-calculated). ### Gamma flip The price where dealers' total gamma turns from negative to positive. Above it their hedging tends to damp moves, below it to extend them. See [The sign assumption](https://docs.chartnaut.com/guides/how-options-levels-are-calculated#the-sign-assumption). ### Gamma exposure (GEX) How much stock or futures dealers would trade to stay hedged after a 1% move, in dollars, from gamma × open interest. See [How options levels are calculated](https://docs.chartnaut.com/guides/how-options-levels-are-calculated). ### Open interest How many contracts of an option are open at the start of a day, published each morning by the exchanges. ### Expected move The price of the front expiry's at-the-money straddle: how far the options market prices the underlying to move by that expiry. ### Implied volatility The volatility that makes an option's model price match its market price, as a yearly percentage. Chartnaut's 30-day figure is worked out the way the VIX is. ## Accounts and trading ### Chartnaut Demo A live-market account with virtual money. Included with every plan, Free included, with no limit on how many you open. See [Connect an account](https://docs.chartnaut.com/guides/how-accounts-work). ### MetaTrader MT4 or MT5 broker accounts you connect to trade for real. How many can be connected at once depends on your plan. See [Live slots](https://docs.chartnaut.com/guides/how-accounts-work). ### cTrader Broker accounts you connect by signing in with your cTrader ID, to trade for real. They share the same live allowance as MetaTrader. See [Connect cTrader](https://docs.chartnaut.com/guides/connect-ctrader). ### Symbol mapping The link between your broker's name for an instrument and Chartnaut's. See [Symbol mapping](https://docs.chartnaut.com/guides/symbol-mapping). ### Backtest session A practice run on historical data. You trade it on Charts in Replay. See [Start a session](https://docs.chartnaut.com/guides/start-a-session). ## Journal and playbooks ### Trade One position, from any account or backtest, saved with its fills, snapshots, notes and tags. See [Trade detail](https://docs.chartnaut.com/guides/trade-detail). ### Snapshot A chart image Chartnaut saves at a trade's entry and exit. See [Snapshots and replay](https://docs.chartnaut.com/guides/snapshots-and-replay). ### Journal A page per trading day for your notes, beside that day's trades. See [Daily journal](https://docs.chartnaut.com/guides/daily-journal). ### Playbook One setup you trade on purpose, with its rules, R-level targets and trades. See [What a playbook is](https://docs.chartnaut.com/guides/how-playbooks-work). ### R-level A target measured in multiples of your risk. A playbook has three: **Bare minimum**, **Main target** and **Extended target**, at 1R, 2R and 3R unless you change them. ### Historical Intelligence A model trained on one playbook's trades that gives the odds of reaching each R-level on your next trade. See [Historical Intelligence](https://docs.chartnaut.com/guides/historical-intelligence). ## Research ### Indicator A calculation drawn on the chart, such as a moving average. Definitions and studies can use indicators. See [Custom indicators](https://docs.chartnaut.com/guides/how-indicators-work). ### Definition A rule that recognises one market event. Run over history, it marks every time the event happened. See [What a definition is](https://docs.chartnaut.com/guides/how-research-works). ### Event One time a definition matched, stored with the market context at that moment. See [Browse events](https://docs.chartnaut.com/guides/browse-events). ### Profile A saved set of settings for a definition, so one definition can run with different parameters. See [Versions and profiles](https://docs.chartnaut.com/guides/versions-and-profiles). ### Study A question asked of a definition's events, answered with the sample behind it. See [What a study is](https://docs.chartnaut.com/guides/how-research-works). ### Forward Insight A finished study's answer, put on the chart. When the definition's event fires, the chart shows what usually happened next. When sharing is on for your account, you can share one so other people can add it to their charts. See [Forward Insights](https://docs.chartnaut.com/guides/forward-insights). ## Building ### Agent The assistant that builds indicators, definitions, studies and apps from a description and asks you to approve each step. See [The agent](https://docs.chartnaut.com/guides/how-the-agent-works). ### App A panel the agent writes for you, such as a report or a screener. Apps can also appear as tabs on trades, journal days and reports. See [What an app is](https://docs.chartnaut.com/guides/build-your-own-pages). ### Layer A drawing surface a script paints on, used inside indicators and definitions. See [Layers and rows](https://docs.chartnaut.com/scripting/layers-and-rows). ### Community library Indicators, definitions and apps other traders have published. See [Community library](https://docs.chartnaut.com/guides/community-library). ## Account ### AI credits What the agent spends. Bought separately from your plan. See [AI credits](https://docs.chartnaut.com/guides/ai-credits). ### API key A key that lets the Chartnaut CLI, a coding agent or your own code act as you. See [API keys](https://docs.chartnaut.com/cli/api-keys). ## Words that sound alike **Chartnaut Demo** is live markets with virtual money. **A backtest session** is historical data you trade in Replay. **Real-time** is Charts on live markets. **Replay** is Charts on a past session. **A study** measures the market around a definition's events. **A playbook** measures the trades you took. **A Forward Insight** shows what the market usually did after an event. **Historical Intelligence** shows how your own trades of a setup usually went. --- # Keyboard shortcuts URL: https://docs.chartnaut.com/start/keyboard-shortcuts/ Updated: 2026-11-22T22:28:23Z Search with ⌘K and move around Chartnaut with single keys. Move around Chartnaut from the keyboard. Single-key shortcuts work anywhere in the app except while you are typing in a field. ## Search | Keys | Does | |---|---| | **⌘K** (Mac) or **Ctrl+K** (Windows) | Opens search. Find a page, an instrument or an action such as **New Backtest Session**. | ## Go to | Key | Opens | |---|---| | **D** | [Dashboard](https://docs.chartnaut.com/guides/dashboard) | | **T** | [Charts](https://docs.chartnaut.com/guides/how-charts-works) | | **J** | [Journal](https://docs.chartnaut.com/guides/daily-journal), on today | | **P** | [Playbooks](https://docs.chartnaut.com/guides/how-playbooks-work) | | **S** | [Backtest sessions](https://docs.chartnaut.com/guides/session-reports) | | **N** | [A new backtest session](https://docs.chartnaut.com/guides/start-a-session) | | **R** | [Definitions](https://docs.chartnaut.com/guides/how-research-works) | --- # Set up Charts for how you trade URL: https://docs.chartnaut.com/guides/set-up-charts/ Updated: 2026-11-22T22:28:23Z Build your own chartbook: charts and panels side by side, your indicators on them and a theme you like. By the end of this tutorial you will have your own [chartbook](https://docs.chartnaut.com/guides/chartbooks): the charts and panels you trade with, laid out side by side, with your indicators on them and a theme you like. Switch to it any time and it comes back as you saved it. Charts is on every plan, and your plan sets how many panels and indicators fit. [How Charts works](https://docs.chartnaut.com/guides/how-charts-works) has the numbers. ## Create a chartbook Create the chartbook first, so everything you build from here lands in it. It starts from the layout already on screen. 1. Open **Trading → Charts**. 2. Hover the chartbook name in the top-left corner, next to your avatar. It reads **No Chartbook** if you have none yet. The **Chartbooks** menu opens. 3. Click **New Chartbook**. 4. Type a name in **Label**, for example "BTC intraday". 5. Pick a **Color**. The chartbook icon takes this colour, so you can tell your chartbooks apart at a glance. 6. Click **Create**. The new chartbook is now the active one, and its name shows in the top-left corner. ![New chartbook dialog](https://docs.chartnaut.com/captures/set-up-charts-new-chartbook.png) *The New chartbook dialog with a label and colour filled in.* ## Add your charts and panels Everything in Charts sits in one layout of [panels](https://docs.chartnaut.com/guides/panels). A panel is a chart or a tool such as the watchlist. 1. Click **Chart / Panel** in the top toolbar. A search bar opens with everything you can add. 2. Under **Charts**, choose **Candlesticks**. A new chart joins the layout. 3. Click the symbol in the chart's header. **Select instrument** opens. 4. Search for the market you trade, for example BTC, and pick it. 5. Set the timeframe with the control beside the symbol. 6. Click **Chart / Panel** again and choose **Watchlist** under **Tools**. ![Add chart or panel search](https://docs.chartnaut.com/captures/set-up-charts-add-panel.png) *The Chart / Panel search listing charts and tools you can add.* To put a second chart next to a particular one, hover that chart's header and click **Add Chart**, then **Split to Left**, **Split to Right** or **Split to Bottom**. Drag a panel by the grip at the left end of its header to move it, and click the bin icon beside **Add Chart** to remove it. When the layout is full for your plan, Chartnaut tells you how many panels your plan opens. Close one to make room. ## Choose a chart type Each chart has its own type. 1. Click the chart type control in the chart's header, beside the timeframe. 2. Pick a type from **Standard** (Bars, Candles, Line, Area), **Profiles** (Volume Bubbles, Volume Footprint, Volume Profile, Time Price Opportunity) or **Others** (Heikin Ashi). Some profiles can be combined with another type, and offer a **Pair with** list when you pick them. Types that do not suit the instrument show "Not supported for this asset class". Chart types you have built yourself appear under **Library**. [Chart types](https://docs.chartnaut.com/guides/chart-types) covers each one. ## Add indicators 1. Click **Indicator** in the top toolbar. 2. Under **Apply to**, pick the charts that should get the indicator. **All** picks every chart in the layout. 3. Type in **Search indicators...**, for example "VWAP", or browse the categories under **Native**. Your own indicators are under **Mine**, and ones other traders have shared are under **Community**. 4. Click the indicator. It appears on the charts you picked. ![Indicator picker](https://docs.chartnaut.com/captures/set-up-charts-indicator-dialog.png) *The indicator picker with Apply to set to one chart.* Hover a chart's header and click **Indicator** there to add straight to that chart. Your plan caps the indicators on one chart, and an indicator that brings others with it counts each of them. [Indicators on the chart](https://docs.chartnaut.com/guides/indicators-on-the-chart) shows how to change inputs and hide or remove an indicator, and [How indicators work](https://docs.chartnaut.com/guides/how-indicators-work) explains what an indicator is. ## Pick a theme 1. Hover the chartbook name and click **Colors & Settings**. 2. Open **Browse Themes** and click a theme, for example Obsidian for a dark chart or Polaris for a light one. The charts change as you click. 3. For finer control, work through **Appearance**, **Grid**, **Crosshair**, **Panes & Scales** and the other sections below it. 4. Click **Done**. ![Colors and Settings with themes](https://docs.chartnaut.com/captures/set-up-charts-themes.png) *Colors & Settings open on Browse Themes, showing the theme cards.* Every setting is explained in [Chart Settings and themes](https://docs.chartnaut.com/guides/chart-settings-and-themes). ## Save the chartbook Chartnaut keeps your changes as you work, but the chartbook itself only changes when you save it. 1. Hover the chartbook name. 2. Click **Save**. ![Chartbooks menu](https://docs.chartnaut.com/captures/set-up-charts-chartbook-menu.png) *The Chartbooks menu with Save, Duplicate and the chartbook library.* Your chartbook is listed under **Library** in the same menu. Click any chartbook there to switch layouts, and use **Duplicate** when you want a variation, such as the same charts on a different market. --- # Connect a broker and place your first trade URL: https://docs.chartnaut.com/guides/connect-and-place-a-trade/ Updated: 2026-11-22T22:28:23Z Connect MetaTrader, cTrader, TradeLocker or Chartnaut Demo, map your symbols, place a trade from the chart and find it in Trades and the Journal. By the end of this tutorial you will have an account connected to Chartnaut, a trade placed from the chart, and that trade recorded in [Trades](https://docs.chartnaut.com/guides/trades-library) and your [Journal](https://docs.chartnaut.com/guides/daily-journal). Accounts is on every plan. [How accounts work](https://docs.chartnaut.com/guides/how-accounts-work) explains the two kinds of account and what your plan allows. ## Pick an account to connect | Platform | You sign in with | What you get | Live slot | |---|---|---|---| | **MetaTrader 4** or **MetaTrader 5** | The login, password and server from your MetaTrader terminal | One account per login. Orders are real and fill at your broker | Yes | | **cTrader** | Your cTrader ID, on cTrader's own page. Chartnaut never sees your password | Every account behind that ID, live and demo. You pick which to trade | Yes, per linked account | | **TradeLocker** | The email, password and server you use in TradeLocker | Every account on that login, demo and live. You pick which to trade | Yes, per linked account | | **Chartnaut Demo** | Nothing to sign in to | Virtual money against live prices, filled on Chartnaut's servers | No | Pro has 6 live slots, up to 1 of them on MT4 or MT5. On Free, the [14-day live trial](https://docs.chartnaut.com/guides/live-trial) connects 1 cTrader or TradeLocker account. Chartnaut Demo is free on every plan, so start there if you want to practise. Follow the section for the one you chose, then carry on at Place a trade from the chart. ## Connect MetaTrader 1. Open **Trading → Accounts**. 2. Click **Connect account**. 3. On **What do you want to do?**, choose **Connect an existing account**. 4. On **Which platform?**, choose **MetaTrader 4** or **MetaTrader 5**. 5. Type a **Label**, then your **Login**, **Password** and **Server**, exactly as they appear in your MetaTrader terminal. 6. Leave **Sync past trades into Chartnaut** ticked to bring in your closed trades, and pick a **Lookback**: 90 days, 1 year, 3 years or All. 7. Click **Connect**. 8. Wait while Chartnaut provisions the account. This can take a few minutes, so keep the page open. 9. When **Account connected** appears, click **Continue**. ![MetaTrader details form](https://docs.chartnaut.com/captures/connect-and-place-a-trade-metatrader-details.png) *The MetaTrader details form with credentials and the Trade history section.* Chartnaut never stores or shows your password. [Connect MetaTrader](https://docs.chartnaut.com/guides/connect-metatrader) goes further. ## Connect cTrader 1. Open **Trading → Accounts**. 2. Click **Connect account**. 3. On **What do you want to do?**, choose **Connect an existing account**. 4. On **Which platform?**, choose **cTrader**. 5. Click **Connect with cTrader**, then sign in with your cTrader ID and grant access. 6. Tick the accounts you want to trade under *Live* or *Demo*, and adjust their labels. 7. Leave **Sync past trades into Chartnaut** ticked to bring in your closed trades, and pick a **Lookback**. 8. Click **Link account**. Chartnaut never sees your cTrader password. [Connect cTrader](https://docs.chartnaut.com/guides/connect-ctrader) goes further. ## Connect TradeLocker 1. Open **Trading → Accounts**. 2. Click **Connect account**. 3. On **What do you want to do?**, choose **Connect an existing account**. 4. On **Which platform?**, choose **TradeLocker**. 5. Enter your **Email**, **Password** and **Server**, for example ATLAS or HEROFX. 6. Click **Log in to TradeLocker**. Chartnaut looks on both Demo and Live, so you don't need to know which yours is on. 7. Tick the accounts you want to trade, and adjust their labels. 8. Leave **Sync past trades into Chartnaut** ticked to bring in your closed trades, and pick a **Lookback**. 9. Click **Link account**. Chartnaut keeps your TradeLocker login encrypted and never shows your password. [Connect TradeLocker](https://docs.chartnaut.com/guides/connect-tradelocker) goes further, including prop-firm accounts. ## Connect Chartnaut Demo 1. Open **Trading → Accounts**. 2. Click **Connect account**. 3. On **What do you want to do?**, choose **Use Chartnaut demo**. 4. Type a **Label**, for example "Practice". 5. Set **Leverage** and **Starting balance**. The balance starts at 100,000, in USD. 6. Click **Connect**. 7. When **Account connected** appears, click **Continue**. ![Connect account first step](https://docs.chartnaut.com/captures/connect-and-place-a-trade-start.png) *The first step of Connect account, with its three options.* You are back on Accounts, and the new account has a green dot. [Connect Chartnaut Demo](https://docs.chartnaut.com/guides/connect-chartnaut-demo) covers the options in more detail. ## Map your symbols This applies to MetaTrader, cTrader and TradeLocker. Your broker names its symbols its own way, such as BTCUSD where Chartnaut has Bitcoin. If the import finds symbols it cannot match, the account shows **Needs mapping** on the Accounts page. 1. Click the account. 2. Under **Map broker symbols**, click **Choose instrument** beside each broker symbol and pick the matching Chartnaut instrument. 3. For a symbol you do not want imported, click the circle at the end of its row to skip it. 4. When every symbol is mapped or skipped, click **Continue import**. 5. Check the summary of what will come in, then click **Import and adopt**. ![Map broker symbols](https://docs.chartnaut.com/captures/connect-and-place-a-trade-map-symbols.png) *Map broker symbols, with broker symbols linked to Chartnaut instruments.* Closed trades land in your trade library and reports. Open positions are adopted, so you can manage them from the chart like any other trade. [Symbol mapping](https://docs.chartnaut.com/guides/symbol-mapping) and [History import](https://docs.chartnaut.com/guides/history-import) go further. ## Place a trade from the chart 1. Open **Trading → Charts**. 2. Hover **Select Account** in the top toolbar and choose your account under **Accounts**. 3. Open a chart of the market you want to trade. [Set up Charts for how you trade](https://docs.chartnaut.com/guides/set-up-charts) shows how. 4. If the trade bar is hidden, click the trade bar icon at the right of the top toolbar. Its tooltip reads **Show trade bar**. 5. Check the symbol in the trade bar and set the size. 6. Click **Buy** or **Sell**. 7. Under **Log this trade?**, choose a [playbook](https://docs.chartnaut.com/guides/how-playbooks-work) to file the trade in, or click **Skip Playbook Selection**. With MetaTrader, cTrader or TradeLocker, the trade bar lists your broker's symbols. If the one you pick is not linked to a Chartnaut instrument yet, the bar shows **Map symbol to continue**. Click **Map symbol** and choose the matching instrument before you trade. ![Account picker in Charts](https://docs.chartnaut.com/captures/connect-and-place-a-trade-select-account.png) *The account picker in Charts, with a connected demo account selected.* The trade appears on the chart as a draft entry line at the current price. Nothing has been sent yet. ### Send the order 1. To add a stop loss or take profit, drag the arrows handle on the entry label up or down. Dragging towards profit gives you a take profit, away from it a stop loss. 2. Click the tick on the entry label. ![Draft trade on the chart](https://docs.chartnaut.com/captures/connect-and-place-a-trade-draft.png) *A draft buy on the chart, with the confirm tick and bracket handle.* The line reads **Filling...** until the order fills, then turns into your open position. To close it, hover the position's label and choose **Close Position**, or **Close Partial** to close part of it. [Trading from the chart](https://docs.chartnaut.com/guides/trading-from-the-chart) goes further, including the Position Manager panel. ## Find the trade in Trades and the Journal 1. Open **Trading → Trades** and find your trade in the list. It shows **Open** until you close it, then its result. 2. Click the trade to see its details and the [snapshots](https://docs.chartnaut.com/guides/snapshots-and-replay) Chartnaut took of your chart. 3. Once the trade is closed, open **Trading → Journal** and pick the day you closed it. The trade is listed under **Trades** for that day, ready for your notes. ![Trade in the Trades library](https://docs.chartnaut.com/captures/connect-and-place-a-trade-trades-library.png) *The Trades library with the new trade in the list.* Every trade you place from Charts is recorded the same way. [How your trades are recorded](https://docs.chartnaut.com/guides/how-your-trades-are-recorded) explains what is saved and when. --- # Test your first trading idea URL: https://docs.chartnaut.com/guides/test-your-first-trading-idea/ Updated: 2026-11-22T22:28:23Z Hand one trading idea to the agent: it finds every time it happened in two years of history, measures what came next, and puts the answer on your chart. In this tutorial you hand one trading idea to the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) and let it do the research. By the end you will know how often the idea actually worked across two years of history, and the answer will sit on your chart as a [Forward Insight](https://docs.chartnaut.com/guides/forward-insights) the next time it happens. The idea is the one from [How the pieces fit](https://docs.chartnaut.com/start/how-the-pieces-fit): BTC breaking the first 15-minute range of the New York session above VWAP. There, it came to 786 breaks, and breaks from above the upper VWAP band reached the prior day's high 51 times in 61. Your numbers will depend on your dates. The steps work for any idea. Research works on every plan, over three years of history on Free. The agent runs on [AI credits](https://docs.chartnaut.com/guides/ai-credits) or [your own AI subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription). ## Give the agent your idea Describe the idea and the question you want answered, the way you would to another trader. This is the one used here: > When BTC breaks the first 15-minute range of the New York session while price is above session VWAP, how often does it go on to reach the prior day's high? Use the last two years, and split the answer by how far above VWAP the break started. 1. Open **Agent** at the top of the sidebar. The page asks *What do you want to do?* 2. Under the message box, leave the mode on **Supervised**. The agent then shows you each step on the chart before it moves on, so you can correct it as it goes. 3. Type your idea and press Enter. ![The agent's first page](https://docs.chartnaut.com/captures/test-your-first-trading-idea-agent-start.png) *The agent page with the opening range question typed and Supervised selected.* ## Approve the plan Before building anything, the agent writes back a plan: what it will make, what it will measure, and what "done" looks like. It arrives as a *Plan proposal* card. 1. Read the plan. Check it has understood the idea, the instrument and the time window. 2. Click **Approve** to let it start, or send it back with what to change. ![Plan proposal card](https://docs.chartnaut.com/captures/test-your-first-trading-idea-plan.png) *A plan proposal card listing the steps and what done means.* ## Check the marks it makes The agent builds a [definition](https://docs.chartnaut.com/guides/how-research-works): your idea, written precisely enough that Chartnaut can spot it on a chart. It checks the script against real BTC data, then shows you the result as a *Result* card with the definition open beside the chat, its marks drawn on the chart. Look at a few days before you accept anything. Every number that follows depends on these marks being right. 1. Step through a handful of sessions on the chart beside the chat. 2. Check each mark sits on the bar where price left the range, and only on days when price was above VWAP. 3. If something is off, say so with the date: *On 12 March the mark fired before the first 15 minutes had finished.* The agent fixes it and shows you again. 4. When the marks look right, click **Accept**. ![Definition result beside the chat](https://docs.chartnaut.com/captures/test-your-first-trading-idea-definition.png) *The definition's marks on BTC beside the agent's Result card.* ## Let it find every break in history A definition only knows about the bars it has run over. To answer the question, it needs to run across two years of BTC. The agent asks first, with a *Data collection proposal* card showing the instrument and dates it wants. 1. Check the instrument is BTC and the dates cover two years. 2. Click **Collect**. The run takes a few minutes. When it finishes, the agent tells you how many times the break happened. In this example, 786. Each plan holds a set number of events, listed on [Definition events](https://docs.chartnaut.com/account/definition-events-limit). ![Run over history proposal](https://docs.chartnaut.com/captures/test-your-first-trading-idea-history.png) *The agent's proposal to run the definition over two years of BTC.* ## Run the study Now the agent writes a [study](https://docs.chartnaut.com/guides/build-and-run-a-study): the question itself, measured across all 786 breaks. It asks before running it, with a *Study run proposal* card showing how many events are in scope. 1. Click **Run**. 2. Watch the progress in the chat. When it completes, a *Study results* card appears. 3. Click **Open the full report** to see it beside the chat. ![Study results](https://docs.chartnaut.com/captures/test-your-first-trading-idea-results.png) *The study report: how often breaks reached the prior day's high, by distance from VWAP.* The report gives the answer with the sample behind every number: how often breaks reached the prior day's high, and how that changes with distance from VWAP. In this example, breaks from above the upper band did it 51 times in 61. Ask the agent anything about the result in the chat, or ask it to split the answer another way. [Read the results](https://docs.chartnaut.com/guides/read-the-results) explains every part of the report. ## Put the answer on your chart A number in a report is easy to forget. A Forward Insight puts it on the chart, on the bar where the break happens. 1. On the *Study results* card or in the report, click **Put on chart**. 2. Under *What should it show?*, pick the rate of reaching the prior day's high and click **Continue**. When you start from the card, it is marked *From your results*. 3. Under *Split it by*, pick distance from VWAP, and click **Build it**. Chartnaut fits the study to your chart in about a minute. 4. Step through the last few breaks with the reading drawn over what happened after each, then click **Put on chart**. A confirmation in the chat says it is *On your chart*, with **Open chart** to go there. ![Put on chart](https://docs.chartnaut.com/captures/test-your-first-trading-idea-attach.png) *The last step: a recent break previewed, the name, and Put on chart.* ## See it on the chart 1. Click **Open chart**, or open **Trading → Charts** on BTC. 2. When the break happens, live or in a [replay](https://docs.chartnaut.com/guides/replay), a marker appears on that bar. Click it to see the reading: 51 in 61, for breaks like this one. ![Forward Insight on the chart](https://docs.chartnaut.com/captures/test-your-first-trading-idea-chart-insight.png) *A Forward Insight open on BTC at the bar where the range broke.* That is the whole loop: an idea, the evidence behind it, and the answer waiting where you trade. Everything the agent made is kept under **Tools → Definitions**, where you can run the definition on other markets or ask new questions of the same events. [How research works](https://docs.chartnaut.com/guides/how-research-works) explains each piece in depth. --- # Turn your trades into a playbook URL: https://docs.chartnaut.com/guides/turn-your-trades-into-a-playbook/ Updated: 2026-11-22T22:28:23Z Create a BTC opening range playbook, set its R-levels and tags, file your trades into it, read its reports and see what Historical Intelligence needs. By the end of this tutorial you will have a playbook called *BTC opening range*, with its entry rule and R-level targets set, the tags you check on every trade, and your BTC opening range trades filed and tagged inside it. You will read its reports and see exactly how far it is from training [Historical Intelligence](https://docs.chartnaut.com/guides/historical-intelligence). You need a few BTC trades in [Trades](https://docs.chartnaut.com/guides/trades-library) first, from [MetaTrader](https://docs.chartnaut.com/guides/connect-metatrader), [cTrader](https://docs.chartnaut.com/guides/connect-ctrader), [Chartnaut Demo](https://docs.chartnaut.com/guides/connect-chartnaut-demo) or a [backtest session](https://docs.chartnaut.com/guides/backtest-on-random-days). Playbooks work on every plan. ## Create the playbook 1. Open **Trading → Playbooks**. 2. Click **New playbook**. The first step, **Overview**, explains what a playbook is. 3. Click **Continue to Setup**. 4. In **Playbook name**, type `BTC opening range`. 5. Pick a **Color**. The playbook shows in this colour on your trades and on the chart. 6. Under **Risk-reward targets**, leave **Bare minimum** at 1.0, **Main target** at 2.0 and **Extended target** at 3.0. These are your [R-levels](https://docs.chartnaut.com/guides/how-playbooks-work): where you take early profit, where the setup usually pays, and where you let a runner go. 7. Click **Create Playbook**. ![Create Playbook Setup step](https://docs.chartnaut.com/captures/turn-your-trades-into-a-playbook-setup-step.png) *The Setup step with the name, colour and three R-level targets filled in.* Chartnaut opens the playbook on its **Trade Book** tab. It is empty for now, and says **Add an instrument to start collecting**. Filing your first BTC trade adds BTC for you. ## Write down the entry rule 1. Click the settings button beside the playbook's name. **Playbook settings** opens. 2. Under **Entry Trigger**, write the rule in one sentence: `A 5-minute close outside the first 15-minute range of the New York session.` 3. Click **Save**. Anyone reading the playbook later, including you in six months, now knows exactly which trades belong in it. ## Add the tags Tags are the conditions you tick on every trade. Pick the few that you think decide whether this setup works. 1. Open the **Tags** tab. 2. Click **New tag**, type `Above VWAP`, leave the type on **Checkbox** and press Enter. 3. Add two more checkboxes the same way: `Retest held` and `Gap day`. 4. Click **New tag**, type `Range size`, choose **Radio Group** and press Enter. 5. Under **Range size**, click **New option** and add `Narrow`, `Normal` and `Wide`. ![Tags tab with four tags](https://docs.chartnaut.com/captures/turn-your-trades-into-a-playbook-tags-tab.png) *The Tags tab with three checkboxes and a Range size group.* A **Radio Group** takes exactly one option per trade, so every trade gets one range size. See [Tags and criteria](https://docs.chartnaut.com/guides/tags-and-criteria). ## File your trades into it 1. Open **Trading → Trades**. 2. Click one of your BTC opening range trades. Its detail opens on the **Overview** tab. 3. Click the **Playbook** row. Under **Log this trade to**, choose **BTC opening range**. The first time, Chartnaut adds BTC to the playbook's instruments. 4. Click the **Tags** row. The list asks **Which criteria does this position meet?** 5. Tick the tags that were true on this trade and choose one **Range size**. 6. Click **Save**. 7. Open the next BTC opening range trade in the list and repeat. ![Playbook and Tags rows on a trade](https://docs.chartnaut.com/captures/turn-your-trades-into-a-playbook-trade-rows.png) *A trade's Tags list open, with BTC opening range set as its playbook.* From now on you can file trades as you place them: when you click **Add to chart** in the Position Manager, Chartnaut asks **Log this trade?** and shows the same tags. See [Trading from the chart](https://docs.chartnaut.com/guides/trading-from-the-chart). ## Read its reports 1. Open **Trading → Playbooks** and click **BTC opening range**. 2. Open the **Overview** tab. The top row shows **Cumulative R**, **Win rate**, **Trades** and **Average R**, with R over time beneath. 3. Open the **Trade Book** tab and switch to **Table** to check every trade you filed is there. 4. Open the **Reports** tab and click **Correlations**. For each tag, it compares your win rate on trades that had the tag with trades that did not. 5. Go back to **Reports** and try **Trade Timing** and **Monte Carlo**. Trade Timing shows which hours of the day pay you; Monte Carlo shuffles your results thousands of times to show the range of outcomes and drawdowns you could expect. ![Playbook Reports tab](https://docs.chartnaut.com/captures/turn-your-trades-into-a-playbook-reports.png) *The Reports tab listing the Time, Instruments, Analysis, Performance and Simulations groups.* With twenty trades the numbers are a first read. Keep filing and tagging, and they firm up. See [Playbook reports](https://docs.chartnaut.com/guides/playbook-reports). ## See what Historical Intelligence needs 1. Open the **Historical Intelligence** tab. 2. Choose **BTC** in the instrument tabs at the top. Historical Intelligence trains per instrument, and each tab shows its trade count. 3. Read **Trades to train**. You can train once BTC has 100 closed, tagged trades. Until then the panel below reads **Not enough BTC trades yet**. 4. Click **Data sources** to choose which trades count. **Logged** trades from the Trade Book are always included. The trades you filed from Trades count under **Live** (Chartnaut Demo and MetaTrader) or **Backtest**, so keep both switched on. **Training total if saved** shows the count before you save. 5. Check the three R targets in the targets panel match the ones you set. Change them here before you train: saving new targets later switches the model off until you retrain it. ![Historical Intelligence tab before training](https://docs.chartnaut.com/captures/turn-your-trades-into-a-playbook-historical-intelligence.png) *Historical Intelligence for BTC showing trades to train and the three R targets.* Once BTC reaches 100, the button reads **Train BTC**. Click it and Chartnaut trains a model on your tagged BTC trades that gives the odds of reaching each of your three R-levels. How many playbooks and instruments you can train depends on your plan: see [Historical Intelligence limits](https://docs.chartnaut.com/account/historical-intelligence-limits). Your playbook now holds your BTC opening range trades, tagged the same way every time, with reports that show where the setup pays and a count that tells you how far you are from Historical Intelligence. --- # Backtest on random days URL: https://docs.chartnaut.com/guides/backtest-on-random-days/ Updated: 2026-11-22T22:28:23Z Trade a week of BTC from a random Monday in Replay, log each trade into your playbook as you take it, and file the rest afterwards. By the end of this tutorial you will have traded a week of BTC from a Monday Chartnaut picked at random, logged each opening range trade into your *BTC opening range* playbook as you took it, and filed any you missed afterwards. Because you did not choose the date, you cannot remember what happens next, and the practice counts. This uses the playbook from [Turn your trades into a playbook](https://docs.chartnaut.com/guides/turn-your-trades-into-a-playbook). Backtesting and filing trades into a playbook work on every plan. ## Start the session 1. Open **Tools → Backtest**. Your past sessions are listed here. 2. Click **New session**. The New Session page opens on **Quickstart**. 3. Under **Instruments**, click **What do you want to trade?** and choose BTC. The **History** row shows the dates available. 4. Under **Session**, change **Name** to `BTC random week`. 5. Leave **Start** on **Random date**. Chartnaut picks a Monday at random from BTC's history, and the session opens at 07:00 UTC that day. 6. Under **Timing**, turn on **End after**, then set **Simulated** to `5` **Days**. Leave **Duration** on **Unlimited**, so there is no real-time limit. 7. Under **Account**, leave **Balance** at 100,000. 8. Click **Start session**. ![New Session in Quickstart](https://docs.chartnaut.com/captures/backtest-on-random-days-quickstart.png) *Quickstart set to BTC, a random start date and a five-day end.* The chart opens in Replay on the date Chartnaut picked, with the replay controls on the chart. **Advanced** on the New Session page adds margin, commissions, slippage and risk rules when you want a stricter test. See [How backtesting works](https://docs.chartnaut.com/guides/how-backtesting-works). ## Get to the open 1. In the replay controls, set the timeframe to `1m`. Each step and each played bar then moves one minute. The list offers the timeframes of your open charts, so open a 1-minute BTC chart if `1m` is missing. 2. Hover over the go-to button at the right end of the controls and choose **New York Session**. The replay jumps to 13:30 UTC. 3. Click **Step Forward One Bar** until the first 15 minutes of the New York session have printed. Mark the range's high and low with the [drawing tools](https://docs.chartnaut.com/guides/drawing-tools) if it helps. 4. Click **Play Simulation** to let bars print on their own, and drag the speed slider to set the milliseconds between bars. Click **Pause Simulation** to stop. ![Replay controls with the go-to menu](https://docs.chartnaut.com/captures/backtest-on-random-days-replay-controls.png) *The replay controls with the go-to menu open on New York Session.* See [Replay](https://docs.chartnaut.com/guides/replay) for every control. ## Trade the setup and log it When BTC closes a bar outside the range, take the trade and file it in one go. 1. Right-click the chart and choose **Position Manager → Open as a Panel**. 2. Set up the trade with its stop and target. See [Trading from the chart](https://docs.chartnaut.com/guides/trading-from-the-chart). 3. Click **Add to chart**. A list opens asking **Log this trade?**. 4. Click **BTC opening range**. Its tags open beside it. 5. Tick the tags that are true right now and choose a **Range size**. 6. Click **Draft**. The trade appears on the chart as a draft, with a tick and a cross on its entry label. 7. Click the tick to place it. Hovering the draft also offers **Confirm Trade** and **Cancel Trade**. ![Log this trade list with tags](https://docs.chartnaut.com/captures/backtest-on-random-days-log-this-trade.png) *Log this trade with BTC opening range chosen and its tags open.* For a trade outside the setup, choose **Skip Playbook Selection** in the same list. Keep stepping and playing through the week. When a trade closes, Chartnaut saves it with its fills and chart [snapshots](https://docs.chartnaut.com/guides/snapshots-and-replay). You can stop any time. To carry on later, open the session from **Tools → Backtest** and click **Play**. ## Find the trades and file any you missed 1. Open **Tools → Backtest** and click **BTC random week**. 2. Open the **Trades** tab. **Positions** lists every trade you took. 3. Click a trade. It opens in [Trades](https://docs.chartnaut.com/guides/trades-library), showing its detail. 4. If the **Playbook** row is empty, click it and choose **BTC opening range** under **Log this trade to**. 5. Click the **Tags** row, tick the tags that were true, and click **Save**. 6. Go back to the session and repeat for each trade you missed. ![Session Trades tab](https://docs.chartnaut.com/captures/backtest-on-random-days-session-trades.png) *The session's Trades tab listing the week's BTC positions.* The session's **Reports** tab shows how the week went on its own: see [Session reports](https://docs.chartnaut.com/guides/session-reports). Your trades also sit in Trades under the origin **Backtest**, and they count towards your playbook's [Historical Intelligence](https://docs.chartnaut.com/guides/historical-intelligence) while **Backtest** is switched on in its **Data sources**. Open **BTC opening range** from **Trading → Playbooks** and its **Overview** now includes the week you traded, with every trade tagged the same way as the rest. --- # Add your first view URL: https://docs.chartnaut.com/guides/add-your-first-view/ Updated: 2026-11-22T22:28:23Z Build a view with the agent that shows how far price ran after you exited, in R, then publish it to every trade, change it and take it off. By the end of this tutorial, every trade you open has a tab showing how far price ran after you exited, measured in R. You build it once, on one trade, and it works on all of them. You need at least one closed trade in [Trades](https://docs.chartnaut.com/guides/trades-library). If you have none yet, [connect a broker and place a trade](https://docs.chartnaut.com/guides/connect-and-place-a-trade) first. ## Describe the view 1. Open **Trading → Trades**. 2. Click a closed trade to open it. 3. In the trade's tabs, beside **Overview** and **Details**, click **+ View**. 4. In the box under *Build a custom view*, type: `How far did price run after I exited, in R? Show the furthest point in my direction in the hour after the exit, and when it got there.` 5. Press **Build**. Chartnaut asks *How should it be built?* 6. Click **Build it with me**. ![Describing a view on a trade](https://docs.chartnaut.com/captures/add-your-first-view-describe.png) *The + View popover on a trade, with the description typed in.* **Build it for me** suits simple views such as a table or one chart, and the agent finishes those on its own. This view needs checking against real trades, so you build it with the agent. The app builder opens. Your description is already sent to the agent in the chat, and the preview on the right is set to the trade you came from. ## Build it with the agent 1. Watch the chat while the agent works. *Working* shows above the preview until it finishes. 2. When it stops, open the **App** tab. The view draws on your trade, with the run after your exit in R. 3. Check the number against what you know of the trade. If you exited a long BTC trade at 64,200 with a $400 stop and price reached 65,200 in the next hour, the view should show 2.5R. 4. Click **Preview as** and pick another trade, ideally one that went the other way. The view redraws on that trade. ![The view in the app builder](https://docs.chartnaut.com/captures/add-your-first-view-builder.png) *The app builder with the chat on the left and the view previewed on a trade.* ## Refine it 1. Type a change in the chat, for example: `Also show the run in points, and flag trades where price came back through my entry before it ran.` 2. Wait for the agent to finish, then check the preview again on two or three trades. 3. If you edit the code yourself in the **Code** tab, press **Run** to see your change drawn. Keep going until the numbers match what you see on the chart. See [the builders' agents](https://docs.chartnaut.com/guides/builder-agents) for what the builder's chat can do. ## Publish it 1. Press **Publish**. A dialog ticks off *Compiling the app*, *Checking what it references* and *Storing the version*. 2. When it shows *Published version 1*, the view is live. 3. Go back to **Trading → Trades** and open the same trade. The view is a new tab in the trade's tabs. Click it to see the result for this trade. ![The finished view on a trade](https://docs.chartnaut.com/captures/add-your-first-view-on-trade.png) *A trade with the new view's tab selected and its result showing.* ## See it on another trade 1. Close the trade and open a different one. 2. Click the view's tab. Same view, this trade's numbers. Every trade you take from now on has it too. ## Change it later 1. Open **Tools → Apps** and find the view. 2. Open its menu and click **Open editor**. 3. Ask the agent for the change, then press **Publish**. Every trade shows the new version the next time you open the tab. ## Take it off 1. Open any trade and hover the view's tab. 2. Click the ×. The view comes off every trade. It stays in **Tools → Apps**, and **+ View** lists it under *Your views* if you want it back. [Build your own pages](https://docs.chartnaut.com/guides/build-your-own-pages) has ideas for the other five kinds of page. --- # Build your own indicator URL: https://docs.chartnaut.com/guides/build-your-own-indicator/ Updated: 2026-11-22T22:28:24Z Describe a session VWAP with standard deviation bands to the agent, check it on the chart, save it and add it to Charts. By the end of this tutorial you will have your own session VWAP with bands at 1 and 2 standard deviations, checked against real data, saved in your library and drawn on a chart in [Charts](https://docs.chartnaut.com/guides/how-charts-works). The upper band is the one the opening range study in [Test your first trading idea](https://docs.chartnaut.com/guides/test-your-first-trading-idea) splits its breaks by. The [agent](https://docs.chartnaut.com/guides/how-the-agent-works) writes the script, paid for with [AI credits](https://docs.chartnaut.com/guides/ai-credits) or [your own AI subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription). You describe what you want and check what it draws. ## Describe the indicator Say what it calculates, when it resets and what it should look like. This is the description used here: > Build a session VWAP that resets at the New York session open, with bands at 1 and 2 standard deviations above and below. Draw VWAP as a solid line and the bands as thinner lines. 1. In the sidebar, open **Tools → Indicators**. 2. Click **New** at the top right. The page asks *What do you want to build?* 3. Type your description into the box and press Enter. *Session VWAP with σ bands* under **Suggested indicators** fills in a similar prompt if you would rather start from that. ![New indicator page](https://docs.chartnaut.com/captures/build-your-own-indicator-new-indicator.png) *The new indicator page with the session VWAP description typed in.* Chartnaut creates the indicator and opens the builder: the agent's chat on the left, a preview on the right. The agent writes the script and applies each change as it goes. Each change appears in the chat as a card with a one-line summary, and opening the card shows the code. ## Preview it on the chart 1. In the preview, open the **Chart** tab. 2. Check that VWAP starts fresh at the New York open and that both pairs of bands sit either side of it. 3. Use the arrows either side of the date to step through a few trading days, including a quiet one and a busy one. The bands should be tight on a quiet day and wide on a busy one. If they are the same width every day, the standard deviation is not being calculated per session. ![Indicator builder chart](https://docs.chartnaut.com/captures/build-your-own-indicator-preview.png) *Session VWAP with 1 and 2 standard deviation bands in the builder preview.* ## Fix it with the agent When something looks wrong, tell the agent what you see and on which day. It edits the script and the chart redraws. - *The VWAP carries on from yesterday instead of resetting at the New York open.* - *The 2 standard deviation bands are drawn in the same colour as the 1 standard deviation bands. Make them fainter.* - *Add a setting for the band multipliers so I can change them.* If the chart stays empty, the **Errors** tab shows what stopped the script, and the agent reads it too. The **Logs** tab shows anything the script prints. ## Save it Each working change the agent makes is saved to the indicator as a new version, so it is already in your library. If you edit the code yourself in the **Code** tab, save it when you are done. Open **Tools → Indicators** and click the indicator to see it. The **Versions** tab lists every saved version, and **Preview Settings** shows the settings it exposes. To change it later, click **Make a change** and carry on with the agent. ## Add it to a chart 1. Open **Trading → Charts**. 2. Click **Indicator** in the toolbar. 3. Under **Library**, choose **Mine**. 4. Click your session VWAP. The indicator draws on the chart straight away. [Indicators on the chart](https://docs.chartnaut.com/guides/indicators-on-the-chart) covers its settings, hiding it and removing it. ![Indicator picker with Mine selected](https://docs.chartnaut.com/captures/build-your-own-indicator-picker.png) *The indicator picker in Charts with your own indicators under Mine.* --- # Build your first app URL: https://docs.chartnaut.com/guides/build-your-first-app/ Updated: 2026-11-22T22:28:24Z Build a pre-market briefing with the agent, test it against the chart, publish it and open it from Tools → Apps. By the end of this tutorial you have a pre-market briefing of your own in **Tools → Apps**: one page with the overnight moves on the markets you trade and the positions you still hold, ready to open before the session. An app is a page of its own. If you want something that appears on every trade or journal day instead, that is a view: see [Add your first view](https://docs.chartnaut.com/guides/add-your-first-view). ## Start the app 1. Open **Tools → Apps**. 2. Click **New app**. The page asks *What should this app show?*, with *Suggested apps* underneath. 3. Type: `Build me a pre-market briefing: how far BTC, ETH and EURUSD have moved overnight, yesterday's high and low for each, and any positions I still hold.` 4. Press Enter. ![Describing a new app](https://docs.chartnaut.com/captures/build-your-first-app-new.png) *The new app page with the pre-market briefing description typed in.* The app builder opens with your description sent to the agent. The chat is on the left. The preview on the right has four tabs: **App**, **Code**, **Details** and **Logs**. You can start the same app from [Agent](https://docs.chartnaut.com/guides/how-the-agent-works) too. **Pre-market briefing** is one of its suggestions. ## Watch it build 1. Follow the chat while the agent writes the app. *Working* shows above the preview until it finishes. 2. Open the **Code** tab if you want to see the files it writes. You never have to touch them. 3. When the agent stops, open the **App** tab. The briefing draws on real market data. ![The briefing in the app builder](https://docs.chartnaut.com/captures/build-your-first-app-builder.png) *The app builder with the chat on the left and the briefing in the App tab.* ## Test it 1. Pick one number and check it. Open **Trading → Charts** on BTC and compare the move from yesterday's close to the current price with what the app shows. 2. Ask for what is missing or wrong in the chat, for example: `Sort the moves by size and show each as a share of yesterday's range.` 3. Check the preview again once the agent finishes. 4. If you change the code yourself in **Code**, press **Run**. Run draws the app from the code as it stands, unsaved edits included. Repeat until the page shows what you want to read at 8am. The builder saves as you go, so there is no save button. ## Publish it 1. Press **Publish**. A dialog ticks off *Compiling the app*, *Checking what it references* and *Storing the version*. 2. When it shows *Published version 1*, the dialog closes on its own. Publishing stores a version of the app for you. It stays private: only you can see it until you change its visibility, covered in [Community library](https://docs.chartnaut.com/guides/community-library). ## Open it 1. Open **Tools → Apps**. 2. Click the briefing's row. The briefing opens as its own page, with current data. Use **Refresh** in its header to redraw it, and **Edit** to go back to the builder when you want to change it. Each change reaches the page when you press **Publish** again. ![The published briefing](https://docs.chartnaut.com/captures/build-your-first-app-open.png) *The published pre-market briefing open as its own page.* [Build an app](https://docs.chartnaut.com/guides/build-an-app) covers apps in more depth, and [What views and apps can see and change](https://docs.chartnaut.com/guides/app-permissions) explains what an app can read. --- # How Charts works URL: https://docs.chartnaut.com/guides/how-charts-works/ Updated: 2026-11-22T22:28:24Z Real-time and replay, panels side by side, chartbooks, what a chart shows, trading from the chart and what your plan allows. Charts is where you watch the market and trade it. You arrange charts and tools side by side, save the arrangement as a chartbook, and place trades straight from the price. Charts is on every plan, and so is trading from it on [Chartnaut Demo](https://docs.chartnaut.com/guides/connect-chartnaut-demo). Trading through your own broker needs Pro, or the [14-day live trial](https://docs.chartnaut.com/guides/live-trial) on Free. ## Real-time and replay Hover **Charts** in the sidebar and it offers two ways in. - **Real-time** shows the market as it moves. Select an account and you can trade it. On Free you can select a [Chartnaut Demo](https://docs.chartnaut.com/guides/connect-chartnaut-demo) account, or the account of your [live trial](https://docs.chartnaut.com/guides/live-trial). - **Replay** opens your current backtest session and plays history forward bar by bar, so you can trade past days as if they were happening now. It is greyed out with "No session" until you have [started a session](https://docs.chartnaut.com/guides/start-a-session). Both use the same charts, indicators and tools. Real-time and replay each keep their own working changes, so trying a new layout in a replay does not move your live one. [Replay](https://docs.chartnaut.com/guides/replay) covers the controls, and [How backtesting works](https://docs.chartnaut.com/guides/how-backtesting-works) explains sessions. ![Charts sidebar modes](https://docs.chartnaut.com/captures/how-charts-works-modes.png) *Hovering Charts in the sidebar shows Replay and Real-time.* ## Panels side by side Everything in Charts sits in one layout of [panels](https://docs.chartnaut.com/guides/panels). Click **Chart / Panel** in the top toolbar to add one, or hover a chart's header and use **Add Chart** to split it left, right or down. Drag a panel by the grip in its header to move it. | Panel | What it is for | |---|---| | Candlesticks, Volume Footprint, Volume Profile, Time Price Opportunity | A chart, opened with that [chart type](https://docs.chartnaut.com/guides/chart-types) | | **Watchlist** | The instruments you follow, with their prices | | **Position Manager** | Orders and risk for the account you trade | | **Order Book / DOM** | Market depth for the instrument | | **Chartnaut Assistant** | The [agent](https://docs.chartnaut.com/guides/how-the-agent-works), working on this chart | Time & Sales and Heatmap are listed as coming soon. ![Charts with several panels](https://docs.chartnaut.com/captures/how-charts-works-layout.png) *Charts with two charts, a watchlist and the Position Manager side by side.* ## Chartbooks A [chartbook](https://docs.chartnaut.com/guides/chartbooks) is a saved layout: its panels, instruments, indicators, chart settings and theme. The chartbook menu sits in the top-left corner, next to your avatar. From there you create, switch, duplicate and save chartbooks. Chartnaut keeps your changes as you work, and the chartbook itself changes when you click **Save**. [Set up Charts for how you trade](https://docs.chartnaut.com/guides/set-up-charts) walks through building one. ## What a chart shows Each chart's header holds its symbol, timeframe and chart type. The standard types are Bars, Candles, Line and Area, alongside Heikin Ashi and volume views such as Volume Footprint, Volume Profile and Time Price Opportunity. Chart types you build yourself appear under **Library** in the same picker. On top of the price you can add: - [Indicators](https://docs.chartnaut.com/guides/indicators-on-the-chart), built in or your own, from **Indicator** in the top toolbar. - A [definition's events](https://docs.chartnaut.com/guides/definitions-on-the-chart), marked on the bars where they happened. - [Forward Insights](https://docs.chartnaut.com/guides/forward-insights-on-the-chart): put a study on the chart and, when its event fires, the chart shows what usually happened next. - [Drawings](https://docs.chartnaut.com/guides/drawing-tools) such as lines, channels, Fibonacci levels and text. Colours, grid, crosshair and scales are under **Colors & Settings** in the chartbook menu, with ready-made themes under **Browse Themes**. [Chart Settings and themes](https://docs.chartnaut.com/guides/chart-settings-and-themes) has the detail. The connection status in the top toolbar reads Live, Slow or Offline, and [Market data](https://docs.chartnaut.com/guides/market-data) explains what each means. ## Trading from the chart Hover **Select Account** in the top toolbar to choose which [account](https://docs.chartnaut.com/guides/how-accounts-work) Charts trades through. **None** keeps Charts for charting only. With an account selected, the trade bar places a draft trade on the chart; you set the stop and target on the price, then confirm it. [Trading from the chart](https://docs.chartnaut.com/guides/trading-from-the-chart) covers the trade bar and the Position Manager, and [Connect a broker and place your first trade](https://docs.chartnaut.com/guides/connect-and-place-a-trade) walks through a first trade. Every trade you place is saved to [Trades](https://docs.chartnaut.com/guides/trades-library) with [snapshots](https://docs.chartnaut.com/guides/snapshots-and-replay) of your chart, and you can file it in a [playbook](https://docs.chartnaut.com/guides/how-playbooks-work) as you place it. ## What your plan allows Your plan sets how many panels Charts opens at once and how many indicators one chart can hold. | | Free | Pro | |---|---|---| | Panels open at once | 4 | 8 | | Indicators on one chart | 5 | 15 | Every tile counts as a panel, tools included. An indicator that brings others with it counts each of them. A layout saved before a plan change keeps all its panels; it cannot grow past the new limit. [Chart limits](https://docs.chartnaut.com/account/chart-limits) and [Plans](https://docs.chartnaut.com/start/plans) have the full picture. --- # Chartbooks URL: https://docs.chartnaut.com/guides/chartbooks/ Updated: 2026-11-22T22:28:24Z Save a Charts layout as a chartbook, keep variations with Duplicate, and switch between them from one menu. A chartbook is a saved Charts layout. Keep one per way you trade, such as "BTC intraday" with a one-minute chart and a footprint, and "Swing" with daily charts across five markets, and switch between them from one menu. [Set up Charts for how you trade](https://docs.chartnaut.com/guides/set-up-charts) builds a first one step by step. ## What a chartbook holds - The [panels](https://docs.chartnaut.com/guides/panels) and how they are arranged and sized - Each chart's instrument, timeframe and [chart type](https://docs.chartnaut.com/guides/chart-types) - The [indicators](https://docs.chartnaut.com/guides/indicators-on-the-chart) on each chart, with their settings - Your [chart settings and theme](https://docs.chartnaut.com/guides/chart-settings-and-themes) - Where you left the floating toolbars ## The Chartbooks menu Hover the chartbook name in the top-left corner of Charts, next to your avatar. It reads *No Chartbook* until you create one. The menu has two parts. | Group | Item | What it does | |---|---|---| | Active | **Colors & Settings** | Opens the settings and themes for the chartbook on screen | | Active | **Save** | Writes the layout on screen into the active chartbook | | Active | **Duplicate** | Opens a new chartbook named after the active one with "Copy" added | | Library | Your chartbooks | Click one to switch to it. A tick marks the active one | | | **New Chartbook** | Creates a chartbook from the layout on screen | ![The Chartbooks menu](https://docs.chartnaut.com/captures/chartbooks-menu.png) *The Chartbooks menu with the Active items and three chartbooks in Library.* ## Save your changes Chartnaut keeps every change you make in Charts as you work, in this browser, so a reload brings the layout back as you left it. The chartbook itself changes only when you save it. 1. Hover the chartbook name. 2. Click **Save**. A *Your chartbook has been saved successfully* message confirms it. Until you save, the chartbook on the server and on your other devices is the last saved version. Real-time Charts and each [replay](https://docs.chartnaut.com/guides/replay) session keep their own unsaved changes. Rearranging panels during a backtest does not move your live layout, and nothing changes in either until you click **Save**. ## Make a variation **Duplicate** is the quickest way to try something new without touching a layout you rely on, for example the same charts on ETH instead of BTC. 1. Hover the chartbook name and click **Duplicate**. 2. Change the **Label** if you want, pick a **Color**, and click **Create**. 3. Change the copy. Your original is unchanged. The new chartbook takes the layout on screen, including anything you have not saved. ## Rename or recolour a chartbook 1. Hover the chartbook name. 2. In **Library**, hover the chartbook and click the pencil icon. 3. Change the **Label** or **Color** in *Edit chartbook*. 4. Click **Update**. **Update** also saves the layout on screen into that chartbook. Switch to a chartbook before you edit it, or the one you edit takes the layout of the one you are looking at. ![Edit chartbook dialog](https://docs.chartnaut.com/captures/chartbooks-edit.png) *The Edit chartbook dialog with Label, Color and Update.* ## Ask the assistant The **Chartnaut Assistant** panel can save the active chartbook or switch to another one for you. Ask it, for example, *Save this layout*, and approve the change when it asks. [How the agent works](https://docs.chartnaut.com/guides/how-the-agent-works) covers approvals. ## Limits Your plan sets how many panels a chartbook opens and how many indicators each chart holds, as listed on [Chart limits](https://docs.chartnaut.com/account/chart-limits). A chartbook saved before a plan change keeps all its panels, but cannot grow past the new limit. --- # Panels URL: https://docs.chartnaut.com/guides/panels/ Updated: 2026-11-22T22:28:24Z Add charts and tools to your layout, split them where you want, and move, resize or remove them. Every chart and tool in Charts is a panel, and one layout holds them all side by side. The layout is saved with your [chartbook](https://docs.chartnaut.com/guides/chartbooks). ## What you can add | Group | Panel | What it is for | |---|---|---| | Charts | **Candlesticks** | A price chart. Change its [chart type](https://docs.chartnaut.com/guides/chart-types) later from its header | | Charts | **Volume Footprint**, **Volume Profile**, **Time Price Opportunity** | A chart that opens with that volume view | | Tools | **Position Manager** | Orders and risk for the account you trade, covered in [Trading from the chart](https://docs.chartnaut.com/guides/trading-from-the-chart) | | Tools | **Watchlist** | The instruments you follow, with price, change and 24-hour volume | | Tools | **Chartnaut Assistant** | An assistant that reads this chart and can add indicators, drawings and notes | | Tools | **Order Book / DOM** | Market depth, as a **Ladder** or **Compact** view. Hyperliquid instruments in real time only | Time & Sales and Heatmap are listed under *Coming Soon* and cannot be added yet. **Send feedback** under *Help* lets you ask for a panel that is missing. ## Add a panel 1. Click **Chart / Panel** in the top toolbar. The *Add chart or panel…* search opens. 2. Type to filter, or pick from the list. The new panel opens to the left of the first chart in the layout. ![Add chart or panel search](https://docs.chartnaut.com/captures/panels-add.png) *The Add chart or panel search with Charts, Tools and Coming Soon.* ## Place a panel next to a chart To choose where a panel lands, start from the chart it should sit beside. 1. Hover the chart's header. The controls on the right fade in. 2. Click **Add Chart**. 3. Pick **Split to Left**, **Split to Right** or **Split to Bottom**. 4. Choose a chart or tool from the search that opens. The chart splits in half, with the new panel on the side you picked. ![Add Chart split menu](https://docs.chartnaut.com/captures/panels-split.png) *A chart header's Add Chart menu with the three split directions.* ## Move, resize and remove - **Move:** drag a panel by its header. On a chart, grab the grip at the left end of the header. Drop it on the edge of another panel to split that panel. - **Resize:** drag the divider between two panels. Only the two panels on either side of the divider change size. - **Remove:** click the bin icon at the right of the panel's header. A layout always keeps at least one chart. Removing the last one shows *Can't close the last chart*: add another chart first, or close a different panel. ## Watchlist Pick or create a list from the name at the top of the panel, where **New watchlist**, **Add instrument** and **New group** live. Switch between **List** and **Collage** views, and choose the columns under *Watchlist settings*. Click an instrument and a chip at the bottom of Charts reads *Open chart* with the symbol: click the chart it should open on, or cancel from the chip. In a [replay](https://docs.chartnaut.com/guides/replay), adding a watchlist asks you to confirm first, because it loads history for every instrument on the list. Tick the box and click **Add watchlist**. ## The Chartnaut Assistant Click **AI** in the top toolbar to open or close the Chartnaut Assistant. It works on the charts in front of you: ask it to add an indicator, change the timeframe or save the layout, and approve each change. For research, such as building a [definition](https://docs.chartnaut.com/guides/how-research-works) or running a study, use **Agent** in the sidebar. [How the agent works](https://docs.chartnaut.com/guides/how-the-agent-works) explains both. ## Limits Your plan sets how many panels open at once, tools included: 4 on Free and 8 on Pro. When the layout is full, *Panel limit reached* gives your plan's number. Close a panel to open another. [Chart limits](https://docs.chartnaut.com/account/chart-limits) has the detail. --- # Chart types URL: https://docs.chartnaut.com/guides/chart-types/ Updated: 2026-11-22T22:28:24Z Every chart type, how to pair a profile with price, and where each type's settings live. Each chart in your layout has its own chart type: how price is drawn. Pick one from the chart type control in the chart's header, beside the timeframe. The type is saved with your [chartbook](https://docs.chartnaut.com/guides/chartbooks). ## Change a chart's type 1. Hover the chart and click the chart type control in its header. 2. Pick a type. The chart redraws straight away. Types that do not suit the instrument are greyed out with *Not supported for this asset class*: CFDs cannot show Volume Bubbles, Volume Footprint or Volume Profile. Hyperliquid instruments, such as BTC and ETH, can show every type. ![Chart type menu](https://docs.chartnaut.com/captures/chart-types-menu.png) *The chart type menu with Standard, Profiles, Others and Coming Soon.* ## The types | Group | Type | What it draws | |---|---|---| | Standard | **Bars** | Open, high, low and close as a bar with ticks | | Standard | **Candles** | The same four prices as candles | | Standard | **Line** | A line through each close | | Standard | **Area** | The close line with the area under it filled | | Profiles | **Volume Bubbles** | Bubbles where large volume traded: net delta, total volume, or buyers and sellers apart | | Profiles | **Volume Footprint** | Buy and sell volume at every price inside each bar, with imbalances highlighted | | Profiles | **Volume Profile** | How much volume traded at each price, with the value area and point of control | | Profiles | **Time Price Opportunity** | How long price spent at each level, with value area, point of control, single prints and initial balance | | Others | **Heikin Ashi** | Candles built from averaged prices, which smooth out the noise in a trend | Renko, Line Break, Kagi, Point & Figure and Range are listed under *Coming Soon* and cannot be picked yet. ## Pair a profile with price Volume Profile, Time Price Opportunity and Volume Bubbles can be drawn on top of a standard type, for example a Volume Profile over Candles. 1. In the chart type menu, hover the profile type. 2. Under **Pair with**, pick **Bars**, **Candles**, **Line** or **Area**. Clicking the profile itself picks it with no pairing. Volume Bubbles always needs a pairing. Volume Footprint draws its own bars and has no pairing. ## Chart type settings Every type has its own settings, such as candle colours or the imbalance ratio a footprint highlights. 1. In the chart's legend in the top-left corner, find the chart type's row. It shows *Candlesticks* for Candles. 2. Click the name, or hover the row and click the gear. 3. Change what you need across the tabs, then click **Save**. If other open charts use the same type, Chartnaut asks whether to apply the change to **Just this chart** or **All charts**. The eye on the same row hides the price series and shows it again. | Type | Settings tabs | |---|---| | Volume Footprint | Calculation, Imbalance, Footprint, Totals | | Volume Profile | Calculation, Profile, Borders, Value Area, POC | | Time Price Opportunity | Calculation, Appearance, Value Area, POC, Single Prints, Initial Balance | | Volume Bubbles | Calculation, Display Options | Volume Profile and Time Price Opportunity reset daily at 00:00 UTC by default. Under **Calculation** you can reset them at the London open (08:00 UTC) or the New York open (13:30 UTC) instead. Volume Profile can also cover the visible range or everything loaded, and Time Price Opportunity can use a custom session. ![Volume Profile settings](https://docs.chartnaut.com/captures/chart-types-settings.png) *Volume Profile settings open on the Calculation tab.* ## Your own chart types A chart type can also be written as a script, the same way as an [indicator](https://docs.chartnaut.com/guides/how-indicators-work). Once you have one, it appears under **Library** at the bottom of the chart type menu. Picking it draws your chart type over hidden candles, and picking a built-in type switches back. [Scripting](https://docs.chartnaut.com/scripting/overview) covers how to write one. --- # Indicators on the chart URL: https://docs.chartnaut.com/guides/indicators-on-the-chart/ Updated: 2026-11-22T22:28:24Z Add an indicator to one chart or several, change its settings, and hide or remove it from the legend. This page covers adding an indicator to your charts, changing its settings, and hiding or removing it. [How indicators work](https://docs.chartnaut.com/guides/how-indicators-work) explains what an indicator is, and [Build a custom indicator](https://docs.chartnaut.com/guides/build-a-custom-indicator) shows how to make your own. ## Ask the assistant The **Chartnaut Assistant** panel adds indicators for you. Click **AI** in the top toolbar and ask, for example, *Add a 20-period EMA and session VWAP to the BTC chart*. It shows each change as a card for you to approve. The same panel changes an indicator's settings or removes it. ## Add an indicator yourself 1. Click **Indicator** in the top toolbar. To add straight to one chart, hover that chart's header and click **Indicator** there instead. 2. Under **Apply to**, pick the charts that should get it. Each chip reads as symbol and timeframe, and **All** picks every chart in the layout. 3. Type in **Search indicators...**, or browse. 4. Click the indicator. It appears on the charts you picked. ![Indicator picker](https://docs.chartnaut.com/captures/indicators-on-the-chart-picker.png) *The indicator picker with Native categories and the Apply to chips.* Where to look in the picker: | Sidebar | What is there | |---|---| | **Native** | Built-in indicators, in Momentum, Trend, Volume, Volatility and Oscillator | | **Mine** | Indicators and [definitions](https://docs.chartnaut.com/guides/definitions-on-the-chart) you have built, marked *Yours* | | **Community** | Ones other traders have shared in the [community library](https://docs.chartnaut.com/guides/community-library) | | **Create your own** | Links to build a new indicator or definition | Each row carries an *Indicator* or *Definition* badge. Picking a definition opens a short wizard first, covered in [Definitions on the chart](https://docs.chartnaut.com/guides/definitions-on-the-chart). **Read more** opens a long description in full. ## Change the settings Every indicator has a row in the chart's legend, in the top-left corner. 1. Click the indicator's name in the legend, or hover its row and click the gear. 2. Change the inputs on the indicator's tabs. Most scripts put theirs under **Parameters**. 3. Click **Save**. The dialog also holds: - **Enable**, a switch at the top that turns the indicator off without removing it. - **Visibility**, where **Hide on Timeframes** hides it on any timeframe from 1 minute to 1 week. - **Version**, on indicators you built, to pick which saved version runs. - **Templates**, at the bottom: **Save as…** keeps these settings as a named preset, and **Apply defaults** puts the indicator's own defaults back. ![Indicator settings](https://docs.chartnaut.com/captures/indicators-on-the-chart-settings.png) *An indicator's settings with the Parameters tab and the Templates menu.* ## Hide or remove Hover the indicator's row in the legend: - The eye hides the indicator and shows it again. - The cross removes it. If the indicator is on more than one chart, choose **Remove from this chart only** or **Remove from all linked charts**. ## Badges and warnings in the legend - **vN** means the indicator is pinned to an older version than the latest. - A number badge means other indicators need this one. Editing its settings makes your own copy, and the legend says *Editing settings will fork into your own copy.* - An icon before the name shows the indicator's state. Hover it to read why: a spinner while it is *still processing*, a warning for a *script error*, or a note when it has *nothing in this view*. ## Limits Your plan caps the indicators on one chart: 5 on Free and 15 on Pro. An indicator that brings others with it counts each one. At the cap, *Indicator limit reached* appears and nothing is added. Remove one to make room. A message reading *Too many timeframes for your plan* means the indicator reads more timeframes than your plan allows. Each plan also sets how many bars back an indicator can remember, listed on [Indicator memory](https://docs.chartnaut.com/account/indicator-memory). [Chart limits](https://docs.chartnaut.com/account/chart-limits) has the full picture. --- # Definitions on the chart URL: https://docs.chartnaut.com/guides/definitions-on-the-chart/ Updated: 2026-11-22T22:28:24Z Add a definition to a chart, choose its profile and events, and read the marks it draws. Add a [definition](https://docs.chartnaut.com/guides/how-research-works) to a chart and it marks every bar where its event happened, such as each break of the first 15-minute range of the New York session on BTC. The marks are worked out live from the bars on the chart, so they appear on any instrument and timeframe you add the definition to, without [running it over history](https://docs.chartnaut.com/guides/run-over-history) first. To build a definition, see [Build a definition](https://docs.chartnaut.com/guides/build-a-definition). When the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) builds one for you, its **Result** card already shows the marks on a chart beside the chat. ## Add a definition 1. Click **Indicator** in the top toolbar, or **Indicator** in a chart's header. 2. Under **Apply to**, pick the charts. 3. Open **Mine** for your own definitions or **Community** for shared ones. Definitions carry a *Definition* badge. Searching finds them too. 4. Click the definition. A short wizard opens, headed with its name and *Add to chart*. 5. Work through the steps, clicking **Continue** on each. 6. On the last step, click **Add to chart**. The wizard uses the definition's latest version. ![Add definition wizard](https://docs.chartnaut.com/captures/definitions-on-the-chart-wizard.png) *The Add to chart wizard on the Select a profile step.* ## The wizard's steps The wizard only shows a step when there is a choice to make, so a simple definition goes straight to the review. | Step | When it appears | What it asks | |---|---|---| | **Requires** | The definition reads values from other indicators | Nothing. It lists the indicators it adds with it and keeps in sync | | **Profile** | The definition has more than one [profile](https://docs.chartnaut.com/guides/versions-and-profiles), or you can make one | *Select a profile*. Default is picked. **New profile with different parameters** makes another | | **Events** | The definition marks more than one kind of event | *Choose which events show*. Turn each on or off, or use **Turn all off** | | **Review** | Always | *Ready to add*: the profile, how many events show, what else comes with it, and the Forward Insights available for this profile | The profile matters beyond the marks: the [Forward Insights](https://docs.chartnaut.com/guides/forward-insights-on-the-chart) you see when you click a mark are the ones made for this profile. Hiding an event in the wizard only changes what is drawn. ## What the marks look like Each event is a thin stem with a small circle and a label, in the event's colour. Marks sit faded until you hover them, when the circle fills. Click a mark and it turns yellow, and a popover opens with what that event is and any Forward Insight for it. ![Definition marks on a chart](https://docs.chartnaut.com/captures/definitions-on-the-chart-marks.png) *A definition's event marks on BTC, one selected with its popover open.* ## Change it later The definition has a row in the chart's legend like any indicator. Click its name, or hover the row and click the gear, to open its settings. - **Events** tab: for each event, **Show on chart**, **Color** and **Show label text**. - **Profile**: switch profile, or **Edit profile**, **New profile** and **Delete profile**. - The other tabs work as on [any indicator](https://docs.chartnaut.com/guides/indicators-on-the-chart). Hide or remove it from the legend row: the eye hides it, the cross removes it. ## Limits A definition counts against the indicators on a chart, along with every indicator it brings with it: 5 on Free and 15 on Pro. [Chart limits](https://docs.chartnaut.com/account/chart-limits) has the detail. --- # Forward Insights on the chart URL: https://docs.chartnaut.com/guides/forward-insights-on-the-chart/ Updated: 2026-11-22T22:28:25Z Make a Forward Insight active on a definition and the latest setup shows its answer by itself. Choosing one, the limit per plan, replays, and what each message means. A [Forward Insight](https://docs.chartnaut.com/guides/forward-insights) shows a study's answer on the chart. Make one active on a definition and the latest setup the definition marks shows the answer by itself, for example *reached the prior day's high 51 times in 61*. Click any mark for the full card. ## Make one active A Forward Insight belongs to one definition, one market and one timeframe. It shows on a chart while it is active on that definition, and then it shows on every chart of its market and timeframe. **Put on chart** saves a new one and makes it active in one go: [Forward Insights](https://docs.chartnaut.com/guides/forward-insights) covers it. To switch to one you already have: - **The insight chip.** On the chart, the definition's row has a chip after its version, such as **◆ London breakout** or **◆ No insight**. Click it and pick an insight. **None** stops it showing. - **The card.** Click any mark, open the insight menu in the card's header and choose **Always show on this definition**. **View for this setup** shows another insight on that one setup only, without changing the active one. The chip's menu lists the insights that fit the row first, with their headline numbers. Ones made with other settings of the definition are under **Needs other settings**. Ones for another market or timeframe are dimmed: picking one asks before it switches the chart. **Find more insights…** opens the picker on its Insights tab. A definition has one active insight per market and timeframe. Choosing another replaces it, and never needs a free place. When you add a definition to a chart, the most recent insight that fits it is chosen for you if you have room. ## What the latest setup shows On the newest setup whose bar has closed, the chart shows: - a label with the insight's headline number, such as *51 in 61*. An insight with no number shows its name. - the outlook drawn ahead of the bar, when the study has one. The chart stays free to pan and zoom. Each setup's outlook is worked out once and kept in your browser, so it comes straight back when you return to the chart. A setup on a bar that is still forming shows *Waits for the bar to close*. Older marks show no label. Click any of them for its card. ![Forward Insight popover](https://docs.chartnaut.com/captures/forward-insights-on-the-chart-popover.png) *A Forward Insight popover open on a BTC opening range break.* ## Read the card - The header names the event, with its date and timeframe. Its insight menu lists the Forward Insights for this definition. **New study** starts another. - *This event* shows how this event scores on the split you chose, such as its distance from VWAP. - *Signal* gives the verdict for events like this one, followed by the numbers and the sample each rests on. - **Learn about this** opens the full *Study results*, with **Open study** to go to the study itself. - **More details** shows the data the definition recorded for this event. ## How many can be active | | Free | Pro | |---|---|---| | Forward Insights active on your charts | 1 | 5 | An active insight counts once, however many charts show it. Your own and ones you added from other people both count. The chip's menu shows how many are in use, such as *2 of 5 in use*. When every place is taken, choosing a new insight asks *Your charts are full (5 of 5). Which one should stop showing?* Pick one, or upgrade. When Pro ends, the insight you made active first keeps showing. The rest stay chosen but show *Paused: over your plan's 1*, and stopping one lets the next resume. An insight whose author removed it or stopped sharing it stays chosen, shows *Removed* or *No longer shared*, and does not count. How many Forward Insights you keep in your library is a separate limit, on [Library limits](https://docs.chartnaut.com/account/library-limits). ## In a replay A study measures history up to the date its data ends, so its numbers already know what happened after every setup before then. In a [replay](https://docs.chartnaut.com/guides/replay), an insight is usable from the date its study's data ends. - Before that date, an active insight is paused, and the picker shows *Usable in this replay from 1 Jan 2025*. Clicking a mark shows no numbers, and the card says why. - Once the replay passes that date, the insight shows by itself again. Live, nothing is hidden. A setup the study measured shows its numbers with an amber **In sample** badge on its label and a note on its card. [In sample and out of sample](https://docs.chartnaut.com/guides/in-sample-and-out-of-sample) explains what that means and why a replay hides the numbers. ## When it shows something else | Message | What it means | What to do | |---|---|---| | *No study pin on this chart yet* | No Forward Insight exists for this definition on this timeframe | **Go to Studies** and put one on the chart | | *Not set up for this profile* | The Forward Insight was made for another profile | Click the button to switch the chart to that profile | | *Can't use this pin on* a timeframe | It was made for a different timeframe | Switch the chart's timeframe, pick another insight, or put a study made on this timeframe on the chart | | *No study insight for this event* | The study does not include events like this one | **Run a study** that tracks this event | | *Need more chart history* | The chart has not loaded enough bars to score this event | Scroll back or wait for more data, then click again | | *This insight can be wrong on live events* | The study groups events using bars from after them, which a live event does not have yet | Click **Update**. [Forward Insights on live events](https://docs.chartnaut.com/guides/forward-insights-on-live-events) explains why | ## Manage your Forward Insights Open the definition under **Tools → Definitions** and go to its **Forward Insights** tab. It shows the ones for this profile and version, or for all versions of the profile, with **Add Forward Insight** to make another and **Archive** to retire one. Archiving one also stops it showing on your charts. --- # Drawing tools URL: https://docs.chartnaut.com/guides/drawing-tools/ Updated: 2026-11-22T22:28:25Z Every drawing tool on the rail, how to edit, lock and clear drawings, and where they are saved. The drawing rail runs down the left edge of Charts. Use it to mark levels, trends and zones on any chart: a line at yesterday's high, a channel, a Fibonacci retracement, a note on a bar. ## Draw on the chart 1. Hover a group on the rail. A card opens with that group's tools. 2. Click a tool. 3. Click on the chart to place each point. Most tools take one or two clicks. When the drawing is placed, the pointer goes back to the cursor. To place several drawings in a row, turn on **Stay in drawing mode** at the bottom of the rail. Each rail button shows the last tool you used from its group, so your usual tool is one click away. Click the star beside any tool, *Add to favorites*, to give it its own button on the rail. ![Drawing rail](https://docs.chartnaut.com/captures/drawing-tools-rail.png) *The drawing rail with the Lines group open.* ## The tools | Group | Tools | |---|---| | Shapes & Brushes | Rectangle, Ellipse, Circle, Triangle, Rotated Rectangle, Arc, Curve, Double Curve, Polyline, Path, arrows, Brush, Highlighter | | Lines | Trend Line, Ray, Extended Line, Trend Angle, Horizontal Line, Horizontal Ray, Vertical Line, Vertical Ray, Cross Line | | Pitchforks | Andrews' Pitchfork, Schiff Pitchfork, Modified Schiff Pitchfork, Inside Pitchfork | | Channels | Parallel Channel, Flat Top/Bottom, Disjoint Channel | | Text | Text, Comment, Callout, Price Label | | Fibonacci | Fib Retracement, Fib Extension, Fib Channel, Fib Speed Fan, Fib Time Zone, Fib Time Extension, Fib Arcs, Fib Circles, Fib Wedge, Fib Spiral, Pitchfan | | Gann | Gann Fan, Gann Box, Gann Square, Gann Square (Fixed) | | Measure | Info Line, Price Range, Date Range, Date & Price Range, Forecast, Projection | | Position | Buy (Long), Sell (Short): an entry, stop and target drawn as a planned trade | | Volume Profile | Basic, Dual, Total and Stacked Volume Profile over the range you draw | A **Layers** group also appears when an indicator on the chart has a layer you can draw by hand. [Scripting](https://docs.chartnaut.com/scripting/overview) explains layers. A Position drawing is a plan on the chart and sends nothing to your broker. To place a real order, see [Trading from the chart](https://docs.chartnaut.com/guides/trading-from-the-chart). ## Edit a drawing Click a drawing to select it. A small toolbar appears beside it with the colour, **Line Width**, **Line Style**, **Settings** and a bin to delete it. Drag its points to reshape it, or drag the body to move it. **Settings** opens the tool's own settings, for example *Trend Line Settings*, with its colour, width and style. Text tools add font size, font family and padding. The style you pick becomes that tool's default for the next drawing. ![Selected drawing toolbar](https://docs.chartnaut.com/captures/drawing-tools-toolbar.png) *A selected trend line with its toolbar showing colour, width, style and settings.* ## Keys | Key | What it does | |---|---| | Backspace | Deletes the selected drawing | | Escape | Abandons a drawing you are part way through placing | | Enter | Finishes a polyline | ## Lock and clear - **Lock drawings**, at the bottom of the rail, stops every drawing from being moved or edited. Picking a new tool turns the lock off. - The **Remove** group clears drawings, indicators, or both, and each option shows how many it will remove. There is no confirmation. ## Where drawings are kept Drawings are saved in this browser, with the instrument, so they come back whenever you chart it again. They are kept apart from [chartbooks](https://docs.chartnaut.com/guides/chartbooks): saving a chartbook does not include them. Because they live in the browser, drawings do not follow you to another browser or device. Signing in to a different Chartnaut account in the same browser clears them. A [replay](https://docs.chartnaut.com/guides/replay) session keeps its own drawings for each instrument, separate from real time. Lines you draw while backtesting stay with that session. --- # Replay URL: https://docs.chartnaut.com/guides/replay/ Updated: 2026-11-22T22:28:25Z Open a backtest session in Charts, control playback from the replay bar, and trade history bar by bar. Replay plays history forward in Charts one bar at a time, so you can trade a past day as if it were happening now. It runs inside a backtest session, which sets the instruments, the dates and the account balance. [How backtesting works](https://docs.chartnaut.com/guides/how-backtesting-works) explains sessions, and [Backtest on random days](https://docs.chartnaut.com/guides/backtest-on-random-days) walks through one. Replaying a single past trade from its page is a different feature, covered in [Snapshots and replay](https://docs.chartnaut.com/guides/snapshots-and-replay). ## Open replay 1. Hover **Charts** in the sidebar. 2. Click **Replay**. Charts opens on the session you are working in. With no session open, **Replay** is greyed out and reads *No session*: [start a session](https://docs.chartnaut.com/guides/start-a-session) first. To go back to the live market, hover **Charts** and click **Real-time**. The session keeps its trades, but **Replay** reads *No session* again until you open a session from **Tools → Backtest**. ![Charts sidebar menu](https://docs.chartnaut.com/captures/replay-sidebar.png) *Hovering Charts in the sidebar shows Replay and Real-time.* ## The replay bar A floating bar controls playback. Drag it by its grip to move it out of the way. From left to right: | Control | What it does | |---|---| | Play / pause | *Play Simulation* runs bars forward on their own. *Pause Simulation* stops them | | Step | *Step Forward One Bar* reveals one more bar | | Timeframe (*TF*) | The size of each step, from the timeframes open on your charts | | Speed | How long each step takes, shown in ms. Slide right for faster | | **Go to** | Jumps ahead to the next **London Session**, **New York Session** or **Tokyo Session** open, or to **Next Week** | Every chart in the layout moves together, whatever its own timeframe. A 1-hour chart builds its current bar as the 5-minute steps come in, the way it would live. ![Replay bar](https://docs.chartnaut.com/captures/replay-bar.png) *The replay bar with play, step, timeframe, speed and Go to.* If an instrument has no data at the time you jump to, a message names the date and the symbol. Click **I understand** to carry on. ## Trade in replay A session has its own simulated account, starting from the balance you set. Place trades from the chart exactly as in real time, described in [Trading from the chart](https://docs.chartnaut.com/guides/trading-from-the-chart). Orders fill against the historical prices as they are revealed. Playback pauses when you open or change a position from the order panel, so you can set your stop and target before the next bar. Real time and replay keep separate layouts and drawings. Changes you make during a session stay with it until you **Save** the [chartbook](https://docs.chartnaut.com/guides/chartbooks), and [drawings](https://docs.chartnaut.com/guides/drawing-tools) you make stay with the session. ## When the session ends When replay reaches the session's end date, *Session Complete* appears: *Your session was set up to end on* that date, and any open positions have been closed. From there: - **Analytics** opens the session's results, covered in [Session reports](https://docs.chartnaut.com/guides/session-reports). - **Start New Session** sets up another one. If the data runs out before the end date, the same panel says the data cut-off has been reached. ## What your plan allows Replay runs on every plan. Your plan sets where a session can start: the last 6 months on Free and any date on Pro. [Plans](https://docs.chartnaut.com/start/plans) lists what each plan includes. --- # Trading from the chart URL: https://docs.chartnaut.com/guides/trading-from-the-chart/ Updated: 2026-11-22T22:28:25Z Pick an account, place a draft from the trade bar or the Position Manager, confirm it on the chart, and manage it. Charts places real orders through a connected [account](https://docs.chartnaut.com/guides/how-accounts-work), and simulated ones in a [replay](https://docs.chartnaut.com/guides/replay) session. Every trade starts as a draft on the chart: nothing reaches your broker until you confirm it. [Connect a broker and place your first trade](https://docs.chartnaut.com/guides/connect-and-place-a-trade) walks through a first one. ## Choose the account Hover **Select Account** in the top toolbar and pick an account. **None** keeps Charts for charting only. Accounts that are still syncing, need a symbol mapped or need review show a badge beside their name. Accounts in error or disabled cannot be picked. **Manage accounts** opens your accounts. In a replay session the account is the session's own simulated one, with the starting balance you set. ## Place a market order from the trade bar The trade bar is the fastest route to a market order, in real time. 1. If the trade bar is hidden, click its icon in the top toolbar. The tooltip reads **Show trade bar**. 2. Check the instrument and set the quantity. 3. Click **Buy** or **Sell**. 4. Under *Log this trade?*, click a [playbook](https://docs.chartnaut.com/guides/how-playbooks-work), tick the criteria that are true right now, and click **Draft**. Or click **Skip Playbook Selection**. The draft appears on the chart at the current price, with no stop or target yet. When the market is closed, **Buy** and **Sell** read *Market closed* with the time it opens. ![Trade bar](https://docs.chartnaut.com/captures/trading-from-the-chart-trade-bar.png) *The trade bar with the instrument, quantity, Buy and Sell.* ## Place any order from the Position Manager The Position Manager handles limit, stop and stop limit orders as well as market ones, and it is the route to use in replay. 1. Right-click the chart and choose **Position Manager → Open as a Panel**. **Open in Floating Panels** floats it over the chart instead. 2. Pick **Buy / Long** or **Sell / Short**, and the order type: **Market**, **Limit**, **Stop** or **Stop Limit**. 3. Set the quantity. For a pending order, type the price or click **Set price on chart** and click the chart. 4. Under *Orders*, add a **Take profit** and a **Stop loss** if you want them now. 5. Click **Add to chart**, then file it under *Log this trade?* as above. ## Confirm the draft A draft shows an entry label with the quantity, order type and side. 1. Drag the arrow handle on the entry label to add a target and a stop. On a long, drag up for the target and down for the stop. On a short, the other way round. 2. Drag either line to adjust it. 3. Click the tick on the entry label to send the order. The label reads *Filling...* until the broker fills it. The cross on a draft's label cancels it. Hovering the draft shows the same choices as a menu: **Manage Position**, **Confirm Trade** and **Cancel Trade**. ![Draft trade on the chart](https://docs.chartnaut.com/captures/trading-from-the-chart-draft.png) *A draft long with target and stop, the tick and cross on its entry label.* ## Manage an open position - Drag the stop or target line to move it. The cross on a stop or target cancels that order. - Hover the position for **Manage Position**, **Close Partial** and **Close Position**. - The cross on an open position's entry label closes the whole position at market straight away, with no confirmation. In the Position Manager, **Partial** closes part of the position and **Close all** closes it at market, also without confirmation. ## When the broker says no If the broker rejects an order, a dialog gives the reason in plain words, such as *The market is closed*, *Not enough free margin* or *The price moved*, with the broker's own message under it. If the broker does not answer in time, there is no telling yet whether the order reached the market: check your positions before you place it again. Every trade you place is saved to [Trades](https://docs.chartnaut.com/guides/trades-library) with [snapshots](https://docs.chartnaut.com/guides/snapshots-and-replay) of your chart, and filed in the playbook you picked. --- # Chart Settings and themes URL: https://docs.chartnaut.com/guides/chart-settings-and-themes/ Updated: 2026-11-22T22:28:25Z Pick a theme and set colours, grid, crosshair, numbers and trade drawing for a chartbook, then save them as a template. Colours, grid, crosshair, number format and how trades are drawn all live in one dialog, **Colors & Settings**. What you set there belongs to the active [chartbook](https://docs.chartnaut.com/guides/chartbooks), so each chartbook can have its own look. ## Open the settings 1. Hover the chartbook name in the top-left corner of Charts. 2. Click **Colors & Settings**. The avatar menu beside it has the same dialog under **Theme Settings**. The dialog is titled with your chartbook's name. Changes show on the charts as you make them. Click **Done** to close it. ![Colors and Settings](https://docs.chartnaut.com/captures/chart-settings-and-themes-dialog.png) *Colors & Settings open on Browse Themes, with the section list on the left.* ## Pick a theme A theme sets the chart and the app's colours in one go. 1. Click **Browse Themes** at the top of the list on the left. 2. Click a theme card, or its **Apply** button. The theme in use reads *Active*. | Style | Themes | |---|---| | Dark | Deep Focus (the default), Obsidian, Graphite, Ember, Vesper | | Vibrant | Emerald | | Edgy | Cyberpunk | | Light | Polaris, Nimbus, Fog, Meadow | | Pastel | Honey, Blush, Lilac, Sky | ## The settings | Section | What it controls | |---|---| | **Appearance** | Dark or light mode, and custom colours for the theme | | **General** | Instrument tabs and how opaque the overlay pills on the chart are | | **Text & Numbers** | Text colour, the number font and weight, and number formatting such as the decimal and thousands separators | | **Grid** | Vertical and horizontal grid lines | | **Crosshair** | The crosshair mode and its lines | | **Panes & Scales** | Pane separators and the borders of the price and time scales | | **Position & Trades** | How positions and orders are drawn: colours, lines, where labels sit, whether labels show always or on hover, and marker size | | **Broker** | Bid and ask markers and the broker's session overlay | **Position & Trades** and **Broker** each have a reset to put their defaults back. ### Crosshair modes | Mode | What it does | |---|---| | Normal | Follows the pointer freely | | Magnet | Snaps to the bar's close | | Magnet OHLC | Snaps to the bar's open, high, low or close | | Hidden | No crosshair | ## Save your settings as a template A template keeps a set of settings to reuse on another chartbook. 1. Set things up the way you want. 2. Click **Templates** at the bottom left of the dialog. 3. Click **Save as…** and name it. Pick a template from the same menu to apply it, or delete it from there. ## Keep the changes Settings are part of the chartbook. Chartnaut keeps your changes in this browser as you go, and they reach the chartbook when you hover its name and click **Save**. Until then, switching chartbook or opening Charts on another device shows the last saved look. Real time and [replay](https://docs.chartnaut.com/guides/replay) keep their changes apart until you save. --- # Market data URL: https://docs.chartnaut.com/guides/market-data/ Updated: 2026-11-22T22:28:25Z Find an instrument, read the Live, Slow and Offline status, and what to do when data stalls or a source goes down. Chartnaut streams prices to your charts in real time and loads their history as you scroll back. This page covers the instruments you can chart, the connection status in the top toolbar, and what happens when a data source goes down. ## Find an instrument Click the symbol in a chart's header to open **Select instrument**. Search by symbol or name, or narrow the list with a chip such as **Crypto**, **Indices**, **Currencies** or **Commodities**. In real time, the list shows instruments that stream live. In a [replay](https://docs.chartnaut.com/guides/replay), an instrument without data for the whole session says so on its row, for example *Data only available from* a date, or *Historical Only*. ![Select instrument](https://docs.chartnaut.com/captures/market-data-select-instrument.png) *Select instrument with the asset class chips and search.* ## The connection status In real time, the top toolbar shows how quickly prices are reaching you, as a figure in milliseconds. | Status | What it means | |---|---| | Live (green) | Prices arrive within 400 ms | | Slow (red) | Prices take longer than 400 ms, or history has stopped loading | | Offline | The market data connection is closed | The figure is the middle reading across your open charts. Hover it for the detail under *Realtime*. While a chart is loading history, a line reads *History loading* with how long it has waited. After 25 seconds without progress it reads *History stalled* and the status turns Slow, even when live prices are fine. Replay sessions play stored history, so the status does not show there. ![Connection status](https://docs.chartnaut.com/captures/market-data-connection.png) *The connection status open, with the feed figure and a History loading line.* ## When a chart looks stuck - *History loading* or *History stalled*: the chart, or an indicator on it, is waiting for older bars. Give it a moment. If it stays stalled, reload the page. - *Connection lost*: the live connection dropped. Your charts and positions are safe, and nothing was sent to your broker while it was down. Click **Reconnect**. If it reads *Too many connection attempts*, wait for the countdown, then reconnect. - An indicator reading *Need more chart history* or showing a status icon in the legend: scroll the chart back so more bars load. [Indicators on the chart](https://docs.chartnaut.com/guides/indicators-on-the-chart) explains the icons. ## When a data source is down If one of Chartnaut's market data sources stops responding, Charts shows *Market data unavailable* and lists the sources affected. It checks again every 5 seconds and takes you back to where you were as soon as data returns. - **Check again** checks straight away. - **Access my accounts** opens a backup page in a new tab, where you can manage your broker accounts and positions while Charts is down. - **View full system status** shows every Chartnaut service. - **Back to dashboard** leaves Charts. ## How far back you can go Your plan sets how much history charts, replay and research can reach. [Historical data](https://docs.chartnaut.com/account/historical-data) lists it by plan. --- # Options levels on the chart URL: https://docs.chartnaut.com/guides/options-levels-on-the-chart/ Updated: 2026-11-22T22:28:26Z Add the Options levels indicator to SP500: the call wall, put wall, gamma flip, absolute gamma strike, expected move and gamma profile, and what each setting does. The **Options levels** indicator draws the prices where the options market is positioned heaviest on your SP500 chart: the call wall, the put wall, the gamma flip, the largest gamma strike and the expected move, plus the gamma at every strike on a profile at the right. Each day's levels come from the previous trading day's options and change once a day, at about 09:50 New York time. How each level is worked out is on [How options levels are calculated](https://docs.chartnaut.com/guides/how-options-levels-are-calculated). It comes with **Options Levels** on Pro. Options levels are rolling out chart by chart: SP500 first, then NAS100, Gold and Bitcoin. On SP500 the levels are built from SPX, SPXW and SPY options. Data Provided by Databento. ## Add it 1. Open an SP500 chart in **Trading → Charts**. 2. Click **Indicator** in the top toolbar and search for *Options levels*. [Indicators on the chart](https://docs.chartnaut.com/guides/indicators-on-the-chart) covers the picker. 3. Click **Options levels**. ![Options levels on SP500](https://docs.chartnaut.com/captures/options-levels-on-the-chart-sp500.png) *SP500 with today's levels, the expected move band and the gamma profile.* ## What you see | On the chart | What it is | |---|---| | **Call wall** (blue) | The strike above the price with the most call gamma | | **Put wall** (rose) | The strike below the price with the most put gamma | | **Gamma flip** (gold) | Where dealers' total gamma turns from negative to positive | | **Largest gamma** (grey) | The strike with the most gamma, calls and puts together | | Faint band | The expected move: the close the levels came from, plus and minus the front expiry's at-the-money straddle. Its size is in the legend | | Bars on earlier days | Each earlier day's levels over the session they were in effect, so you can follow a wall day by day | | Bars on the right | The gamma profile, one bar per strike | Each level is a rounded bar over the session it was in effect, as thick as the gamma at that strike that day compared with the other days on screen: a heavily positioned wall is a thick bar, a thin one a weak wall. The gamma flip has no size of its own and stays a fine line. Today's levels run on past the last candle at full strength, each named in a small tag at its start, such as *CALL WALL 7,748*, with its price on the axis. When two levels sit on the same strike they share one line and one name, such as *CALL WALL · LARGEST GAMMA*. Each earlier day's level runs from the moment it took effect to the moment the next day's did, so levels from Thursday's close run from Friday morning, through the weekend, to Monday morning. The profile is gamma exposure by strike around a centre line, drawn like a volume profile. With **Net gamma**, bars to the right are strikes where calls outweigh puts and bars to the left are strikes where puts do. With **Calls and puts**, call gamma goes right and put gamma left. The call wall and put wall bars are brighter. The profile is for the day at the right of what you are looking at. ## The legend The indicator's row in the legend says which close its levels come from, such as *Options levels 15 Oct close*, and adds *front expiry* when that setting is on. Data Provided by Databento is shown at the bottom right of the chart. It also tells you when something is off: | Legend | Meaning | |---|---| | *Stale: levels from 19 Mar 2026* | A newer day's levels were due by 10:30 New York time and have not arrived. The chart keeps the last day it has | | *Options levels available from 19 Mar 2026* | You are looking at a time before the first levels | | *this chart has no options data* | The chart has no options levels yet. They are rolling out chart by chart, SP500 first | On Free, the indicator says it reads data your plan does not include, and draws nothing. ## Settings Click the indicator's name in the legend to open them. | Setting | What it does | |---|---| | **Options** | **Index and ETF** (SPX, SPXW and SPY), **Index only** (SPX and SPXW) or **ETF only** (SPY) | | **Box positions** | Matching blocks of calls and puts deep in the money are financing trades, not views on the market. **Leave out** (the default) keeps them out of the walls and the profile. **Show separately** draws them as an outline behind each bar and names their strikes in the legend. **Count them** includes them everywhere, the way most published levels do | | **Expiries** | **All expiries**, or **Front expiry** for the call wall, put wall, gamma flip and expected move of the nearest expiry alone. The largest gamma strike has no front-expiry version and is hidden. The profile always covers every expiry | | **Call wall**, **Put wall**, **Gamma flip**, **Largest gamma strike**, **Expected move** | Show or hide each level | | **Labels** | The names on today's levels | | **Previous days** | Earlier days' levels and their prices | | **Gamma regime shading** | A faint tint above today's gamma flip (calls colour) and below it (puts colour). Off by default | | **Show gamma profile** | Show or hide the profile on the right | | **Profile shows** | **Net gamma** or **Calls and puts** | | **Profile width** | How far the profile reaches into the chart, as a share of its width, from 8% to 40% | | **Label the biggest strikes** | The gamma, in dollars per 1% move, beside the three biggest bars. Off by default | | Colours | **Calls**, **Puts**, **Gamma flip**, **Largest gamma strike** and **Expected move** | ![Options levels settings](https://docs.chartnaut.com/captures/options-levels-on-the-chart-settings.png) *The Options levels settings with the Data, Levels, Gamma profile and Colours sections.* With **Front expiry** the legend adds *front expiry*, and the expected move band is the front expiry's. ## In backtests and replay The levels switch at the same moment in a [backtest](https://docs.chartnaut.com/guides/how-backtesting-works) or [replay](https://docs.chartnaut.com/guides/replay) as they did live: a session replayed from the morning of 20 March 2026 shows the 18 March close's levels until 10:00 New York time, when the 19 March close's took effect. Nothing appears before it was known. ## Build on it The levels are data your own scripts can read. [Research with options levels](https://docs.chartnaut.com/guides/research-with-options-levels) has an indicator, a definition and a study to start from, and [Options calendar](https://docs.chartnaut.com/guides/options-calendar) marks the expiration dates that move the levels most. --- # Options calendar URL: https://docs.chartnaut.com/guides/options-calendar/ Updated: 2026-11-22T22:28:26Z Mark monthly options expiration, quad witching, VIX expiration and quarter-end on any chart, with the next 45 days ahead. The **Options calendar** indicator marks the days options positioning turns over: monthly expiration, quad witching, VIX expiration and quarter-end. It works on any chart and every plan, and lists the next 45 days in the space to the right of the last bar. It needs no options data. Add it like any indicator: click **Indicator** in the top toolbar of **Trading → Charts**, search for *Options calendar* and click it. [Indicators on the chart](https://docs.chartnaut.com/guides/indicators-on-the-chart) covers the picker. ![Options calendar on SP500](https://docs.chartnaut.com/captures/options-calendar-sp500.png) *SP500 with OPEX, quad witching, VIX expiration and quarter-end marked.* ## The dates | Mark | When | |---|---| | **OPEX** | Monthly options expiration: the third Friday of the month, or the Thursday before when that Friday is a market holiday | | **Quad witching** | OPEX in March, June, September and December, when index futures and their options expire with the monthly options | | **VIX expiration** | The Wednesday 30 days before the next month's OPEX. When the next OPEX moves to a Thursday, or that Wednesday is a holiday, it moves a day earlier too | | **Quarter-end** | The last trading day of March, June, September and December, when large index collar funds reset their options | Holidays move dates. In 2026, Juneteenth falls on Friday 19 June, so June OPEX and quad witching are on Thursday 18 June and May's VIX expiration is on Tuesday 19 May. Each date is shaded over the New York session, 09:30 to 16:00, with a label at the top of the chart. Zoomed out, where the session is too narrow to see, the shading becomes a dashed line, and where labels would overlap they shorten to *Quad*, *OPEX*, *VIX* and *Q-end*. The legend names the next date after the last bar, such as *Next: OPEX Fri 20 Nov*. ## Settings | Setting | What it does | |---|---| | **Monthly expiration (OPEX)**, **Quad witching**, **VIX expiration**, **Quarter-end** | Show or hide each kind of date. With **Quad witching** off, those days show as **OPEX** | | **Show upcoming (next 45 days)** | Dates after the last bar, in the space to its right | | Colours | One for each kind of date | The holiday calendar runs from 2015 to 2027. Outside those years only weekends are skipped. On SP500, [Options levels on the chart](https://docs.chartnaut.com/guides/options-levels-on-the-chart) shows where the options market is positioned going into each of these dates. --- # How options levels are calculated URL: https://docs.chartnaut.com/guides/how-options-levels-are-calculated/ Updated: 2026-11-22T22:28:26Z The data behind Chartnaut's options levels, when they change, how each level is worked out, the dealer sign assumption and why another vendor's levels can differ. Options levels are the prices where the options market's positioning is heaviest: the call wall, the put wall, the gamma flip and the expected move. Chartnaut works them out each night from the whole US options market, then draws them in the chart's own prices. This page covers the data, when the levels change, how each one is worked out, and why another vendor's numbers can differ. Options levels come with **Options Levels** on Pro. The per-contract data behind them is **Raw Option Chains**, also on Pro. Free has no options data. Data Provided by Databento. ## The data Chartnaut reads OPRA, the feed that carries every US options exchange, through Databento. For each trading day it takes: - every contract listed that day; - each contract's quote at 16:00 New York time, or 13:00 on a half day; - the open interest the exchanges publish the next morning, before the open. Options levels are rolling out chart by chart: S&P 500 charts first, then NAS100, Gold and Bitcoin. On an S&P 500 chart they are built from SPX, SPXW and SPY options. The indicator's legend says from when a chart has levels, and on a chart without them it says so. SPX and SPXW are options on the S&P 500 index itself; SPY is the S&P 500 ETF, a tenth of the index's price. You can read them together or apart: | View | Options | |---|---| | Combined | SPX, SPXW and SPY together | | Index | SPX and SPXW | | ETF | SPY | ## When levels change Levels built from one day's close take effect on the next trading day, as soon as they are computed plus 10 minutes. That is usually about 09:50 New York time. So on Monday the chart switches from Thursday's levels to Friday's at about 09:50, and until then it shows Thursday's. Days filled in from history take effect at 10:00. [Backtests](https://docs.chartnaut.com/guides/how-backtesting-works) and [replay](https://docs.chartnaut.com/guides/replay) switch levels at the same moment a live chart did. A backtest never knows a level before a trader watching live could have seen it. If a night's data arrives late, the previous day's levels stay on the chart until the new ones are ready. ## How the levels are worked out 1. **Clean the quotes.** Crossed, empty and stale quotes are dropped one by one. Moving out from the price, each side of an expiry stops after two strikes in a row with no bid or no quote at all; a crossed quote is skipped without ending it. When most of an expiry's 16:00 quotes are missing and its 16:15 quotes are complete, the whole expiry uses its 16:15 quotes. 2. **Find the forward.** For each expiry, the strike where the call and put prices are closest gives the market's forward price, by put-call parity. Across the near expiries this also gives the index price the options imply at the close. 3. **Solve implied volatility and gamma.** Each contract's mid price gives its implied volatility, using the US Treasury curve for rates. SPX and SPXW can only be exercised at expiry and are priced that way; SPY can be exercised early, and its pricing allows for that. An expiry with no usable quotes near the price takes its volatility from the expiries either side, at the same distance from the price. 4. **Turn gamma into dollars.** A contract's gamma exposure is its gamma × open interest × 100 × price² × 1%: roughly the dollars of the underlying a dealer would trade to stay hedged after a 1% move. Dollars let SPX and SPY add up directly. 5. **Convert to the chart's prices.** Each root's strikes are multiplied by a ratio: the SP500 chart's price at the 16:00 close (its 15:59 one-minute bar's close) divided by that root's price at the close. SP500 tracks the index within a few hundredths of a percent, and SPY strikes scale up by about ten. The levels are chosen on the index's own strikes and only then converted, so two SP500 charts from different exchanges show the same strikes, each at its own price. In the combined view, each SPY strike is shared between the two nearest SPX strikes by distance. 6. **Read off the levels.** | Level | What it is | |---|---| | Call wall | The strike at or above the price with the most call gamma exposure | | Put wall | The strike at or below the price with the most put gamma exposure | | Largest gamma strike | The strike with the most gamma exposure, calls and puts together (`absGammaStrike` in scripts) | | Gamma flip | The price nearest the close where dealers' total gamma turns from negative to positive | | Net gamma exposure | Dealers' total gamma exposure at the close, in dollars per 1% move | | Gross gamma exposure | Call and put gamma exposure added regardless of sign | | Expected move | The price of the front expiry's at-the-money straddle | | Put/call ratio | Put open interest divided by call open interest | | 30-day implied volatility | Worked out the way the VIX is, in percent | The gamma flip comes from re-pricing every contract at prices from 15% below to 15% above the close and finding where the total changes sign. When it crosses more than once, the flip is the upward crossing nearest the close. Every level also comes in a front-expiry version, built from the nearest expiry alone. On SP500 that is usually the expiry that settles in the session the levels are drawn on. The gamma profile is the same exposure strike by strike: call, put and net gamma, and call and put open interest, from 20% below to 20% above the close. It has one row per index strike (per SPY strike in the ETF view), at that strike's price on the chart, so every wall sits on a row of the profile. ## The sign assumption Open interest says how many contracts are open, not who holds them. Chartnaut assumes dealers are long calls and short puts: investors mostly sell calls against their holdings and buy puts for protection, and dealers take the other side. Under that assumption, call gamma counts as positive and put gamma as negative. When the net is positive, dealers hedge by selling rallies and buying dips, which tends to damp moves. When it is negative, they hedge by selling into falls and buying into rises, which tends to extend them. The gamma flip is where one turns into the other. It is an assumption. On a day when investors are buying calls heavily, dealers can be short calls, and the real picture differs from the levels. ## Why another vendor's levels differ Gamma levels depend on choices, and vendors make different ones: - **Sign convention.** Some vendors treat every open contract as dealer short, or classify each trade as a buy or a sell. Each gives a different net gamma and flip. - **Expiries included.** Some use every expiry, some the front month only, and some leave out options expiring today. - **Box and conversion positions.** Large blocks of matching calls and puts deep in the money on one side are financing trades, not views on the market. Chartnaut leaves them out of the walls and the gamma profile; most published levels count them. To see them, set **Box positions** to **Show separately** in the indicator, or **Count them** to read the levels the way most vendors do. On 16 October 2026 the SPX December 8,000 strike held about 315,000 calls and 293,000 puts of this kind; a plain "largest open interest" reading would have made it the call wall, the put wall and the largest gamma strike at once. - **The price used.** The index at 16:00, the index at 16:15, or futures: each moves every level a little. - **Open interest timing.** Chartnaut waits for the open interest published the morning after the close. A vendor that publishes the evening before uses the previous day's. - **Walls by open interest.** Some vendors place walls at the strike with the most contracts open. Chartnaut uses gamma exposure, which weights strikes near the price more. The gamma flip is the most sensitive level: reasonable choices move it by about 1%. ## What the levels cannot tell you - They are fixed for the session. Positions opened during the day, including the day's 0DTE trading, show up the next morning. - They describe positioning. Price can and does trade straight through a wall. - They rest on the sign assumption above. Each set of levels carries the maths version that built it, `eod-v3` today. When the maths changes, the version changes and history is recomputed with it. ## Using the levels in scripts [Indicators](https://docs.chartnaut.com/guides/how-indicators-work), [definitions](https://docs.chartnaut.com/guides/how-research-works) and [studies](https://docs.chartnaut.com/guides/build-and-run-a-study) read the levels through [options.eod.levels](https://docs.chartnaut.com/scripting/options-levels), and on Pro the per-contract chain through [options.eod.contracts](https://docs.chartnaut.com/scripting/options-contracts). [Research with options levels](https://docs.chartnaut.com/guides/research-with-options-levels) has scripts to start from. Which plan reads which data is in [Datasets by plan](https://docs.chartnaut.com/account/datasets-by-plan). Data Provided by Databento. The levels are Chartnaut's own calculation from that data. --- # Research with options levels URL: https://docs.chartnaut.com/guides/research-with-options-levels/ Updated: 2026-11-22T22:28:26Z Use the call wall, put wall and gamma flip in your own indicators, definitions, studies and backtests, with scripts you can paste. Options levels are data your own scripts can read. This page has three scripts to start from on the SP500 chart: an indicator that draws the walls and the gamma flip, a [definition](https://docs.chartnaut.com/guides/how-research-works) that marks every touch of the put wall, and a [study](https://docs.chartnaut.com/guides/build-and-run-a-study) that measures what price did next. How each level is worked out is on [How options levels are calculated](https://docs.chartnaut.com/guides/how-options-levels-are-calculated). Reading the levels needs Pro. Scripts are TypeScript: Pine indicators cannot read options data. ## Ask the Agent The [Agent](https://docs.chartnaut.com/guides/how-the-agent-works) knows the options data and writes these scripts for you. Describe what you want on SP500: - *Draw the call wall, put wall and gamma flip on SP500.* - *Mark every time SP500 trades down to the put wall and closes back above it, then tell me what happened over the next hour.* - *Split SP500's put wall touches by whether price was above or below the gamma flip.* The rest of this page is for writing them yourself. ## Draw the levels Paste this into a new indicator from **Tools → Indicators** (see [Build a custom indicator](https://docs.chartnaut.com/guides/build-a-custom-indicator)) and add it to an SP500 chart. ```js meta({ shortName: "Walls", kind: "overlay" }); dialog({ title: "Options walls" }); const lv = dataset("options.eod.levels", { where: { instrument: { fromInstrument: true }, view: "combined" }, }); output.line({ id: "callWall", color: "#26a69a", name: "Call wall" }); output.line({ id: "putWall", color: "#ef5350", name: "Put wall" }); output.line({ id: "flip", color: "#ffb300", name: "Gamma flip" }); export function onBar(ctx) { const r = lv.last; if (!r) return; if (r.callWall !== undefined) ctx.plot("callWall", r.callWall); if (r.putWall !== undefined) ctx.plot("putWall", r.putWall); if (r.flip !== undefined) ctx.plot("flip", r.flip); } ``` Each line steps to the new day's level at about 09:50 New York time, when that day's levels take effect. Change `view` to `"index"` for SPX and SPXW alone, or `"etf"` for SPY. ## Mark every put wall touch This definition fires once a day, on the first closed bar that opens above the put wall and trades down to it. `rejected` records whether the bar closed back above. ```js meta({ name: "Put wall touch", kind: "flow", slug: "put-wall-touch", shortName: "PutWall" }); const lv = dataset("options.eod.levels", { where: { instrument: { fromInstrument: true }, view: "combined" }, }); events.declare({ id: "put_wall_touch", intent: "signal", payload: { wall: { type: "number", description: "The put wall the bar traded down to, in chart prices" }, close: { type: "number", description: "Close of the bar that touched the put wall" }, rejected: { type: "boolean", description: "True when the bar closed back above the put wall" }, tradeDate: { type: "string", description: "The options close the put wall comes from, YYYY-MM-DD" }, }, oncePer: { keys: ["tradeDate"] }, }); outputs.declare({ id: "put_wall", kind: "line", name: "Put wall", color: "#ef5350" }); export function onBar(ctx) { const r = lv.last; if (!r || r.putWall === undefined) return; ctx.plot("put_wall", r.putWall); if (ctx.barConfirmed === false) return; if (ctx.open > r.putWall && ctx.low <= r.putWall) { ctx.emit( "put_wall_touch", { wall: r.putWall, close: ctx.close, rejected: ctx.close > r.putWall, tradeDate: r.tradeDate }, { label: `Put wall ${r.putWall.toFixed(0)}`, price: r.putWall }, ); } } ``` Build it from **Tools → Definitions** with **Build it yourself** (see [Build a definition](https://docs.chartnaut.com/guides/build-a-definition)), then [run it over history](https://docs.chartnaut.com/guides/run-over-history) on SP500 from 19 March 2026, the first day with levels on the chart. For the call wall, swap `putWall` for `callWall` and flip the comparisons. ## Measure what happened next This study reads the definition's events, splits them by where price stood against the gamma flip when the put wall was touched, and measures the return over the next hour. ```js meta({ name: "Put wall reaction", kind: "study", params: { horizonMin: { type: "number", def: 60, min: 5, max: 1440, step: 5 } }, }); flows.declare({ slug: "put-wall-touch", as: "touch", version: 1 }); const lv = dataset("options.eod.levels", { where: { instrument: { fromInstrument: true }, view: "combined" }, }); dimensions.declare({ id: "regime", title: "Gamma regime", description: "Whether price was above or below the gamma flip when it touched the put wall", values: ["above flip", "below flip"], }); results.declare({ id: "readout__touches", kind: "metric", title: "Touches measured", description: "Put wall touches with a bar at the horizon." }); results.declare({ id: "by_regime", kind: "table", title: "Reaction by regime", description: "Touches, share that bounced and median return over the horizon, above and below the flip.", indexedBy: ["regime"] }); results.declare({ id: "answer", kind: "prose", role: "answer", title: "Answer", description: "How price reacted to the put wall, in one sentence." }); export function scope(ctx) { if (ctx.event.flow !== "touch") return null; const r = lv.asOf(ctx.event.knownAt)?.last; if (!r || r.flip === undefined) return null; return { regime: ctx.event.payload.close > r.flip ? "above flip" : "below flip" }; } export function onEvent(ctx, scope) { const entry = ctx.event.payload.close; const after = ctx.candles.forward({ minutes: ctx.params.horizonMin }); ctx.collect("rows", { regime: scope.regime, bp: after ? ctx.priceUnits.inBP(after.close, entry) : null }); } export function onFinish(ctx) { const rows = ctx.collected("rows").filter((r) => r.bp !== null); const table = ["above flip", "below flip"].map((regime) => { const bps = rows.filter((r) => r.regime === regime).map((r) => r.bp); return { regime, n: bps.length, bounced: bps.length ? bps.filter((b) => b > 0).length / bps.length : 0, medianBp: bps.length ? ctx.stat.median(bps) : 0, }; }); ctx.publish("readout__touches", { value: rows.length, label: "Touches" }); ctx.publish("by_regime", table); const [above, below] = table; ctx.publish("answer", { role: "answer", body: `Above the flip ${Math.round(above.bounced * 100)}% of ${above.n} touches bounced; below it ${Math.round(below.bounced * 100)}% of ${below.n}.`, }); } ``` `lv.asOf(ctx.event.knownAt)` is the options data as it stood when the event fired, so the split uses only levels a trader had at that moment. Open the definition's **Studies** tab, click **New study**, and paste it in. [Read the results](https://docs.chartnaut.com/guides/read-the-results) explains the run card. ## Practise in a backtest Add the indicator to an SP500 chart in a [backtest session](https://docs.chartnaut.com/guides/start-a-session). Levels switch at the same time of day they did live, so you trade each session with the levels that were on the chart that morning, and before 09:50 with the day before's. ## More ideas - Fade the call wall when price is above the gamma flip, and compare with days below it. - Mark closes outside the expected-move band, `spot` plus or minus `expectedMove`, and measure the next day. - Split any definition you already have by the distance to the nearest wall, read in `scope`. - On Pro, build your own levels from the per-contract chain in [options.eod.contracts](https://docs.chartnaut.com/scripting/options-contracts), such as gamma from this week's expiries only. Every field you can read is on [Options levels](https://docs.chartnaut.com/scripting/options-levels). ## Sample size Levels start with the 18 March 2026 close, on the chart from 19 March, so an event that fires at most once a day has at most one event per trading day since then, and a split by regime has fewer in each group. Check the **n** on every row before trusting a percentage. --- # How accounts work URL: https://docs.chartnaut.com/guides/how-accounts-work/ Updated: 2026-11-22T22:28:26Z MetaTrader, cTrader, TradeLocker and Chartnaut Demo accounts, live slots per plan, pausing, symbol mapping, history import and what each status means. An account is where the orders you place in [Charts](https://docs.chartnaut.com/guides/how-charts-works) are filled. Connect one under **Trading → Accounts**, select it in Charts, and every trade you take is recorded in [Trades](https://docs.chartnaut.com/guides/trades-library) and your [Journal](https://docs.chartnaut.com/guides/daily-journal). Accounts is on every plan: Chartnaut Demo is free and unlimited, and live broker accounts come with Pro or a [14-day live trial](https://docs.chartnaut.com/guides/live-trial) on Free. ## Kinds of account | | MetaTrader 4 or 5 | cTrader | TradeLocker | Chartnaut Demo | |---|---|---|---|---| | Money | Your real balance at your broker | Your real balance at your broker | Your real balance at your broker or prop firm | Virtual, starting at the balance you choose | | Connecting | Your login, password and server | Sign in with your cTrader ID, then pick accounts | Your email, password and server, then pick accounts | A label and a starting balance | | Fills | At your broker | At your broker | At your broker | Matched on Chartnaut's servers against live prices | | Live slot | Uses a live slot and a MetaTrader slot while it is switched on | Each account uses a live slot while it is switched on | Each account uses a live slot while it is switched on | Not used, connect as many as you like | | Symbol mapping | Each broker symbol is linked to a Chartnaut instrument | Each broker symbol is linked to a Chartnaut instrument | Each broker symbol is linked to a Chartnaut instrument | Not needed | | Past trades | Import your closed trades when you connect | Import your closed trades when you connect | Import your closed trades when you connect | Nothing to import | Chartnaut Demo is the place to practise a setup or learn the app with nothing at risk. MetaTrader, cTrader and TradeLocker connect accounts you already trade with, so your real trades are journalled without you copying anything across. [Connect MetaTrader](https://docs.chartnaut.com/guides/connect-metatrader), [Connect cTrader](https://docs.chartnaut.com/guides/connect-ctrader), [Connect TradeLocker](https://docs.chartnaut.com/guides/connect-tradelocker) and [Connect Chartnaut Demo](https://docs.chartnaut.com/guides/connect-chartnaut-demo) walk through each, and [Connect a broker and place your first trade](https://docs.chartnaut.com/guides/connect-and-place-a-trade) goes from connecting to a first trade. ## Live slots Each MetaTrader, cTrader or TradeLocker account that is switched on uses a live slot. A MetaTrader account also uses one of a smaller number of MetaTrader slots, because Chartnaut runs a hosted terminal for it that keeps prices and trading live. cTrader and TradeLocker accounts connect through cTrader and TradeLocker directly, so they never use a MetaTrader slot. | Plan | Live accounts at once | Of those, MT4 or MT5 | |---|---|---| | Free | 1 cTrader or TradeLocker account, during the [14-day live trial](https://docs.chartnaut.com/guides/live-trial) | None | | Pro | 6 | 1 | A MetaTrader demo login counts the same as a live one, since it runs on a hosted terminal too. On Pro, [add-ons](https://docs.chartnaut.com/account/add-ons) add more MetaTrader and live slots. Chartnaut Demo accounts do not use slots. On Pro you can link new MetaTrader, cTrader and TradeLocker accounts as often as you like, so the limit is how many are live at the same moment. The top of the Accounts page shows how many live and MetaTrader slots are in use. [Live accounts](https://docs.chartnaut.com/account/live-accounts) has the detail. ![Accounts page](https://docs.chartnaut.com/captures/how-accounts-work-list.png) *The Accounts page with live slot usage above a demo and a MetaTrader account.* ## Pausing an account To free a slot, turn off the switch on the account's row and confirm **Disable**. A disabled account stops quoting and you cannot trade through it, but its trade history and snapshots stay in Chartnaut. The account's **Settings** tab shows it as **Paused**. Turn the switch back on when you need it again. That takes a live slot if one is free, does not count as a new link, and takes a moment while the hosted terminal comes back online. Deleting an account frees its slot and permanently removes the trade history imported from it, including snapshots and playbook tags. It does not close any open positions at your broker. [Manage an account](https://docs.chartnaut.com/guides/manage-an-account) covers renaming, reconnecting and deleting. ## Symbol mapping Brokers name symbols their own way. Your broker might trade BTCUSD where Chartnaut charts Bitcoin, so each broker symbol you trade is linked once to the Chartnaut instrument it matches. That link is how a fill lands on the right chart and in the right reports. You link symbols when you import history, or from the trade bar in Charts the first time you trade a symbol. [Symbol mapping](https://docs.chartnaut.com/guides/symbol-mapping) explains both. ## History import When you connect MetaTrader, cTrader or TradeLocker, **Sync past trades into Chartnaut** brings in your closed trades over the lookback you pick: 90 days, 1 year, 3 years or All. Chartnaut searches your broker's history, asks you to map any symbols it cannot match, shows you what it will import, then imports it. - Closed trades go into your trade library and reports. - Open positions are adopted, so you manage them from Charts like any other trade. - Pending orders are tracked and picked up when they fill. You can run the import again from the account's **Settings** tab with **Re-sync history**, once every 24 hours. [History import](https://docs.chartnaut.com/guides/history-import) has the full walkthrough. ## Statuses The dot beside each account on the Accounts page shows its connection. | Status | What it means | |---|---| | Connected | Live. Prices are streaming and you can trade. | | Pending deployment, Provisioning | The hosted terminal is starting. It is usually live within a minute. | | Error | Chartnaut cannot reach the account. For MetaTrader, **Reconnect** tries again with **Same credentials** or **Different credentials**. For cTrader, **Re-authorize with cTrader** signs you in again. For TradeLocker, **Re-enter your TradeLocker password** logs in again. | | Disabled | Paused by you. Not using a live slot. | | Offline | Not quoting. | A MetaTrader, cTrader or TradeLocker account can also carry an import label: **Syncing…**, **Adopting trades**, **Needs mapping**, **Needs review** or **Import failed**. **Needs mapping** and **Needs review** wait for you; open the account to carry on. ![Account connection settings](https://docs.chartnaut.com/captures/how-accounts-work-connection.png) *An account's Settings tab showing its connection status and switch.* ## Inside an account Click an account to open its own pages: **Dashboard**, **Overview**, **Calendar**, **Trades**, **Adjustments**, **Reports** and **Settings**. They cover that account alone, so you can see how your demo practice compares with your live trading. You can also add your own [views to accounts](https://docs.chartnaut.com/guides/views-on-accounts); [Build your own pages](https://docs.chartnaut.com/guides/build-your-own-pages) explains how. --- # 14-day live trial URL: https://docs.chartnaut.com/guides/live-trial/ Updated: 2026-11-22T22:28:26Z Trade one cTrader or TradeLocker account live on Free for 14 days, once. What happens on day 14, and how to keep the account with Pro. On Free you can trade one real broker account from [Charts](https://docs.chartnaut.com/guides/how-charts-works) for 14 days. The trial covers 1 [cTrader](https://docs.chartnaut.com/guides/connect-ctrader) or [TradeLocker](https://docs.chartnaut.com/guides/connect-tradelocker) account, and each person gets it once. MT4 and MT5 are not part of the trial, because Chartnaut runs a hosted terminal for every MetaTrader account. To trade MetaTrader, you need Pro. [Chartnaut Demo](https://docs.chartnaut.com/guides/connect-chartnaut-demo) needs no trial: it is free and unlimited on every plan. ## Start the trial 1. Open **Trading → Accounts**. 2. Click **Start 14-day trial**. 3. Connect your account as on [Connect cTrader](https://docs.chartnaut.com/guides/connect-ctrader) or [Connect TradeLocker](https://docs.chartnaut.com/guides/connect-tradelocker). Tick one account in the picker. The 14 days start when you start the trial. During them the account works like any other: you place orders from Charts, positions and fills are journalled in [Trades](https://docs.chartnaut.com/guides/trades-library), and **Sync past trades into Chartnaut** imports your history. Connecting a MetaTrader account, or a second cTrader or TradeLocker account, is refused with a message that the trial covers 1 cTrader or TradeLocker account. On day 11 Chartnaut emails you that 3 days are left. ## On day 14 The account disconnects, and Chartnaut emails you to say so. Chartnaut stops syncing it and you can no longer trade it from Charts. Chartnaut does not close your positions or cancel your orders at the broker. Anything still open at the end of the trial stays open there, so close or manage it in cTrader or TradeLocker. The account, its trades and its history stay in Chartnaut. A trial cannot be started a second time, even after it ends. ## Keep the account Buy Pro from **Subscription** in the menu under your name. Bought during the trial, Pro takes over and the account stays connected. Bought after it ends, the account stays disconnected until you turn it back on: open its menu on **Trading → Accounts** and click **Enable account**. Pro has 6 live accounts, up to 1 of them on MT4 or MT5: see [Plans](https://docs.chartnaut.com/start/plans) and [Live accounts](https://docs.chartnaut.com/account/live-accounts). --- # Connect MetaTrader URL: https://docs.chartnaut.com/guides/connect-metatrader/ Updated: 2026-11-22T22:28:26Z Connect an MT4 or MT5 login with its server, import your past trades and fix a failed connection. Connect a MetaTrader 4 or MetaTrader 5 login you already trade with, and Chartnaut can place orders at your broker from [Charts](https://docs.chartnaut.com/guides/how-charts-works) and journal every fill without you copying anything across. Chartnaut runs a hosted terminal for the account, so nothing needs to be open on your own computer. MetaTrader needs Pro, which connects 1 MT4 or MT5 account, demo logins included. Each one uses a live slot and the MetaTrader slot while it is switched on, and a MetaTrader account [add-on](https://docs.chartnaut.com/account/add-ons) adds another. The [14-day live trial](https://docs.chartnaut.com/guides/live-trial) on Free covers cTrader and TradeLocker, not MetaTrader. [How accounts work](https://docs.chartnaut.com/guides/how-accounts-work) explains slots and pausing. ## Before you start Have these to hand from your MetaTrader terminal or your broker's welcome email: - **Login**: your account number, for example 12345678. - **Password**: the trading password. An investor (read-only) password cannot place trades. - **Server**: the exact server name, for example *Broker-MT5Server*. In MetaTrader it is shown when you log in, and under **File → Login to Trade Account**. ## Connect it 1. Open **Trading → Accounts**. 2. Click **Connect account**. 3. On *What do you want to do?*, choose **Connect an existing account**. 4. On *Which platform?*, choose **MetaTrader 4** or **MetaTrader 5**. 5. Type a **Label**, such as "Main" or "Funded". 6. Enter your **Login**, **Password** and **Server**, exactly as MetaTrader shows them. 7. Under *Trade history*, leave **Sync past trades into Chartnaut** ticked to import your closed trades, and pick a **Lookback**: 90 days, 1 year (the default), 3 years or All. 8. Click **Connect**. 9. Stay on the page while it reads *Provisioning your MetaTrader 5 account*. This takes up to a few minutes. 10. When *Account connected* appears, click **Continue**. ![MetaTrader details form](https://docs.chartnaut.com/captures/connect-metatrader-details.png) *The MetaTrader form with credentials, trade history and your live slot count.* Above the **Connect** button, the form tells you how many live accounts your plan includes, how many of them can be MetaTrader, and how many are in use. Chartnaut never stores or shows your password. The account's **Settings** tab shows the login and server only. ## After it connects The account appears on the Accounts page. Its dot turns green when the hosted terminal is live, usually within a minute. If you left the sync ticked, the history import starts straight away and the row shows *Syncing…*. Chartnaut then needs you to link each broker symbol you traded to a Chartnaut instrument, once. Until you do, the row shows *Needs mapping*: click the account and link them. [Symbol mapping](https://docs.chartnaut.com/guides/symbol-mapping) and [History import](https://docs.chartnaut.com/guides/history-import) cover both steps. You can trade from Charts while the import runs. ![Account provisioning](https://docs.chartnaut.com/captures/connect-metatrader-provisioning.png) *Chartnaut provisioning the hosted MetaTrader terminal after Connect.* To trade, open **Trading → Charts**, hover **Select Account** and choose the account. You can also connect a MetaTrader account from there with **New account**. ## When it goes wrong | What you see | What to do | |---|---| | *MetaTrader limit reached* | Every MetaTrader slot on your plan is in use. Connect a [cTrader](https://docs.chartnaut.com/guides/connect-ctrader) or [TradeLocker](https://docs.chartnaut.com/guides/connect-tradelocker) account instead, which uses a live slot only, turn off another MetaTrader account, or on Pro buy a MetaTrader account [add-on](https://docs.chartnaut.com/account/add-ons) | | *Live account limit reached* | All your live slots are in use. Turn off the switch on another account to free one, or on Pro buy an account [add-on](https://docs.chartnaut.com/account/add-ons) | | The account shows *Error* | Chartnaut could not log in or reach the server. Click the account, then **Reconnect**, and choose **Different credentials** to fix a typo in the login, password or server | | *Import failed* | The account still trades. Open it and click **Re-sync**, or come back later | Copy the server name from MetaTrader rather than typing it: it must match character for character. --- # Connect cTrader URL: https://docs.chartnaut.com/guides/connect-ctrader/ Updated: 2026-11-22T22:28:26Z Sign in with your cTrader ID, pick which accounts to trade, import your past trades and re-authorize when access expires. Connect your cTrader accounts and Chartnaut can place orders at your broker from [Charts](https://docs.chartnaut.com/guides/how-charts-works) and journal every fill without you copying anything across. You sign in with your cTrader ID on cTrader's own page, so Chartnaut never sees your cTrader password. Your cTrader ID is the login you use for cTrader itself, not the account number or password your broker sent you. One sign-in can link several accounts. Each cTrader account you link uses one live slot while it is switched on, and never a MetaTrader slot. Pro has 6 live slots. On Free, the [14-day live trial](https://docs.chartnaut.com/guides/live-trial) lets you link 1 cTrader account. [How accounts work](https://docs.chartnaut.com/guides/how-accounts-work) explains slots and pausing. ## Before you start: one cTrader ID cTrader shows Chartnaut only the trading accounts linked to the cTrader ID you sign in with. If your accounts sit under more than one cTrader ID, for example one per broker or prop firm, link them all to your main cTrader ID in cTrader first. Then sign in to Chartnaut once with that ID and pick every account from one list. You can sign in with each cTrader ID separately instead. Each one becomes its own connection in Chartnaut, so when access expires you re-authorize each one, with its own cTrader ID. And if you later move those accounts under one ID, Chartnaut refuses to link them while they are split across two connections, until you delete the accounts on one of them. Deleting removes their imported trades, so link everything to one cTrader ID before you connect. ## Connect it 1. Open **Trading → Accounts**. 2. Click **Connect account**. 3. On *What do you want to do?*, choose **Connect an existing account**. 4. On *Which platform?*, choose **cTrader**. 5. Click **Connect with cTrader**. cTrader opens and asks you to sign in with your cTrader ID. 6. Sign in and grant Chartnaut access. Chartnaut picks up your accounts when you are done. In the desktop app the sign-in opens in your browser, and Chartnaut waits for you to finish there. 7. Tick the accounts you want to trade. They are grouped under *Live* and *Demo*, each with its broker, login, currency and balance. 8. Change the label under a ticked account if you want something you will recognise, such as "Main" or "Funded". 9. Under *Trade history*, leave **Sync past trades into Chartnaut** ticked to import your closed trades, and pick a **Lookback**. 10. Click **Link account**, or **Link 2 accounts** when you ticked more than one. ![cTrader account picker](https://docs.chartnaut.com/captures/connect-ctrader-picker.png) *Live and demo accounts from one cTrader ID, one ticked with its label.* The account list waits 15 minutes for your pick. After that, connect again. Above the button, the picker tells you how many live slots are free. Tick more accounts than you have slots and it asks you to choose fewer, or disable an account first. Each account carries a badge for how it holds positions: *Hedged*, *Netted* or *Spread betting*. Chartnaut trades hedged and netted accounts. It cannot trade spread-betting accounts yet, and refuses to link them. An account marked *Already linked* is connected to Chartnaut already. One marked *Unavailable* is linked to another Chartnaut user and cannot be ticked. ## After it connects The accounts appear on the Accounts page. If you left the sync ticked, the history import starts straight away. Chartnaut then needs you to link each broker symbol you traded to a Chartnaut instrument, once, exactly as with MetaTrader. [Symbol mapping](https://docs.chartnaut.com/guides/symbol-mapping) and [History import](https://docs.chartnaut.com/guides/history-import) cover both steps. To trade, open **Trading → Charts**, hover **Select Account** and choose the account. To add an account you opened later, connect again with the same cTrader ID and tick the new one. It joins the same connection. ## Re-authorize when access ends cTrader access can expire, or you can revoke it from your cTrader ID. The account then shows *Error*, and its page reads *This broker connection failed*. 1. Click the account. 2. Click **Re-authorize with cTrader**. 3. Sign in on cTrader's page with the same cTrader ID you linked, and grant access. Every account from that sign-in reconnects. Re-authorizing replaces the access on the same connection, so your accounts keep their trades, labels and symbol links. **Re-authorize with cTrader** is also on the account's row on the Accounts page and on its **Settings** tab. ## When it goes wrong ### While signing in | What you see | What to do | |---|---| | *This cTrader ID has no trading accounts* | No accounts are linked to that cTrader ID. Link your broker accounts to it in cTrader, or sign in with the cTrader ID that holds them | | *Access wasn't granted in cTrader, so no accounts were linked* | You declined on cTrader's page. Start again and grant access | | *cTrader sign-in wasn't finished in the browser within 5 minutes* | In the desktop app, the browser sign-in timed out. Click **Connect with cTrader** again and finish it in the browser that opens | | *This browser has no record of starting this cTrader sign-in* | You finished in a different browser from the one Chartnaut opened. Start again from Chartnaut and finish in the browser it opens | | *this cTrader sign-in expired* or *the cTrader sign-in expired* | Too long passed between starting and linking. Start again | ### While linking | What you see | What to do | |---|---| | *is a spread-betting account, which Chartnaut cannot trade yet* | Untick that account and link the others | | *could not be read* | cTrader did not return that account's details. Sign in again, or pick another account | | *these cTrader accounts are split across connections* | Some of these accounts are on one Chartnaut connection and some on another, from two cTrader IDs. [Delete the accounts](https://docs.chartnaut.com/guides/manage-an-account) on one connection, then link again. Deleting removes their imported trades | | *these accounts were already linked* | The list was used already. Connect again to link more | | *Live broker account limit reached for your plan* | All your live slots are in use. Turn off the switch on another account to free one, or on Pro buy a cTrader or TradeLocker account [add-on](https://docs.chartnaut.com/account/add-ons). On a [live trial](https://docs.chartnaut.com/guides/live-trial), tick one account only | ### An account is missing from the list The list shows every account linked to the cTrader ID you signed in with, live and demo, across brokers. If one is missing, it is linked to a different cTrader ID. Link it to your main cTrader ID in cTrader, then connect again with that ID. An account greyed out as *Unavailable* is linked to another Chartnaut user. They need to remove it from their Chartnaut first. ### After it is connected | What you see | What to do | |---|---| | The account shows *Error* | cTrader access expired or was revoked. Click the account, then **Re-authorize with cTrader**, as above | | *that cTrader ID cannot see the accounts on this connection* | You re-authorized with a different cTrader ID. Sign in again with the cTrader ID you linked these accounts with | | An order or stop change is refused near 21:00 UTC | Most brokers pause FX for a few minutes around then. Chartnaut shows the broker's refusal and nothing is executed. Try again once the market reopens | --- # Connect TradeLocker URL: https://docs.chartnaut.com/guides/connect-tradelocker/ Updated: 2026-11-22T22:28:27Z Log in with your TradeLocker email, password and server, pick which accounts to trade, and fix a login that stopped working. Connect your TradeLocker accounts and Chartnaut can place orders at your broker or prop firm from [Charts](https://docs.chartnaut.com/guides/how-charts-works) and journal every fill without you copying anything across. You log in with the same email, password and server you use in TradeLocker, the way you would with [MetaTrader](https://docs.chartnaut.com/guides/connect-metatrader). One TradeLocker login often holds several accounts, for example a challenge and a funded account at the same firm. You log in once and pick which ones to link. Each linked account uses one live slot while it is switched on, and never a MetaTrader slot. Pro has 6 live slots. On Free, the [14-day live trial](https://docs.chartnaut.com/guides/live-trial) lets you link 1 TradeLocker account. [How accounts work](https://docs.chartnaut.com/guides/how-accounts-work) explains slots and pausing. ## Before you start Have these to hand: - **Email** and **Password**: the ones you log in to TradeLocker with. - **Server**: the server name in your TradeLocker login email from your broker or prop firm, for example ATLAS or HEROFX. You don't need to know whether your accounts are Demo or Live. Chartnaut looks on both and lists every account it finds, each marked **Demo** or **Live**. A prop-firm challenge is usually on Demo. If you sign in to TradeLocker with Google, you have no TradeLocker password yet. Set one first: on TradeLocker's login page, use **Forgot password** with the same email. ## Connect it 1. Open **Trading → Accounts**. 2. Click **Connect account**. 3. On *What do you want to do?*, choose **Connect an existing account**. 4. On *Which platform?*, choose **TradeLocker**. 5. Enter your **Email**, **Password** and **Server**. 6. Click **Log in to TradeLocker**. 7. Tick the accounts you want to trade. Each shows its name, status, account number, currency, balance and whether it is **Demo** or **Live**. 8. Change the label under a ticked account if you want something you will recognise, such as "Challenge" or "Funded". 9. Under *Trade history*, leave **Sync past trades into Chartnaut** ticked to import your closed trades, and pick a **Lookback**. 10. Click **Link account**, or **Link 2 accounts** when you ticked more than one. To look on one environment only, open **Advanced** before you log in and choose **Demo** or **Live** instead of **Auto-detect**. ![TradeLocker login form](https://docs.chartnaut.com/captures/connect-tradelocker-login.png) *The TradeLocker login with email, password, server and environment.* The account list waits 15 minutes for your pick. After that, log in again. Above the button, the picker tells you how many live slots are free. Tick more accounts than you have slots and it asks you to choose fewer, or disable an account first. ![TradeLocker account picker](https://docs.chartnaut.com/captures/connect-tradelocker-picker.png) *Two accounts from one TradeLocker login, one ticked with its label.* An account marked *Already linked* is connected to Chartnaut already. One marked *Unavailable* is linked to another Chartnaut user and cannot be ticked. Chartnaut keeps your TradeLocker login encrypted so it can stay signed in for you. It never shows your password, on the account's **Settings** tab or anywhere else. ## After it connects The accounts appear on the Accounts page. If you left the sync ticked, the history import starts straight away. Chartnaut then needs you to link each broker symbol you traded to a Chartnaut instrument, once, exactly as with MetaTrader. [Symbol mapping](https://docs.chartnaut.com/guides/symbol-mapping) and [History import](https://docs.chartnaut.com/guides/history-import) cover both steps. To trade, open **Trading → Charts**, hover **Select Account** and choose the account. ## How TradeLocker accounts differ **Partial close follows your account.** TradeLocker tells Chartnaut, account by account, whether you can close part of a position. Where your broker allows it, **Close partial** is on the position. Where it does not, Chartnaut leaves it out. **Commission is a daily total.** TradeLocker does not report commission or swap on each trade, so your trades in Chartnaut carry none. The account summary in Charts shows commission as **Fees today**, the total for the day so far. **Prop-firm rules are yours to follow.** Chartnaut does not check your firm's rules, such as a minimum time to hold a trade, a daily loss limit or news restrictions. An order Chartnaut sends counts against your account exactly as one from TradeLocker would. **The daily pause refuses orders.** Most brokers pause FX for a few minutes around 21:00 UTC each day. During the pause your broker refuses new orders and changes to stops and targets, and Chartnaut shows its refusal with the broker's own message. Nothing is executed. Try again once the market reopens. ## When it goes wrong ### While logging in | What you see | What to do | |---|---| | *We couldn't find that server* | The server name does not match. Copy it from your broker's or prop firm's email, for example ATLAS | | *TradeLocker didn't accept that email and password* | Check both in TradeLocker's own login. If you use Google to sign in, set a TradeLocker password first | | *You're logged in, but there are no TradeLocker accounts on demo or live* | Your login works but has no accounts yet. Check in TradeLocker that the account exists and is active | | *You're logged in, but there are no accounts on the demo environment* | You chose one environment under **Advanced** and your accounts are on the other. Choose **Auto-detect** and log in again | | *TradeLocker isn't responding right now* | TradeLocker is down or busy. Try again in a minute | | *This TradeLocker sign-in expired* | More than 15 minutes passed before you linked. Log in again to choose your accounts | | *Live broker account limit reached for your plan* | All your live slots are in use. Turn off the switch on another account to free one, or on Pro buy a cTrader or TradeLocker account [add-on](https://docs.chartnaut.com/account/add-ons). On a [live trial](https://docs.chartnaut.com/guides/live-trial), tick one account only | ### An account is missing from the list The list shows every account on Demo and Live for the login you used (or only one of them, if you chose it under **Advanced**). If one is missing, it is under a different TradeLocker email or server. Log in again with that one. An account greyed out as *Unavailable* is linked to another Chartnaut user. They need to remove it from their Chartnaut first. ### After it is connected | What you see | What to do | |---|---| | The account shows *Error* and *Re-enter your TradeLocker password* | TradeLocker stopped accepting the saved login, usually because you changed your password. Click **Re-enter your TradeLocker password**, type the new one and click **Log in again**. Every account from that login reconnects | | *TradeLocker didn't accept that password* | Check it in TradeLocker's own login, then try again | | An order or stop change is refused near 21:00 UTC | The daily pause. Wait a few minutes and try again | | **Close partial** is missing | Your broker does not allow partial closes on this account | | No commission on your trades | TradeLocker reports commission as a day total. Look for **Fees today** in Charts | The email, server and environment stay as you linked them when you re-enter the password, so your accounts keep their trades, labels and symbol links. --- # Connect Chartnaut Demo URL: https://docs.chartnaut.com/guides/connect-chartnaut-demo/ Updated: 2026-11-22T22:28:27Z Open a virtual-money account that trades live prices, with the label, leverage and starting balance you choose. Chartnaut Demo is an account with virtual money that trades against live prices. Orders are matched on Chartnaut's servers the same way a broker would fill them, so you can practise a setup, try out [trading from the chart](https://docs.chartnaut.com/guides/trading-from-the-chart) or learn the journal with nothing at risk. It is free on every plan, Free included, and does not use a live slot, so you can open as many as you like: one per strategy, or one per prop firm challenge you are rehearsing. [How accounts work](https://docs.chartnaut.com/guides/how-accounts-work) compares it with MetaTrader. ## Connect it 1. Open **Trading → Accounts**. 2. Click **Connect account**. 3. On *What do you want to do?*, choose **Use Chartnaut demo**. 4. Type a **Label**, for example "BTC practice". This is the name you pick the account by in Charts. 5. Choose **Leverage**. The default is 50x. 6. Set **Starting balance**. The default is 100,000. 7. Click **Connect**. 8. When *Account connected* appears, click **Continue**. ![Demo account form](https://docs.chartnaut.com/captures/connect-chartnaut-demo-form.png) *The demo form with label, currency, leverage and starting balance.* The account appears on the Accounts page with a green dot, ready to trade. The form confirms underneath that *Chartnaut Demo is free* and does not count towards your plan's account limits. You can also connect one without leaving Charts: hover **Select Account** in the top toolbar and click **New account** (**Add account** if you have none yet). ## The options | Option | What it sets | Choices | |---|---|---| | **Label** | The account's name everywhere in Chartnaut | Any text. Rename it later from the account's page | | **Currency** | The account currency | USD. Other currencies are listed as *Coming soon* | | **Leverage** | How much margin a position needs | 1x, 5x, 10x, 20x, 50x, 100x, 200x or 500x | | **Starting balance** | The virtual cash you start with | Any amount | After connecting, only the label can be changed. To practise with a different size or leverage, connect a second demo account and give it its own label. ## Trade with it 1. Open **Trading → Charts**. 2. Hover **Select Account** and choose the demo account under **Accounts**. 3. Place a trade from the trade bar or the chart. [Connect a broker and place your first trade](https://docs.chartnaut.com/guides/connect-and-place-a-trade) walks through the first one. Every demo trade is recorded as a **Live** trade in [Trades](https://docs.chartnaut.com/guides/trades-library) and your [Journal](https://docs.chartnaut.com/guides/daily-journal), with snapshots and its P&L path, exactly like a trade at a broker. Click the account on the Accounts page to see its own dashboard, calendar and reports. [Manage an account](https://docs.chartnaut.com/guides/manage-an-account) covers those pages. ![Demo account in the list](https://docs.chartnaut.com/captures/connect-chartnaut-demo-list.png) *A new demo account on the Accounts page, connected.* ## When it goes wrong - *Account label is required* or *Enter a valid starting balance*. Give the account a label, and a starting balance above zero. --- # Symbol mapping URL: https://docs.chartnaut.com/guides/symbol-mapping/ Updated: 2026-11-22T22:28:27Z Link your broker's symbols to Chartnaut instruments during an import, from the trade bar, or on an unmapped trade. Your broker names its symbols its own way. It might trade BTCUSD, EURUSD.pro or XAUUSD.r where Chartnaut charts BTC, EURUSD and GOLD. Symbol mapping links each broker symbol on a [MetaTrader](https://docs.chartnaut.com/guides/connect-metatrader), [cTrader](https://docs.chartnaut.com/guides/connect-ctrader) or [TradeLocker](https://docs.chartnaut.com/guides/connect-tradelocker) account to the Chartnaut instrument it matches, once. That link is how an order from the chart reaches the right symbol at your broker, and how every fill lands on the right chart, in the right [trade](https://docs.chartnaut.com/guides/trade-detail) and in the right reports. [Chartnaut Demo](https://docs.chartnaut.com/guides/connect-chartnaut-demo) accounts trade Chartnaut's instruments directly and need no mapping. Chartnaut never guesses a link. Every one is a choice you make, so a wrong match cannot slip into your stats unnoticed. ## During a history import The first [history import](https://docs.chartnaut.com/guides/history-import) lists every symbol you traded in the lookback. The account shows *Needs mapping* on the Accounts page until you link them. 1. Open **Trading → Accounts** and click the account. 2. Under *Map broker symbols*, find the first row. It shows the broker symbol, how many closed deals it has, and *open now* if you hold a position on it. 3. Click **Choose instrument** and pick the matching Chartnaut instrument. Type to search. 4. For a symbol you do not want imported, click the circle at the end of its row to skip it. 5. Repeat until the counter under the list reads every symbol resolved. 6. Click **Continue import**. ![Map broker symbols](https://docs.chartnaut.com/captures/symbol-mapping-import-table.png) *The Map broker symbols list, with two symbols linked and one skipped.* Trades on a skipped symbol stay out of Chartnaut. If a skipped symbol has an open position, Chartnaut warns you that it will not track that position while it is open. You can import it as a closed trade after it closes, with a re-sync. ## From the trade bar in Charts The first time you trade a broker symbol that is not linked yet, the trade bar shows *Map symbol to continue* and you cannot set entry, stop loss or take profit until it is. 1. Click **Map symbol**. 2. In the *Link symbol* dialog, pick the instrument. Instruments with a chart open are listed first, under *Open charts*, then *All assets*. 3. Click **Link symbol** to confirm. Instead of searching, the button under the list lets you click one of the charts on screen. **Not now** closes the dialog without linking. ![Link symbol dialog](https://docs.chartnaut.com/captures/symbol-mapping-link-dialog.png) *The Link symbol dialog, with open charts listed above all assets.* ## Change a link On a chart traded through a MetaTrader, cTrader or TradeLocker account, the broker symbol is shown beside the chart's instrument, or **Map** if it has none. Click it to open *Change symbol link*, which shows the current link under *Currently mapped*, and pick a different instrument. ## Fix an unmapped trade A trade on a symbol that was never linked carries an *Unmapped* badge in [Trades](https://docs.chartnaut.com/guides/trades-library). Its P&L still counts in your stats, but it has no P&L path and no per-instrument breakdown until it has an instrument. 1. Open the trade. 2. In the notice above its tabs, click **Map** followed by the symbol, for example **Map XAUUSD.r**. 3. Pick the instrument. The link applies to the whole account, so every unmapped trade on that symbol is updated at once. To find them, turn on the **Unmapped only** filter in Trades or on the account's own pages. --- # History import URL: https://docs.chartnaut.com/guides/history-import/ Updated: 2026-11-22T22:28:27Z Bring a MetaTrader, cTrader or TradeLocker account's closed trades, open positions and pending orders into Chartnaut, and re-sync later. History import brings the trades you already took on a [MetaTrader](https://docs.chartnaut.com/guides/connect-metatrader), [cTrader](https://docs.chartnaut.com/guides/connect-ctrader) or [TradeLocker](https://docs.chartnaut.com/guides/connect-tradelocker) account into Chartnaut, so your [journal](https://docs.chartnaut.com/guides/daily-journal) and reports start with your real record instead of an empty page. It reads your broker's history, asks you to link any symbols, shows you what it will write, and writes nothing until you agree. [Chartnaut Demo](https://docs.chartnaut.com/guides/connect-chartnaut-demo) accounts have no outside history, so there is nothing to import. ## What comes in | At your broker | In Chartnaut | |---|---| | Closed trades in the lookback | *Imported* trades in [Trades](https://docs.chartnaut.com/guides/trades-library), the journal and the account's reports | | Positions open right now | *Adopted* trades, which you manage from [Charts](https://docs.chartnaut.com/guides/trading-from-the-chart) like any other and which are journalled when they close | | Pending orders | Tracked, and picked up as trades when they fill | Imported trades have their fills and P&L, but no [snapshots](https://docs.chartnaut.com/guides/snapshots-and-replay): Chartnaut was not watching your chart when you took them. ## Run the first import The import starts when you connect with **Sync past trades into Chartnaut** ticked, over the **Lookback** you chose: 90 days, 1 year, 3 years or All. 1. Open **Trading → Accounts**. The account shows *Syncing…* while Chartnaut searches your broker's history. You do not need to stay on the page. 2. When it shows *Needs mapping*, click the account and link each broker symbol to a Chartnaut instrument, or skip it. [Symbol mapping](https://docs.chartnaut.com/guides/symbol-mapping) walks through the list. 3. Click **Continue import**. 4. Chartnaut re-checks your broker, then shows *Ready to import*: how many closed trades it will import, open positions it will adopt, pending orders it will track and symbols you skipped. 5. Click **Import and adopt**. ![Ready to import](https://docs.chartnaut.com/captures/history-import-ready.png) *The Ready to import summary before anything is written.* The account shows *Adopting trades* while it brings in your open positions, then the account's pages open as normal. While the import runs, the account's reports stay locked, but you can trade with it from Charts. If your account kept trading while you were mapping, Chartnaut stops re-checking after a few rounds and skips any symbols still unmapped. The summary says so. Re-sync later to pick them up. ## Run it again Re-sync picks up trades that closed since the last import, or reaches further back with a longer lookback. 1. Open the account and click the **Settings** tab. 2. Under *Trade history*, choose a **Lookback**. 3. Click **Re-sync history**. ![Trade history on the Settings tab](https://docs.chartnaut.com/captures/history-import-resync.png) *The Trade history section with its Lookback menu and Re-sync history.* You can re-sync once every 24 hours. If you have traded a symbol that is not linked yet, the account asks you to map it before the re-sync imports anything. ## When it goes wrong If the account shows *Import failed*, open it. The page reads *Could not import closed trade history*, with the reason below it and the broker's own message under *What went wrong*. - *This account isn't fully connected yet*, or *We couldn't reach the broker history for this account*: reconnect the account first. [Manage an account](https://docs.chartnaut.com/guides/manage-an-account) covers **Reconnect**. Then click **Re-sync**. - Anything else: click **Re-sync**. If it fails again, click **Copy** beside the request ID and send it to [Support](https://docs.chartnaut.com/account/support). If **Re-sync** is greyed out, the page shows when it becomes available again. --- # Manage an account URL: https://docs.chartnaut.com/guides/manage-an-account/ Updated: 2026-11-22T22:28:27Z An account's own tabs and reports, and how to rename, pause, reconnect or delete it. Every connected account has its own pages: its results, its reports and its connection settings. Click an account on **Trading → Accounts** to open them. [How accounts work](https://docs.chartnaut.com/guides/how-accounts-work) explains the two kinds of account and what each status dot means. ## The account's pages | Tab | What it shows | |---|---| | **Dashboard** | Realised P&L, win rate and equity over time, P&L by day of week and time of day, and your top symbols | | **Overview** | Month by month results, with your best month, worst month and average monthly P&L | | **Calendar** | P&L day by day, month by month | | **Trades** | Every trade on the account. Click one to open its [detail](https://docs.chartnaut.com/guides/trade-detail) | | **Adjustments** | Deposits, credits and commission adjustments, with the time, type, amount and comment of each | | **Reports** | Daily Analysis, Monthly Analysis, Trade Timing, Instruments, Volatility, Correlations, Wins vs Losses, Benchmarks, Risk & Reward and Drawdown | | **Settings** | The connection, the account's details, trade history and delete | The filter button at the top narrows every tab by closed date, playbook, symbol, tag, side, outcome or your own properties. **Unmapped only** finds MetaTrader, cTrader and TradeLocker trades on a symbol you have not linked yet; [Symbol mapping](https://docs.chartnaut.com/guides/symbol-mapping) shows how to fix them. The button beside the filters opens Charts with this account selected. You can also add your own tabs here. See [Views on accounts](https://docs.chartnaut.com/guides/views-on-accounts). ![Account pages](https://docs.chartnaut.com/captures/manage-an-account-tabs.png) *An account's Dashboard tab, with the tab strip and filters above it.* ## Rename it 1. Hover the account name at the top of its page and click the pencil, **Edit account label**. 2. Type the new name and press Enter. On the Accounts page, the **…** menu on the row has **Edit label** as well. The login, server, leverage and starting balance cannot be changed. ## Pause and resume A paused MetaTrader, cTrader or TradeLocker account frees its live slot and keeps all its trades and snapshots. 1. On **Trading → Accounts**, turn off the switch on the account's row. The same switch is under *Connection* on the **Settings** tab. 2. Click **Disable** in *Disable Account*. To resume, turn the switch back on. The account is live again in about a minute, if a slot is free. ## Reconnect after an error An account shows *Error* when Chartnaut cannot reach it, for example after you change the password at your broker. Its switch is locked until it reconnects. 1. Open the account. The page reads *This broker connection failed*. 2. Click **Reconnect**. 3. Choose **Same credentials** to retry, or **Different credentials** to enter a new login, password or server. 4. For new credentials, fill in the fields and click **Save & reconnect**. A cTrader account shows **Re-authorize with cTrader** instead, and a TradeLocker account **Re-enter your TradeLocker password**. [Connect cTrader](https://docs.chartnaut.com/guides/connect-ctrader) and [Connect TradeLocker](https://docs.chartnaut.com/guides/connect-tradelocker) walk through both. ![Reconnect menu](https://docs.chartnaut.com/captures/manage-an-account-reconnect.png) *The Reconnect menu on an account in error.* ## The Settings tab - *Connection* shows the hosted terminal's state: *Live*, *Deploying*, *Paused*, *Unreachable* or *Offline*, with the switch beside it. - *Details* lists the label, broker, environment, login, server, leverage, currency, balance, credit and equity. Your password is never shown. - *Trade history* re-imports closed trades on a MetaTrader, cTrader or TradeLocker account, once every 24 hours. See [History import](https://docs.chartnaut.com/guides/history-import). ## Delete an account Deleting permanently removes the account and every trade imported from it, including snapshots, chart images and playbook tags. Connecting the same login again later does not bring them back. Pause the account instead if you might want its history. 1. Open the account and click the **Settings** tab. 2. Under *Danger zone*, click **Delete account**. 3. Click **Delete** to confirm. Deleting frees the account's live slot. It does not close open positions at your broker. --- # How your trades are recorded URL: https://docs.chartnaut.com/guides/how-your-trades-are-recorded/ Updated: 2026-11-22T22:28:27Z Where trades come from, what Chartnaut saves with each one, and how the dashboard, journal and trades library fit together. Chartnaut saves every trade you take, wherever you took it, with its fills, chart snapshots and the path its P&L took while it was open. You add the rest: notes, a playbook, tags and your own properties. This page covers where trades come from, what each one holds, and the three places you read them. ## Where trades come from Each trade carries an origin, which you can filter by in [Trades](https://docs.chartnaut.com/guides/trades-library). | Origin | Where it came from | |---|---| | **Live** | Placed through a connected account: [MetaTrader](https://docs.chartnaut.com/guides/connect-metatrader), [cTrader](https://docs.chartnaut.com/guides/connect-ctrader) or [Chartnaut Demo](https://docs.chartnaut.com/guides/connect-chartnaut-demo) | | **Imported** | Closed trade history brought in from a broker account. See [History import](https://docs.chartnaut.com/guides/history-import) | | **Adopted** | A position that was already open at your broker when you connected. Chartnaut tracks it until it closes | | **Backtest** | Traded in a [backtest session](https://docs.chartnaut.com/guides/how-backtesting-works) on past market data | | **Hindsight** | Logged on the chart after the fact, with entry and exit marked on historical bars | ## What is saved with each trade Open any trade and you see its [detail](https://docs.chartnaut.com/guides/trade-detail): - **Fills.** Every execution, average fill price and commission, on the **Details** tab. - **Snapshots.** Images of your chart at open and at close, which you can also step through as an interactive replay. Chartnaut takes a snapshot only while it is open, so a trade that closes while Chartnaut is shut has no close snapshot. Imported trades have none. See [Snapshots and replay](https://docs.chartnaut.com/guides/snapshots-and-replay). - **P&L path.** A chart of the trade's open profit and loss from entry to exit, beside its details. - **MAE and MFE.** How far the trade went against you and how far it went in your favour while it was open, in money and in R. - **Notes.** Free text, or a note template you load and fill in. See [Notes, tags and templates](https://docs.chartnaut.com/guides/notes-tags-and-templates). - **Playbook and tags.** Which [playbook](https://docs.chartnaut.com/guides/how-playbooks-work) the trade belongs to, and which of its tags were true. - **Properties.** Fields you define yourself with **Add property**, such as a grade or a mistake. ![Trade detail Overview tab](https://docs.chartnaut.com/captures/how-your-trades-are-recorded-trade-detail.png) *A closed trade's Overview tab: details, P&L path, notes and snapshots.* ## Three places to read your trades | Place | Open it from | What it is for | |---|---|---| | [Dashboard](https://docs.chartnaut.com/guides/dashboard) | **Trading → Dashboard** | The headline numbers over 7 days to all time: trades logged, win rate, practice time, streak, and a calendar per account | | [Journal](https://docs.chartnaut.com/guides/daily-journal) | **Trading → Journal** | One page per trading day: the day's P&L, trades, win rate and symbols, beside your own notes | | [Trades](https://docs.chartnaut.com/guides/trades-library) | **Trading → Trades** | Every trade from every source, filtered by playbook, account, session, origin, outcome, properties or date | The journal records the days you traded a live market, so it lists **Live**, **Imported** and **Adopted** trades. Backtest trades stay in Trades and in their session's reports. In a journal note, type `@` to reference a trade, playbook or study. ![Journal day page](https://docs.chartnaut.com/captures/how-your-trades-are-recorded-journal-day.png) *A journal day with its stats, note and the month calendar.* ## Search, collections and sharing The box in Trades takes a question in plain words, such as "my losing BTC trades that opened before 10:00", and finds the trades that match. See [AI trade search](https://docs.chartnaut.com/guides/ai-trade-search). A set of results you want to keep can be pinned as a collection and opened again later. See [Pinned collections](https://docs.chartnaut.com/guides/pinned-collections). **Share** on a trade saves it **As image**, as a styled card, or **As video**, which replays the trade on its chart. See [Sharing a trade](https://docs.chartnaut.com/guides/sharing-a-trade). ## Your own views You can add your own views to every trade, journal day, backtest session and playbook: a tab that shows exactly what you want to see about it. See [Build your own pages](https://docs.chartnaut.com/guides/build-your-own-pages), [Views on trades](https://docs.chartnaut.com/guides/views-on-trades) and [Views on journal days](https://docs.chartnaut.com/guides/views-on-journal-days). --- # Dashboard URL: https://docs.chartnaut.com/guides/dashboard/ Updated: 2026-11-22T22:28:28Z The page Chartnaut opens on: your stats for a period, a calendar per account, and dashboards of your own apps. The dashboard is the page Chartnaut opens on. It answers three questions at a glance: how much you have traded lately, how it went, and how each account is doing this month. Open it any time from **Trading → Dashboard**. For one trading day with your notes, open the [Journal](https://docs.chartnaut.com/guides/daily-journal); for every trade with filters, open [Trades](https://docs.chartnaut.com/guides/trades-library). ![Dashboard](https://docs.chartnaut.com/captures/dashboard-overview.png) *The dashboard: the greeting, period stats and an account's calendar.* ## Your numbers for a period Pick the window above the stats: **7 days**, **30 days**, **90 days**, **1 year** or **All**. Every figure below it updates, and most show the change against the previous window of the same length. | Stat | What it counts | |---|---| | *Trades logged* | Closed trades in the period, with a small chart of how they were spread across it | | *Win rate* | The share of closed trades that finished in profit. Break-even trades count as not winning | | *Practice* | Time spent in [backtest sessions](https://docs.chartnaut.com/guides/how-backtesting-works) | | *Streak* | Consecutive days, counting back from today, with at least one closed trade | Hover a stat's name to see how it is worked out. ## Your accounts In the accounts card, a tab for each of your five most recently active [accounts](https://docs.chartnaut.com/guides/how-accounts-work) sits beside **All accounts**. Each tab shows the account's balance, whether it is *Live* or *Demo*, and its gain. Click a tab to open that account's month calendar, with P&L on every day you traded. Click a day to see its trades and orders. For the account's full reports, click it on the Accounts page; [Manage an account](https://docs.chartnaut.com/guides/manage-an-account) lists what is there. **All accounts** puts every connected account on one calendar, with realised P&L totalled per currency so a USD account and a EUR account are never added together. - **Add account** opens the [connect](https://docs.chartnaut.com/guides/connect-chartnaut-demo) flow. - **View all** opens **Trading → Accounts**. The tab you pick is remembered the next time you open the dashboard. ![Account calendar on the dashboard](https://docs.chartnaut.com/captures/dashboard-account-calendar.png) *An account tab selected, with its month calendar below.* ## Getting started When you are new, a *Getting started* card lists two first steps: - *Create your first Playbook*. **Create Playbook** opens a new [playbook](https://docs.chartnaut.com/guides/create-a-playbook). - *Run your first backtesting session*. **Start Simulation** opens a new [backtest session](https://docs.chartnaut.com/guides/start-a-session). Each row ticks itself off when it is done. ## Your own dashboards Next to Home you can build dashboards of your own out of [apps](https://docs.chartnaut.com/guides/build-an-app). The switcher at the top right of the dashboard lists **Home**, then yours, then **New dashboard**. Chartnaut opens on Home each time, and a dashboard you pick stays in the page's link, so a refresh or a bookmark brings it back. To make one: 1. Click the switcher at the top right and choose **New dashboard**. 2. Name it and click **Create**. It opens empty. 3. Click **Add an app** and pick one from your library. 4. Hover a panel and click **Add** on its title bar to split it: **Split to Left**, **Split to Right** or **Split to Bottom**. The same menu has **Swap app**, and the bin beside it removes the panel. Drag a panel by the grip at the left of its title bar to move it, and drag the gap between two panels to resize them. Every change saves on its own. An app that reads a set of trades asks which ones when you add it: a session, an account, a playbook or a day. Change it later with **Trades** on the panel's title bar. The same app can sit in two panels, one per account for example. The **⋯** menu beside **Panel** has **Rename**, **Duplicate** and **Delete**. Deleting a dashboard keeps its apps in your library. How many dashboards you can make, and how many panels each holds, depends on your plan: see [Library limits](https://docs.chartnaut.com/account/library-limits). Home never counts. --- # Trades library URL: https://docs.chartnaut.com/guides/trades-library/ Updated: 2026-11-22T22:28:28Z Find any trade by asking for it or by filtering, and choose how trades are shown and sorted. Trades holds every trade you have taken in Chartnaut: live and demo trades, trades imported or adopted from MetaTrader or cTrader, backtest trades and trades logged in hindsight. Open it from **Trading → Trades**. [How your trades are recorded](https://docs.chartnaut.com/guides/how-your-trades-are-recorded) explains where each kind comes from. ## Ask for the trades you want The quickest way to find trades is to describe them. Type into the box over the grid, which reads *Search or ask about your trades*, for example: > My losing BTC trades that opened before 10:00 last month The search page opens with the matching trades and the agent's answer. When the agent offers to apply the result, click **Accept**: Trades opens in a new tab showing only those trades, under *Showing AI search results*. Click **Clear AI search** to go back to everything. [AI trade search](https://docs.chartnaut.com/guides/ai-trade-search) covers the rest. ## Filter by hand The sidebar on the left holds the filters. Every change applies straight away, and each section has a **Clear** link once you use it. | Filter | What it narrows by | |---|---| | **Playbooks** | The [playbook](https://docs.chartnaut.com/guides/how-playbooks-work) a trade is filed in | | **Accounts** | The [account](https://docs.chartnaut.com/guides/how-accounts-work) that took it | | **Sessions** | The [backtest session](https://docs.chartnaut.com/guides/how-backtesting-works) it came from. Search by name | | **Trade** | **Origin** (Backtest, Hindsight, Live, Imported, Adopted), **Side**, **Status** (Open or Closed), **Outcome** (Winning, Losing, Breakeven), and **Unmapped only** | | **Custom Fields** | Your own properties. **Add filter** picks a field and a condition, such as *Grade Is A* or *Mistake Is not empty*. Up to 10, all must match | | **Closed Date** | A **From** and **To** date, by **Closed at** or **Trade date** | Filters live in the page address, so a bookmark or a shared link reopens the same view. When the sidebar is hidden, the **Filters** button opens the same filters in a panel with **Reset** and **Save**. ![Trades library](https://docs.chartnaut.com/captures/trades-library-grid.png) *Trades in grid view, with the filter sidebar on the left.* ## Change how trades are shown At the top of the sidebar: - **Grid view** shows each trade as a chart snapshot, **P&L path view** as the path its profit and loss took, and **Table view** as rows. Pick a tile size: **S**, **L** or **XL**. - **View** sets the figure on every tile: **Risk : Reward** (the default), **Max Reward**, **Max Drawdown**, **Potential (R)**, **Realized P&L**, **Max Favorable** or **Max Adverse**. - **Sort** orders by **Trade date**, **Log date** or any of those figures, and **Order** flips the direction. - **Columns**, in table view, chooses and reorders the columns. Symbol, Opened / Closed and Result are always shown. Each tile shows the symbol, the side and the figure you chose, green for profit and red for loss. An open trade shows *Open*. A trade on a broker symbol that is not linked to a chart shows *Unmapped*; [Symbol mapping](https://docs.chartnaut.com/guides/symbol-mapping) fixes it. ## Open a trade Click any trade. Its detail opens beside a narrow list of the other trades, so you can click through them in turn without losing your filters. Close it with the **X**, or your browser's back button. ![A trade open in the library](https://docs.chartnaut.com/captures/trades-library-detail-open.png) *A trade's detail open beside the filtered list.* [Trade detail](https://docs.chartnaut.com/guides/trade-detail) explains everything on it. Each trade can also carry your own tabs; see [Views on trades](https://docs.chartnaut.com/guides/views-on-trades). --- # Trade detail URL: https://docs.chartnaut.com/guides/trade-detail/ Updated: 2026-11-22T22:28:28Z Everything on one trade: details, P&L path, playbook, tags, properties, notes, snapshots and fills. Click any trade in [Trades](https://docs.chartnaut.com/guides/trades-library), a journal day or an account's **Trades** tab, and its detail opens: everything Chartnaut recorded about the trade, and the places you add your own view of it. ![Trade detail](https://docs.chartnaut.com/captures/trade-detail-overview.png) *A closed trade's Overview tab: details, P&L path, notes and snapshots.* ## The header Along the top: the symbol and side, the tabs, then the result and **Share**. [Sharing a trade](https://docs.chartnaut.com/guides/sharing-a-trade) covers **Share**. - **Overview** is where you review and annotate the trade. - **Details** lists every execution. - **+ View** adds a tab of your own, such as a chart of this trade against your other trades on the same setup. See [Views on trades](https://docs.chartnaut.com/guides/views-on-trades). If the trade is on a broker symbol that is not linked to a chart, a notice above the tabs offers **Map** followed by the symbol. [Symbol mapping](https://docs.chartnaut.com/guides/symbol-mapping) explains it. ## Overview The *Details* list on the left holds the facts: *Result* (with commission and swap when there were any), *Entry*, *Exit*, *Side*, *Status*, *Quantity*, *Origin*, *Opened* and *Closed*. Beside it is the trade's P&L path: its open profit and loss from entry to exit, so you can see whether a winner nearly stopped out first. ### Playbook and tags 1. Click the value beside *Playbook*. 2. Under *Log this trade to*, choose a [playbook](https://docs.chartnaut.com/guides/how-playbooks-work). 3. Click the value beside *Tags* and tick the tags that were true for this trade. 4. Click **Save**. Tags belong to a playbook, so a trade needs a playbook before it can be tagged. Moving a tagged trade to a different playbook asks you to confirm with **Change playbook**, and clears its tags. [Tags and criteria](https://docs.chartnaut.com/guides/tags-and-criteria) explains how tags are set up. ### Your own properties Properties are fields you define once and fill in per trade, such as a grade, a mistake or a recording link. 1. Click **Add property**. 2. Type a name and choose a type: Text, Large Text, Select, Multi-select, Number, Checkbox, Date, Rating, URL or Duration. 3. Press Enter. 4. Click the new row's value to fill it in. A property appears on all your trades, and each trade keeps its own value. Values save as you type. To remove a property from every trade, open its row menu and click **Delete property**. You can filter Trades by any property except Large Text. ### Notes Write under *Notes*. They save as you type, and *Saving* shows briefly beside the heading. **Load template…** fills the notes from a saved template. [Notes, tags and templates](https://docs.chartnaut.com/guides/notes-tags-and-templates) covers templates. ### Snapshots Under the notes are the chart snapshots Chartnaut took at open and close. **Interactive** shows the trade on a chart you can scroll and draw on; **Images** shows the pictures. [Snapshots and replay](https://docs.chartnaut.com/guides/snapshots-and-replay) has the detail. ## Details The **Details** tab lists what was executed: | Section | What it shows | |---|---| | *Execution* | Number of fills, buy and sell quantity, average fill, commission and position P&L | | *Fills* | Each execution: side, quantity, price, notional, commission, P&L, time and order | | *Orders* | Each order: type, side, status, quantity, order price and filled price | | *Position* | Entry, exit, quantity and side | | *Computed values* | Realized R, MFE and MAE in R and in money, Potential (R), Duration and R-levels reached | MFE is how far the trade went in your favour while it was open, and MAE how far it went against you. *Potential (R)* is the best R the setup reached before your initial stop was hit, whenever you exited. Chartnaut keeps watching price for 48 hours after the exit, or until the setup reaches your playbook's highest R-level, and shows the best so far in the meantime, updated every six hours. *R-levels reached* shows how long after entry the setup first hit each of your R-levels. ![Details tab](https://docs.chartnaut.com/captures/trade-detail-fills.png) *The Details tab with execution figures, fills and orders.* --- # Snapshots and replay URL: https://docs.chartnaut.com/guides/snapshots-and-replay/ Updated: 2026-11-22T22:28:28Z See your charts at entry and exit, step back into the trade on its chart, and export it as a video. When you open and close a trade, Chartnaut photographs your charts. Weeks later you can see exactly what you were looking at when you clicked Buy, step back into the chart around the trade, or turn it into a short video. ## When snapshots are taken Chartnaut captures your whole Charts layout, every chart with its symbol and timeframe, once when the trade opens and once when it closes. It can only do that while Chartnaut is open, so a trade that hits its stop while Chartnaut is closed has an open snapshot and no close snapshot. Trades [imported from your broker](https://docs.chartnaut.com/guides/history-import) have no snapshots, because Chartnaut was not watching when you took them. Their detail says *Broker-sourced trades do not include chart snapshots.* ## See them on a trade Open a trade in [Trades](https://docs.chartnaut.com/guides/trades-library) and scroll below *Notes*. A switch picks between two ways to look at it. **Images** shows the two captures, *At open* above *At close*, each with the time it was taken. ![Snapshot images](https://docs.chartnaut.com/captures/snapshots-and-replay-images.png) *At open and At close snapshots of a two-chart layout.* **Interactive** puts the trade back on a chart: the chart that matches the trade's instrument, loaded from the snapshot with indicators on. It shows the whole trade with the same number of bars again on each side, so you see the run-up and what happened after you exited. You can scroll, zoom and draw on it as on any chart. Interactive is the default, and Chartnaut remembers which one you last used. If a trade's snapshot does not carry enough chart detail, Interactive is unavailable and Images is the way to see it. ![Interactive replay](https://docs.chartnaut.com/captures/snapshots-and-replay-interactive.png) *The Interactive view: the trade on its chart, with bars either side.* ## Preview from the table In the table view of Trades, click a trade's chart thumbnail to preview its snapshots without opening the trade. - Switch between *At open* and *At close*. With several charts in the layout, click a timeframe to enlarge that chart, or **All** for the whole layout. - **Copy** copies the image. Cmd+C or Ctrl+C does the same. - **Open** opens the trade. - **More** shows its duration and open and close times. ## Export a video A trade video replays the trade on its chart: price moving bar by bar, your entry drawn in, and the result landing at the exit. It is made for posting. 1. On the trade, click **Share**, then **As video**. 2. Choose the settings below. The stage shows the trade's chart at the size you pick. 3. Click **Render video**. A progress bar counts the frames. 4. When it is ready, click **Download MP4**. | Setting | Choices | |---|---| | *Style* | **Full**, the chart edge to edge, or **Card**, the chart in a framed card with a wallpaper or colour behind it | | *Size* | **9:16** (1080×1920) for stories and reels, or **16:9** (1920×1080) | | *Story* | Pacing (**Quick**, **Standard** or **Cinematic**), whether indicators, the order ticket and your drawings are drawn in, the trade marker, and a camera that follows price, pushes in towards the exit or stays still | | *Finish* | A result card at the end, and the Chartnaut mark | | *Output* | **1080p** or **720p**, at **60 fps** or **30 fps** | The clip is as long as the trade and the pacing make it, and shows your avatar and username. Changing a setting after rendering means rendering again. Rendering happens in your browser, which needs WebCodecs: current Chrome, Edge or Safari 16.4 and later. ![Trade video settings](https://docs.chartnaut.com/captures/snapshots-and-replay-video.png) *The trade video page with a 9:16 preview and its settings.* A trade with no usable snapshot has nothing to replay, so it cannot be made into a video. [Sharing a trade](https://docs.chartnaut.com/guides/sharing-a-trade) covers the image card. --- # Daily journal URL: https://docs.chartnaut.com/guides/daily-journal/ Updated: 2026-11-22T22:28:28Z One page per trading day with its P&L, trades and orders beside what you wrote about it. The journal gives every trading day its own page: the day's numbers and trades on one side, your own words about it underneath. Open **Trading → Journal** and it opens on today. It covers real trading only: *Live* trades from your [accounts](https://docs.chartnaut.com/guides/how-accounts-work), including Chartnaut Demo, and trades *Imported* or *Adopted* from MetaTrader or cTrader. Backtest and hindsight trades stay in [Trades](https://docs.chartnaut.com/guides/trades-library). A trade belongs to the day it closed, in your own timezone, and the numbers cover all your accounts together. ![Journal day](https://docs.chartnaut.com/captures/daily-journal-day.png) *A journal day: the month calendar on the left, the day's stats and entry on the right.* ## Find a day The left side holds the month. - The calendar marks each day: a ring for a quiet day, a solid dot for a day you traded, a coloured dot for a day with a journal entry. Hover a dot to see the trade count. - Under it, every day of the month is listed newest first, with the first line of your entry, or the number of trades, and the day's P&L. - The arrows beside the month name move a month back or forward. You cannot go past the current month or pick a future day. - Click **Journal** in the breadcrumb at the top to jump back to today. Drag the edge of the left side to make it wider or narrower. ## Read the day The **Journal** tab shows the day at a glance: | Figure | What it is | |---|---| | *Net P&L* | The day's realised P&L. A day with several account currencies shows one figure per currency | | *Trades* | Trades closed that day | | *Win rate* | Wins as a share of decided trades, with the count of wins and losses | | *Symbols* | What you traded | | *Month to date* | Running P&L for the month so far | Beside the figures is the day's trade list. Click a trade to open it in Trades, filtered to that day. The **Trades** tab shows the day in full, under **Positions** and **Orders**. Positions has the same grid, P&L path and table views as Trades, and opens in the table. ## Write about it Type in the box under *Journal*, which starts *How did today go?*. The entry saves a moment after you stop typing and when you click away. *Saving* shows while it does. - Type `@` to reference something from Chartnaut: a trade, playbook, study, indicator, definition, app or backtest session. - Select text for bold, italic, headings, lists, checklists and quotes. - Right-click for **Insert**, to add a list, checklist, heading, quote or divider. A day with an entry gets the coloured dot in the calendar, and its first line shows in the list, so a month of entries reads like a table of contents. ![Journal entry with a trade reference](https://docs.chartnaut.com/captures/daily-journal-entry.png) *A journal entry referencing a trade with @.* ## Add your own view Click **+ View** beside the tabs to add a tab to every journal day, such as your P&L by hour or a checklist score. Describe what you want and build it with the agent, or pick one from the community. See [Views on journal days](https://docs.chartnaut.com/guides/views-on-journal-days). For notes on a single trade rather than the whole day, use the trade's own notes. [Notes, tags and templates](https://docs.chartnaut.com/guides/notes-tags-and-templates) covers both. --- # Notes, tags and templates URL: https://docs.chartnaut.com/guides/notes-tags-and-templates/ Updated: 2026-11-22T22:28:28Z Write notes on a trade, reuse note templates, tag trades from their playbook and add your own properties. Chartnaut records what happened on a trade. Notes, tags and properties record what you thought about it, in a form you can search and filter later. All three live on a trade's **Overview** tab in its [detail](https://docs.chartnaut.com/guides/trade-detail). | | What it is for | Example | |---|---|---| | Notes | Free text about one trade | "Chased the second push. Should have waited for the retest." | | Tags | Which of a [playbook](https://docs.chartnaut.com/guides/how-playbooks-work)'s conditions were true | *Above VWAP*, *A+ setup* | | Properties | Your own fields, the same on every trade | Grade, Mistake, Recording link | ## Notes Write under *Notes* on the trade. Notes save a moment after you stop typing and when you click away. Select text for bold, italic, headings, lists, checklists and quotes. Right-click for **Insert**, to add a list, checklist, heading, quote or divider. Notes on a trading day as a whole belong in the [Daily journal](https://docs.chartnaut.com/guides/daily-journal), where you can also reference trades, playbooks and studies with `@`. ## Note templates A template is a set of prompts you answer after every trade, so each review asks the same questions. For example: ``` Setup: Why I entered: Where I got out, and why: Would I take it again? ``` ### Create a template 1. On any trade, open **Load template…** beside *Notes*. 2. Click **New template…**. 3. Name the template and write it. 4. Click **Save**. ![Note template editor](https://docs.chartnaut.com/captures/notes-tags-and-templates-editor.png) *A note template being written in the template editor.* ### Use a template 1. On the trade, open **Load template…**. 2. Pick the template. If the trade already has notes, Chartnaut asks *Replace existing notes?*. Click **Replace** to overwrite them, or **Cancel** to keep them. To add a template without losing what you wrote, right-click in the notes and choose it under **Template** instead: it goes in where your cursor is. Templates are for trade notes. The daily journal does not use them. ### Edit or delete templates In **Load template…**, each template has edit and delete buttons. **All templates** opens the full list, with **New template** at the top. Deleting a template asks you to confirm and cannot be undone. Notes you already filled in from it stay as they are. ## Tags Tags come from the playbook a trade is filed in. Each playbook defines its own, such as *Above VWAP* or *News day*, so tags on a trade say which of the playbook's conditions held. 1. Set the trade's *Playbook*. 2. Click the value beside *Tags*. 3. Tick the tags that were true. 4. Click **Save**. A trade without a playbook cannot be tagged. Changing a tagged trade's playbook clears its tags, and asks you first. [Tags and criteria](https://docs.chartnaut.com/guides/tags-and-criteria) explains how to set tags up, and [Playbook reports](https://docs.chartnaut.com/guides/playbook-reports) shows how they split your results. ![Tags on a trade](https://docs.chartnaut.com/captures/notes-tags-and-templates-tags.png) *Picking a playbook's tags on a trade.* ## Properties Properties are fields you add once and fill in per trade. Click **Add property** on any trade, name it and choose a type: Text, Large Text, Select, Multi-select, Number, Checkbox, Date, Rating, URL or Duration. It then appears on every trade, and each trade keeps its own value. In [Trades](https://docs.chartnaut.com/guides/trades-library), **Custom Fields** filters by any property except Large Text, for example every trade where *Mistake* is not empty. [Trade detail](https://docs.chartnaut.com/guides/trade-detail) covers editing and deleting properties. --- # AI trade search URL: https://docs.chartnaut.com/guides/ai-trade-search/ Updated: 2026-11-22T22:28:28Z Ask about your trades in plain words, get the matching trades back and apply them to Trades. AI trade search lets you ask about your trades in plain words and get the matching trades back along with the answer. Ask for "my BTC shorts from last week that went more than 1R against me before working", and you get those trades as cards you can open, plus the agent's read on them. It is part of the [agent](https://docs.chartnaut.com/guides/how-the-agent-works), so it works on every plan and runs on [AI credits](https://docs.chartnaut.com/guides/ai-credits) or [your own AI subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription). ## Ask a question 1. Open **Trading → Trades**. 2. Type into the box over the grid, which reads *Search or ask about your trades*. If it is folded away, click **Ask agent**. 3. Press Enter. The search opens on its own page, with your question in the chat. Some things to try: > Which of my losing trades this month had no playbook? > Show my best ten trades by R since June, and what they had in common. > Did I do better on EURUSD before or after 10:00 London time? Type `@` in the box to give the agent context, such as a playbook. ![AI trade search](https://docs.chartnaut.com/captures/ai-trade-search-results.png) *A trade search: the question, the agent's answer and a row of matching trades.* ## Read the results Matching trades come back as a row of cards under the agent's answer. The row's title says what the set is and how it is sorted, for example *P&L · lowest first*. Scroll it sideways for more, and click a card to open that trade. **View in library** opens the whole set in Trades in a new tab, without changing your main view. Keep asking in the same chat to narrow the set down or split it another way. **New** starts a fresh search, and **History** reopens a past one. ## Apply the result to Trades When the agent offers to apply a result to your trades library, a card asks *Apply this search to your trades library?* with the number of trades. 1. Click **Accept**. 2. Trades opens in a new tab showing only those trades, under *Showing AI search results*. 3. Filter and open them as usual; they keep the order the search gave them. Click **Clear AI search** to go back to all your trades. **Reject** leaves your library as it is. A result set lasts up to three days; after that, run the search again. ## Studies on your trades Some questions need more than a filter, such as "how much of my P&L comes from the first hour?". For those, the agent writes a trade study: a small script that runs over your trades and keeps the ones that match. 1. The agent shows the study as a proposal card. **Show code** reveals what it will run. 2. Click **Accept** to save it, or **Dismiss** and say what should be different. 3. The agent runs it. The results open beside the chat, with the matching trades and **View in library**. The matching trades from each study run are kept as a [pinned collection](https://docs.chartnaut.com/guides/pinned-collections), so you can come back to them. ## When it goes wrong - *No AI credits remaining*: add credits from [Subscription and billing](https://docs.chartnaut.com/account/subscription-and-billing), or connect your own AI subscription. - *This search has expired*: result sets are temporary. Ask the question again. --- # Pinned collections URL: https://docs.chartnaut.com/guides/pinned-collections/ Updated: 2026-11-22T22:28:29Z Sets of trades kept from trade studies, to open in Trades or study again. A pinned collection is a fixed set of trades you can come back to: the trades a question picked out, kept together under one name. Filters in [Trades](https://docs.chartnaut.com/guides/trades-library) change as new trades arrive. A collection does not: it holds exactly the trades it was made from. ## Where collections come from Collections are made for you by [AI trade search](https://docs.chartnaut.com/guides/ai-trade-search). When you ask the agent something that needs a trade study, such as "which of my winners came in the first hour after a gap?", the study runs over your trades and keeps the ones that match. Every run that keeps at least one trade saves them as a pinned collection, named after the study and the count, for example *First hour gap winners kept (14)*. So to make one, ask the question: 1. Open **Trading → Trades** and type your question into the box over the grid. 2. When the agent proposes a trade study, click **Accept**. 3. Let it run. The matching trades appear beside the chat, and are saved as a collection. Ordinary search results that are not from a study are temporary and last up to three days. Studies are how you keep a set. ## Open your collections The Collections page lists every collection. It has no menu entry: open it by going to `/morpheus/trades/collections` in Chartnaut. Each row shows the collection's name, how many trades it holds, how it was made and when it was pinned. If it was built from another set, *Lineage* shows the chain. ![Collections page](https://docs.chartnaut.com/captures/pinned-collections-list.png) *The Collections page with two collections from trade studies.* ## Use a collection - **View in library** opens Trades showing only the collection's trades. Filter, open and review them as usual, then click **Clear AI search** to go back to everything. - **Study in chat** opens a new search that asks the agent to run a trade study on the collection, so the next question works on exactly those trades. **Search** at the top of the page starts a new search. **Trades library** takes you back to Trades. Collections cannot be renamed or deleted. --- # Sharing a trade URL: https://docs.chartnaut.com/guides/sharing-a-trade/ Updated: 2026-11-22T22:28:29Z Save a trade as a styled image card or an MP4 video of it playing out on its chart. Share a trade as a styled image card or as a short video of the trade playing out on its chart. Both are made in your browser and saved as files, ready to post or send. 1. Open the trade in [Trades](https://docs.chartnaut.com/guides/trades-library). 2. Click **Share** at the top right of the trade. 3. Choose **As image** or **As video**. ## As image The card shows the symbol and side, the P&L in money with the R it made underneath, and when you opened and closed it, at what prices and what size. Your name, avatar and the Chartnaut logo sit on it too. ![Share as image](https://docs.chartnaut.com/captures/sharing-a-trade-image.png) *The Share as image dialog with a Card style trade card and its options.* Pick a style at the top of the dialog: | Style | What it shows | |---|---| | **Card** | The P&L large, with the trade's P&L path underneath if you want it | | **Thumbnail** | A chart snapshot from the close, with the trade details below | | **Detail** | The snapshot and the details side by side | Then adjust the look in the options beside it: - *Wrap*: the background, a **Wallpaper** or a plain **Color**, with an optional **Wash** tint over it. - *Surface* and *Type*: the colour of the card and of its text. **Auto P&L** colours the result green or red for you; turn it off to pick your own. - *Path* (Card style): show or hide the **P&L path**. - *Snapshot* (Thumbnail and Detail): which chart from the close snapshot to use, by timeframe. - *Author* (Thumbnail and Detail): which corner your name goes in. **Reset to defaults** puts everything back. Chartnaut remembers your choices for the next trade you share. To save, click the card or **Click to save** under it. The card downloads as a high-resolution PNG, named after the symbol. ## As video **As video** opens the trade video page, where the trade replays on its chart bar by bar, with your entry drawn in and the result at the end. Choose a style, **9:16** for stories or **16:9**, the pacing and the camera, then click **Render video** and **Download MP4**. [Snapshots and replay](https://docs.chartnaut.com/guides/snapshots-and-replay) lists every setting. ![Trade video page](https://docs.chartnaut.com/captures/sharing-a-trade-video.png) *The trade video page with a rendered 9:16 clip ready to download.* ## Limits - Thumbnail and Detail need a close snapshot. A trade that closed while Chartnaut was shut has none, so use the Card style for it. - A video needs a chart snapshot to replay. Trades [imported from your broker](https://docs.chartnaut.com/guides/history-import) have none, so share those as a Card. - The P&L on a card cannot be hidden. --- # How playbooks work URL: https://docs.chartnaut.com/guides/how-playbooks-work/ Updated: 2026-11-22T22:28:29Z What a playbook holds, how R-levels and tags work, how trades get into it, its reports, and what Historical Intelligence needs to train. A playbook is one setup you trade on purpose, written down: its entry rule, three profit targets measured in R, the tags you use to describe each trade, and the trades themselves. Once it holds enough trades, its reports show where the setup pays and [Historical Intelligence](https://docs.chartnaut.com/guides/historical-intelligence) learns from it. Open your playbooks from **Trading → Playbooks**. They work on every plan. How many of them [Historical Intelligence](https://docs.chartnaut.com/account/historical-intelligence-limits) learns from depends on your plan. ## What a playbook holds | Part | What it is | Where you set it | |---|---|---| | Name and colour | How the playbook shows up on trades and on the chart | When you [create it](https://docs.chartnaut.com/guides/create-a-playbook), or in **Playbook settings** | | Entry trigger | The rule that puts you in the trade, in your own words | **Playbook settings** | | R-levels | Three targets in multiples of your risk | When you create it, or on the **Historical Intelligence** tab | | Tags | The conditions you check on every trade | The **Tags** tab, or while you tag a trade | | Instruments | The markets you trade the setup on | Added when you file a trade, or with **Add instrument** | | Trades | Every trade you have filed into it | The **Trade Book** tab | **Playbook settings** opens from the button beside the playbook's name. ## R-levels R is the amount you risked on a trade. Risk $200 and make $400, and the trade made 2R. Measuring in R lets a playbook compare trades of different sizes, on different instruments, fairly. Every playbook has three R-levels: - **Bare minimum**: early profit, where you scale out part of the position. 1R unless you change it. - **Main target**: where the setup pays when it plays out. 2R by default. - **Extended target**: where a runner goes when momentum continues. 3R by default. The reports measure each trade against these targets, and Historical Intelligence gives the odds of reaching each one. Saving new targets after a model is trained switches that model off until you retrain it. ## Tags Tags are the conditions you tick on each trade: *Above VWAP*, *Retest held*, *News day*. A tag is a **Checkbox** (true or not), a **Radio Group** (exactly one option, such as a range that was narrow, normal or wide) or a **Checkbox Group** (any of several options). Tags belong to their playbook. Move a trade to a different playbook and its tags are cleared. Over enough trades, the **Correlations** report and the **Relationships** view on the **Tags** tab show which tags go with your winners. See [Tags and criteria](https://docs.chartnaut.com/guides/tags-and-criteria). ## Filing trades into a playbook A trade can come from a [MetaTrader](https://docs.chartnaut.com/guides/connect-metatrader) or [cTrader](https://docs.chartnaut.com/guides/connect-ctrader) account, [Chartnaut Demo](https://docs.chartnaut.com/guides/connect-chartnaut-demo) or a [backtest session](https://docs.chartnaut.com/guides/how-backtesting-works). There are two ways to file it: - **On the chart, as you place it.** In the Position Manager, **Add to chart** asks **Log this trade?**. Choose the playbook, tick its tags and click **Draft**. See [Trading from the chart](https://docs.chartnaut.com/guides/trading-from-the-chart). - **Afterwards.** Open the trade in [Trades](https://docs.chartnaut.com/guides/trades-library) and set its **Playbook** and **Tags** rows. See [Trade detail](https://docs.chartnaut.com/guides/trade-detail). Filing a trade on a new instrument adds that instrument to the playbook. The **Trade Book** tab also lays out every quarter of history for each of the playbook's instruments. Opening a quarter starts a data collection session: a replay locked to that instrument and playbook, with trading costs, slippage and risk rules switched off, built for logging lots of examples of the setup quickly. ![Playbook Trade Book tab](https://docs.chartnaut.com/captures/how-playbooks-work-trade-book.png) *A playbook's Trade Book tab with its quarter map for BTC.* ## Reports The **Overview** tab gives the headline numbers: cumulative R, win rate, trade count, average R and R over time. The **Reports** tab goes further: | Group | Reports | |---|---| | Time | Daily, Monthly, Trade Timing | | Instruments | Instruments, Volatility | | Analysis | Correlations | | Performance | Edge, Risk & Reward | | Simulations | Monte Carlo | You can add your own views to a playbook's reports, as you can to every trade, journal day and backtest session. See [Build your own pages](https://docs.chartnaut.com/guides/build-your-own-pages), [Views on playbooks](https://docs.chartnaut.com/guides/views-on-playbooks) and [Playbook reports](https://docs.chartnaut.com/guides/playbook-reports). ## Historical Intelligence Historical Intelligence trains a model on one playbook's trades, one instrument at a time. It learns how your trades with a given set of tags tend to finish, and gives the odds of reaching each R-level on the next one. You can train an instrument once it has 100 closed, tagged trades. The **Historical Intelligence** tab shows the count for each instrument as **Trades to train**. **Data sources** sets which trades count: **Logged** trades from the Trade Book always count, and **Backtest** and **Live** trades can be switched on or off. The tag list you see when logging a trade on the chart has an **Intelligence** switch. With a trained model, turning it on shows the odds for your ticked tags beside them. ![Historical Intelligence tab](https://docs.chartnaut.com/captures/how-playbooks-work-historical-intelligence.png) *The Historical Intelligence tab with instrument tabs, data sources and R targets.* You can create as many playbooks as you like. How many of them Historical Intelligence learns from depends on your plan: | Plan | Playbooks with Historical Intelligence | |---|---| | Free | 3 | | Pro | 5 | See [Historical Intelligence limits](https://docs.chartnaut.com/account/historical-intelligence-limits). To build your first playbook from start to finish, follow [Turn your trades into a playbook](https://docs.chartnaut.com/guides/turn-your-trades-into-a-playbook). --- # Create a playbook URL: https://docs.chartnaut.com/guides/create-a-playbook/ Updated: 2026-11-22T22:28:29Z Create a playbook with its name, colour and three R-level targets, then write its entry rule. A new [playbook](https://docs.chartnaut.com/guides/how-playbooks-work) needs a name, a colour and three R-level targets. Everything else, from the entry rule to the tags, you add afterwards. You can make as many as you like on every plan. ## Create it 1. Open **Trading → Playbooks**. 2. Click **New playbook**. The wizard opens on its first step, **Overview**, with a short video on how playbooks work. 3. Click **Continue to Setup**. 4. Type a **Playbook name**, such as `BTC opening range`. Name it after the setup, so the name still fits when you trade it on ETH. 5. Pick a **Color**. Trades filed into the playbook carry this colour, on the chart and in [Trades](https://docs.chartnaut.com/guides/trades-library). 6. Add a **Description** if you want one. It is optional. 7. Set the three **Risk-reward targets**, or leave the defaults. 8. Click **Create Playbook**. ![Setup step of Create Playbook](https://docs.chartnaut.com/captures/create-a-playbook-setup.png) *The Setup step with name, colour, description and the three R targets.* Chartnaut opens the playbook on its **Trade Book** tab. It is empty until you add an instrument or file a trade. ## Choosing the R-levels R is what you risked on the trade. The three targets are measured in multiples of it: | Target | Default | What it is for | |---|---|---| | **Bare minimum** | 1.0R | A safety net, often about half your main target | | **Main target** | 2.0R | Where you usually take profit when the trade works | | **Extended target** | 3.0R | Where a runner goes when price keeps running | Each target has to be a number above 0. Set them to the levels you actually trade: if you always take profit at 1.5R, make **Main target** 1.5. The [reports](https://docs.chartnaut.com/guides/playbook-reports) measure trades against these targets, and [Historical Intelligence](https://docs.chartnaut.com/guides/historical-intelligence) gives the odds of reaching each one. To change them later, open the **Historical Intelligence** tab, edit the targets and click **Save**. If a model is already trained, Chartnaut asks *Save R-level targets?* first: new targets switch the model off until you train it again. Click **Save targets** to go ahead. ## Write down the entry rule The entry rule tells you, and anyone you share with, which trades belong in the playbook. 1. Open the playbook and click the settings button beside its name. **Playbook settings** opens. 2. Under **Entry Trigger**, describe what puts you in the trade. It needs at least 10 words, and a counter shows how many you have. 3. Click **Save**. **Playbook settings** is also where you rename the playbook or change its colour. ![Playbook settings](https://docs.chartnaut.com/captures/create-a-playbook-settings.png) *Playbook settings with the Details and Entry Trigger sections.* ## Create one from the chart When you place a trade in [Charts](https://docs.chartnaut.com/guides/trading-from-the-chart), the *Log this trade?* list ends with **New Playbook** (or **Create Your First Playbook** when you have none). It creates the playbook without leaving the chart, so you can file the trade into it straight away. ## Delete a playbook Click the trash button in the playbook's header and confirm with **Delete Playbook**. This removes its tags, its trading data, its Historical Intelligence models and the sessions linked to it, and cannot be undone. ## When it goes wrong - If **Create Playbook** stays greyed out, the name is empty or one of the targets is not a number above 0. Next, add the tags you check on every trade: [Tags and criteria](https://docs.chartnaut.com/guides/tags-and-criteria). To build a whole playbook from start to finish, follow [Turn your trades into a playbook](https://docs.chartnaut.com/guides/turn-your-trades-into-a-playbook). --- # Tags and criteria URL: https://docs.chartnaut.com/guides/tags-and-criteria/ Updated: 2026-11-22T22:28:29Z Add checkbox and group tags to a playbook, tick them on trades from the chart or afterwards, and see which ones matter. Tags are the conditions you check on every trade in a [playbook](https://docs.chartnaut.com/guides/how-playbooks-work): *Above VWAP*, *Retest held*, *Gap day*. Tag every trade the same way and the playbook can tell you which conditions go with your winners. In the app, the list you tick on a trade is also called its criteria. ## Pick a tag type | Type | Takes | Example | |---|---|---| | **Checkbox** | True or not | *Above VWAP* | | **Radio Group** | Exactly one of its options | *Range size*: Narrow, Normal or Wide | | **Checkbox Group** | Any number of its options | *Confluence*: Prior day high, VWAP, Round number | Use a **Radio Group** when every trade has exactly one answer. It keeps the reports clean: a trade cannot be both narrow and wide. ## Add tags to a playbook 1. Open the playbook from **Trading → Playbooks** and open the **Tags** tab. 2. Click **New tag** and type the name. 3. Choose **Checkbox**, **Radio Group** or **Checkbox Group** beside the name, then press Enter. 4. For a group, click **New option** under it and add each option the same way. ![Tags tab list](https://docs.chartnaut.com/captures/tags-and-criteria-list.png) *The Tags tab with checkboxes, a radio group and each tag's progress ring.* To rename a tag or change its type, hover over it and click the pencil. Turning a group into a **Checkbox** removes its options. The trash button deletes a tag, and deleting a group deletes all its options. Each tag has a ring that fills as more of your trades carry it. It is full, and marked *Learned*, at 50 trades. ## Tag a trade on the chart Tagging as you place the trade is the quickest way to keep it honest, because you record the conditions before you know the result. 1. Set up the trade in the Position Manager and click **Add to chart**. See [Trading from the chart](https://docs.chartnaut.com/guides/trading-from-the-chart). 2. The *Log this trade?* list opens. Click the playbook. Its tags open beside it. 3. Tick the tags that are true right now and choose one option in each **Radio Group**. 4. Click **Draft**, then **Confirm** on the chart. ![Log this trade with tags](https://docs.chartnaut.com/captures/tags-and-criteria-chart.png) *The Log this trade list with a playbook's tags open beside it.* Your ticks stay in place for the next trade, so a condition that holds all session does not need ticking again. *Selections reset in* at the bottom of the list shows when they clear; click it to choose **Daily**, **Weekly** or **Monthly**. The clear button beside the playbook's name clears them straight away. Missing a tag? Click **New** at the bottom of the tag list and add it there. It is saved to the playbook like any other. With a trained [Historical Intelligence](https://docs.chartnaut.com/guides/historical-intelligence) model, the **Intelligence** switch above the tags shows the odds of each R-level for the tags you have ticked. ## Tag a trade afterwards 1. Open the trade in [Trades](https://docs.chartnaut.com/guides/trades-library). 2. If the **Playbook** row is empty, click it and choose the playbook. 3. Click the **Tags** row. The list asks *Which criteria does this position meet?* 4. Tick the tags and click **Save**. Moving a trade to a different playbook clears its tags, because tags belong to their playbook. See [Trade detail](https://docs.chartnaut.com/guides/trade-detail). ## See which tags matter The **Tags** tab has two views. **List** is where you add and edit tags. **Relationships** draws your tags as spheres in 3D, sized by total P&L; click one to see its trade count, its average R and how it does when paired with each of your other tags. The **Correlations** report compares your win rate on trades with each tag against trades without it. See [Playbook reports](https://docs.chartnaut.com/guides/playbook-reports). --- # Playbook reports URL: https://docs.chartnaut.com/guides/playbook-reports/ Updated: 2026-11-22T22:28:29Z What each playbook report shows, how to run a Monte Carlo simulation and how to add your own report. A [playbook's](https://docs.chartnaut.com/guides/how-playbooks-work) reports show where the setup pays you and where it costs you: by time, by market, by tag and across thousands of simulated trade sequences. Every number is in R, measured against the targets you set when you [created the playbook](https://docs.chartnaut.com/guides/create-a-playbook). ## The Overview tab **Overview** is the quick read: *Cumulative R*, *Win rate*, *Trades* and *Average R* across the top, with R over time beneath. Below it, *10+ more reports available* opens the **Reports** tab. ## The Reports tab Open **Reports** and click any report to open it. **Search reports** at the top finds one by name. | Group | Report | What it answers | |---|---|---| | Time | **Daily** | Which weekdays pay, your streaks and daily risk | | Time | **Monthly** | Your equity curve by month, seasonality and how many months were profitable | | Time | **Trade Timing** | Which hours and sessions pay, and whether hold time matters | | Instruments | **Instruments** | Which markets carry the setup and which drag it down | | Instruments | **Volatility** | How the setup does in quiet, normal and busy markets, measured with ATR | | Analysis | **Correlations** | Which tags go with a higher win rate, and which with a lower one | | Performance | **Edge** | Whether your edge is growing, steady or fading over time | | Performance | **Risk & Reward** | Each trade's result against its target, and how wins compare with losses | | Simulations | **Monte Carlo** | The range of outcomes and drawdowns your results could produce | ![Playbook Reports tab](https://docs.chartnaut.com/captures/playbook-reports-list.png) *The Reports tab with the Time, Instruments, Analysis, Performance and Simulations groups.* Three more simulations are listed as *Soon* and cannot be opened yet: *Rule Variant Replay*, *Capital Curve Stress Test* and *Position Sizing Sandbox*. Star a report to add it to *Favourites* at the top of the list. The pin button adds it as a tab beside **Overview** and **Reports**, one click away. ## Reading the reports well Tag every trade the same way. **Correlations** only compares what you recorded, so a tag you forgot to tick counts as a trade without it. Check the trade count before you act on a percentage. With twenty trades, a 70% win rate can come from two lucky days. ## Run a Monte Carlo simulation Monte Carlo shuffles your real results into thousands of possible sequences to show what the same edge could do in a different order. It is the report to read before you size up. 1. Open **Reports** and click **Monte Carlo**. 2. Set **Simulations** (1,000 by default, up to 10,000) and **Trades per sim** (100 by default). 3. Set **Starting balance** and **Risk** per trade, in dollars or as a percentage. 4. Under **Advanced settings**, turn on **Include drawdowns** or **Include volatility** to model losing runs and clustered volatility. 5. Click **Run simulation**. ![Monte Carlo results](https://docs.chartnaut.com/captures/playbook-reports-monte-carlo.png) *Monte Carlo results with probability of profit, return ranges and equity paths.* The results give the *Probability of Profit*, the *Mean Return*, a *Best Case* and *Worst Case*, the *Expected Return Ranges* at each confidence level, and the spread of equity paths. The drawdown row shows the *Mean Max Drawdown*, the *Worst Drawdown* and the *Probability of Drawdown*. If the worst drawdown would break your account's rules, the risk per trade is too high, however good the average looks. ## Build your own report When the report you want is not in the list, click **Create custom report** at the top of the list. It opens the same menu as adding a [view](https://docs.chartnaut.com/guides/build-your-own-pages) anywhere else: pick one from the [community](https://docs.chartnaut.com/guides/community-views), or have the [Agent](https://docs.chartnaut.com/guides/how-the-agent-works) build it with **Build it for me** or **Build it with me**. What it builds appears under *Your custom reports*. See [Views on playbooks](https://docs.chartnaut.com/guides/views-on-playbooks). --- # Historical Intelligence URL: https://docs.chartnaut.com/guides/historical-intelligence/ Updated: 2026-11-22T22:28:29Z Train a model on a playbook's tagged trades for one instrument, read its performance and see the odds of each R-level as you trade. Historical Intelligence trains a model on your own trades in one [playbook](https://docs.chartnaut.com/guides/how-playbooks-work), on one instrument. It learns how far trades with a given set of [tags](https://docs.chartnaut.com/guides/tags-and-criteria) ran before hitting their initial stop, whenever you exited, then tells you the odds of reaching each of your three R-levels on the next one. It works on every plan and needs 100 closed, tagged trades on the instrument you train. How many playbooks and instruments you can train depends on your plan: see [Historical Intelligence limits](https://docs.chartnaut.com/account/historical-intelligence-limits). ## Before you train 1. Open the playbook from **Trading → Playbooks** and open the **Historical Intelligence** tab. 2. Choose the instrument in the tabs at the top, such as **BTC**. Each tab shows its trade count, and the card below shows *Trades to train*. 3. Click **Data sources** and choose which trades count. **Logged** trades from the Trade Book always count. Switch **Backtest** (trades from [backtest sessions](https://docs.chartnaut.com/guides/how-backtesting-works)) and **Live** (trades from your broker accounts) on or off. *Training total if saved* shows the count before you save. 4. Check the three R targets in the targets panel. Change them now if they are wrong, and click **Save**. ![Historical Intelligence before training](https://docs.chartnaut.com/captures/historical-intelligence-ready.png) *The Historical Intelligence tab for BTC, ready to train, with data sources and R targets.* Until the instrument reaches 100 trades, the panel reads *Not enough BTC trades yet*. Keep filing and tagging trades: [Trades](https://docs.chartnaut.com/guides/trades-library), [backtesting](https://docs.chartnaut.com/guides/backtest-on-random-days) and the Trade Book's data collection sessions all add to the count. ## Train the model 1. Click **Train BTC**. The button names the instrument you chose. 2. The status moves through *Queued* and *Training*. Training takes about two minutes per 100 trades. 3. When the status reads *Ready*, the panel shows *BTC model ready*. ![Model performance after training](https://docs.chartnaut.com/captures/historical-intelligence-model-performance.png) *Model performance for BTC, one row for each R target.* ## Read the model's performance *BTC · Model performance* has a row for each R target. Click a row to open its figures: | Figure | What it tells you | |---|---| | *Accuracy* | How often the model's predictions were right on trades it had not seen | | *Calibration* | How well its probabilities match what happened. Lower is better | | *Hit rate* | How often the setup reached this target before its initial stop, whether or not you were still in the trade | | *Samples* | How many trades the checks were run on | Accuracy and calibration are each rated, from *Poor* or *Needs work* up to *Excellent*. A model that is only *Fair* on the main target is telling you the tags you record do not separate winners from losers well. Try a tag you are not recording yet. ## Use it while you trade 1. In [Charts](https://docs.chartnaut.com/guides/trading-from-the-chart), set up the trade and click **Add to chart**. 2. In the *Log this trade?* list, click the playbook. Its tags open beside it. 3. Turn on the **Intelligence** switch above the tags. 4. Tick the tags that are true right now. A panel beside the tags shows the probability of reaching each R-level for that combination of tags, with a *Confidence* reading from *minimal* to *substantial*, based on how many of your past trades match. A strong probability with minimal confidence is a guess. ![Intelligence on the chart](https://docs.chartnaut.com/captures/historical-intelligence-chart.png) *The Intelligence panel beside a playbook's tags, with odds for each R-level.* ## Keep it current The model learns from the trades it was trained on. Retrain it as you add trades: the button then reads **Retrain BTC**. Saving new R targets switches the model off until you train it again, and Chartnaut asks *Save R-level targets?* before it does. Changing **Data sources** also changes what the next training uses, so retrain after that too. If training fails, the panel shows *Training failed for BTC* and the button reads **Retry**. --- # How backtesting works URL: https://docs.chartnaut.com/guides/how-backtesting-works/ Updated: 2026-11-22T22:28:29Z Trade past market data bar by bar: how sessions differ from Chartnaut Demo, how to set one up, random dates, reports and where the trades go. A backtest session replays past market data on the chart so you can trade it bar by bar, as if it were live. You control the clock: play it, step it one bar at a time, or jump ahead to the next session open. Every trade you take is saved like any other, so it can go into a [playbook](https://docs.chartnaut.com/guides/how-playbooks-work) and your [trades library](https://docs.chartnaut.com/guides/trades-library). Backtesting is on every plan, including Free. Open your sessions from **Tools → Backtest**. ## Backtest or Chartnaut Demo Both let you practise without real money. The difference is the market you trade. | | Backtest session | Chartnaut Demo | |---|---|---| | Prices | Past market data, replayed | The live market | | Clock | Yours: play, pause, step, jump | Real time | | How you start | **Tools → Backtest**, then **New session** | [Connect a Chartnaut Demo account](https://docs.chartnaut.com/guides/connect-chartnaut-demo) | | Trades show as | Origin **Backtest** | Origin **Live**, marked Chartnaut Demo | | In the journal | No | Yes | Use a backtest to get fifty examples of a setup in an afternoon. Use Chartnaut Demo to practise the real thing at the real speed. ## Setting up a session **New session** opens with two modes. **Quickstart** is four short steps: 1. **Instruments**: what you want to trade. The **History** row shows the dates available for everything you picked. 2. **Session**: a name, and whether the **Start** is a **Fixed date** or a **Random date**. 3. **Timing**: how the session ends, and a real-time **Duration** if you want a time limit. 4. **Account**: the starting **Balance**, $100,000 unless you change it. **Advanced** adds the settings a careful test needs: | Tab | What it sets | |---|---| | **General** | The same instruments, dates and account as Quickstart | | **Margin** | Leverage, either per market or one number for everything | | **Commissions** | Trading costs per trade, by asset class | | **Conditions** | Slippage on fills | | **Risk rules** | Max drawdown, daily loss, position size and open positions, and whether a breach ends the session | Where a session can start depends on your plan: the last 6 months on Free and any date on Pro. See [Historical data](https://docs.chartnaut.com/account/historical-data). ![New Session page in Advanced mode](https://docs.chartnaut.com/captures/how-backtesting-works-advanced-settings.png) *New Session in Advanced mode, with the Risk rules tab open.* ## Random dates **Random date** is the default start. Chartnaut picks a Monday at random from the history your instruments share, and the session opens at 07:00 UTC that day. You did not choose the date, so you cannot remember what happens next, and your practice stays honest. With a random start, **End after** stops the session after a set amount of simulated time, such as 5 days. With a fixed date, you pick the day in **From**, and turn on **Until** to set an **End date**. ## Trading the replay **Start session** opens the chart in Replay. The replay controls play and pause the market, step forward one bar, set the step timeframe and the playback speed, and jump to the next London, New York or Tokyo session or the next week. See [Replay](https://docs.chartnaut.com/guides/replay). You place trades exactly as you would live, from the Position Manager. See [Trading from the chart](https://docs.chartnaut.com/guides/trading-from-the-chart). ## Reports Every session has its own page with five tabs: **Dashboard**, **Overview**, **Calendar**, **Trades** and **Reports**. **Reports** breaks the session down by time of day, instrument, volatility, wins against losses, drawdown and more. You can add your own views there, as you can to every trade, journal day and playbook: see [Views on backtest sessions](https://docs.chartnaut.com/guides/views-on-backtest-sessions). The full list is in [Session reports](https://docs.chartnaut.com/guides/session-reports). ![Backtest session page](https://docs.chartnaut.com/captures/how-backtesting-works-session-page.png) *A finished backtest session's page on the Dashboard tab.* ## Where the trades go Every trade from a session is saved to [Trades](https://docs.chartnaut.com/guides/trades-library) with its fills and chart [snapshots](https://docs.chartnaut.com/guides/snapshots-and-replay), under the origin **Backtest**. Filter by **Sessions** to see one session's trades. To build a [playbook](https://docs.chartnaut.com/guides/how-playbooks-work), file backtest trades into it as you place them or afterwards. They count towards [Historical Intelligence](https://docs.chartnaut.com/guides/historical-intelligence) while **Backtest** is switched on in the playbook's **Data sources**. Backtest trades stay out of the [journal](https://docs.chartnaut.com/guides/daily-journal), which records the days you traded a live market. The [dashboard](https://docs.chartnaut.com/guides/dashboard) counts them under **Backtest**, and time spent in sessions under **Practice**. To run your first session from start to finish, follow [Backtest on random days](https://docs.chartnaut.com/guides/backtest-on-random-days) or [Start a session](https://docs.chartnaut.com/guides/start-a-session). --- # Start a session URL: https://docs.chartnaut.com/guides/start-a-session/ Updated: 2026-11-22T22:28:30Z Set up a backtest in Quickstart, add margin, costs, slippage and risk rules in Advanced, and fix a session that will not start. A [backtest session](https://docs.chartnaut.com/guides/how-backtesting-works) is set up on the New Session page. **Quickstart** gets you trading in four short steps. **Advanced** adds margin, trading costs, slippage and risk rules for a stricter test. Backtesting is on every plan. ## Start with Quickstart 1. Open **Tools → Backtest** and click **New session**. The New Session page opens on **Quickstart**. 2. Under **Instruments**, click **What do you want to trade?** and pick one or more markets, such as BTC and ETH. 3. Check the **History** row. It shows the dates every instrument you picked has data for. A session can only run inside that shared window. 4. Under **Session**, type a **Name** and choose the **Start**: **Random date** or **Fixed date**. 5. Under **Timing**, set when the session ends (see below) and a real-time **Duration** if you want a time limit. **Unlimited** has none; the options run from 5 minutes to 4 hours. 6. Under **Account**, set the starting **Balance**. It is 100,000 unless you change it, in USD. 7. Click **Start session** at the top right. ![New Session in Quickstart](https://docs.chartnaut.com/captures/start-a-session-quickstart.png) *Quickstart with BTC picked, a random start and a five-day end.* The **Session**, **Timing** and **Account** steps stay locked until you pick an instrument. ## Random or fixed start With **Random date**, Chartnaut picks a Monday at random inside the shared history. Turn on **End after** and set **Simulated** to how much market time the session covers, such as 5 **Days**. Units run from **Minutes** to **Months**. Because you did not pick the day, you cannot remember what happened, and that is the point. With **Fixed date**, choose the day in **From**. Turn on **Until** to pick an **End date**; leave it off to trade on as long as you like. Either way, the session opens at 07:00 UTC on its start day. ## Tighten it with Advanced Click **Advanced**. **General** holds the same settings as Quickstart, and four more tabs sit beside it: | Tab | What you set | Default | |---|---|---| | **Margin** | **One leverage** for everything, or **Per market** by asset class | Per market | | **Commissions** | Trading costs as a **Fixed amount**, a **Percentage** or **By asset class** | On, by asset class | | **Conditions** | **Slippage**: moves each entry price by an **Amount**, so fills are less perfect | Off | | **Risk rules** | **Max drawdown**, **Daily loss**, **Position size** and **Open positions** | All off | ![Risk rules tab](https://docs.chartnaut.com/captures/start-a-session-risk-rules.png) *Advanced mode on the Risk rules tab with two rules switched on.* Risk rules are for prop-style discipline. Breaking any rule you switch on ends the session there and then. Set **Max drawdown** and **Daily loss** to your prop firm's limits and the backtest tells you whether your trading would have passed. ## What happens next Chartnaut opens [Charts](https://docs.chartnaut.com/guides/how-charts-works) in [Replay](https://docs.chartnaut.com/guides/replay) on the start date, with the replay controls on the chart. Trade from the Position Manager as you would live: see [Trading from the chart](https://docs.chartnaut.com/guides/trading-from-the-chart). To file each trade into a [playbook](https://docs.chartnaut.com/guides/how-playbooks-work) as you take it, follow [Backtest on random days](https://docs.chartnaut.com/guides/backtest-on-random-days). To carry on later, open the session from **Tools → Backtest** and click **Play**. The pencil beside a session's name renames it, and the trash button on its page deletes it. ## When it will not start **Start session** stays greyed out while the page shows a message in amber. The common ones: - *Your plan starts backtesting sessions from the last 6 months.* Pick a start on or after the date it names, or upgrade. - *The selected instruments do not share an overlapping historical window.* Remove the market with the shortest history. Click the **History** row: *Tightest* names it. - *The selected random duration does not fit inside the shared coverage window.* Shorten **Simulated**. - A balance that does not cover the margin on a market you picked. Raise **Balance**, or give that market more leverage on the **Margin** tab. Where a session can start depends on your plan: the last 6 months on Free and any date on Pro. See [Historical data](https://docs.chartnaut.com/account/historical-data). --- # Session reports URL: https://docs.chartnaut.com/guides/session-reports/ Updated: 2026-11-22T22:28:30Z What a backtest session's five tabs and ten reports show, and how to add your own report. Every [backtest session](https://docs.chartnaut.com/guides/how-backtesting-works) has its own page that reviews how it went: the P&L, the trades, the days and a set of reports that break the result down. Open it from **Tools → Backtest** by clicking the session. The page fills in after your first trade. Until then it says *No trades yet*, and **Start trading** opens the session in the replay. The session's numbers are in money, starting from the **Balance** you [set it up with](https://docs.chartnaut.com/guides/start-a-session). For results in R, file the trades into a [playbook](https://docs.chartnaut.com/guides/playbook-reports). ## The five tabs | Tab | What it shows | |---|---| | **Dashboard** | *Realized P&L*, *Win rate*, *Trades* and *Equity*, the equity curve with its peak and trough, your top symbols, and win rate by day of week and time of day | | **Overview** | Every headline figure in one place: gain, profit factor, expectancy, winning and losing days, streaks, hold times, costs and your best and worst month | | **Calendar** | A month grid of your trading days. Click a day to see its P&L, win rate and trades | | **Trades** | Every trade under **Positions**, and every order under **Orders** | | **Reports** | The detailed reports below | ![Session Dashboard tab](https://docs.chartnaut.com/captures/session-reports-dashboard.png) *A finished session's Dashboard with P&L, win rate and the equity curve.* Click a trade on the **Trades** tab to open it in [Trades](https://docs.chartnaut.com/guides/trade-detail), where you can see its fills and [snapshots](https://docs.chartnaut.com/guides/snapshots-and-replay), and file it into a playbook. ## The reports Open **Reports** and click one. **Search reports** finds one by name. | Group | Report | What it answers | |---|---|---| | Time | **Daily Analysis** | Your best and worst days, weekdays and hours, streaks and daily risk | | Time | **Monthly Analysis** | Which months and quarters were profitable | | Time | **Trade Timing** | When you enter, how long you hold, and which of those pays | | Instruments | **Instruments** | P&L, win rate and expectancy for each market, with an equity curve each | | Instruments | **Volatility** | Whether you trade better in calm or volatile markets, measured with ATR | | Instruments | **Correlations** | How your markets move together, and where losses could stack up | | Performance | **Wins vs Losses** | Average win against average loss, and whether your edge comes from accuracy or size | | Performance | **Benchmarks** | Your returns against buy-and-hold on benchmarks such as SPY, adjusted for risk | | Performance | **Risk & Reward** | Each trade's risk against its reward, and whether your losses stay in bounds | | Performance | **Drawdown** | Your deepest falls, how long they took to recover, and which markets caused them | *Institutional*, under Advanced, is marked *Soon* and cannot be opened yet. ![Session Reports tab](https://docs.chartnaut.com/captures/session-reports-list.png) *The Reports tab listing the Time, Instruments and Performance groups.* Star a report to put it under *Favourites* at the top of the list. The pin button adds it as a tab beside **Dashboard** and the others, one click away. ## Reading a short session A random week of BTC might hold eight trades. That is enough to spot a mistake you keep making, such as entering before the range has formed, and far too few to judge the setup. Use **Trades** and **Calendar** to review the week trade by trade. Judge the setup from its [playbook](https://docs.chartnaut.com/guides/how-playbooks-work), where every session's trades add up. ## Add your own report When the report you want is not in the list, click **Create custom report**. It opens the same menu as adding a [view](https://docs.chartnaut.com/guides/build-your-own-pages) anywhere else: pick one from the [community](https://docs.chartnaut.com/guides/community-views), or have the [Agent](https://docs.chartnaut.com/guides/how-the-agent-works) build it with **Build it for me** or **Build it with me**. It appears in the list under *Your custom reports*. See [Views on backtest sessions](https://docs.chartnaut.com/guides/views-on-backtest-sessions). --- # How research works URL: https://docs.chartnaut.com/guides/how-research-works/ Updated: 2026-11-22T22:28:30Z How definitions, events, versions, studies and Forward Insights fit together, from a trading idea to an answer on your chart. Research in Chartnaut answers one question: when this setup happened before, what came next? A definition finds every time the setup happened, a study measures what followed, and a Forward Insight puts the answer on your chart. All three live under **Tools → Definitions**, on every plan: Free keeps 10 definitions, 50 studies and 5 Forward Insights, with 1 Forward Insight active on your charts. On Pro, a [definition alert](https://docs.chartnaut.com/guides/definition-alerts) tells you when a definition fires on a live market. [Test your first trading idea](https://docs.chartnaut.com/guides/test-your-first-trading-idea) walks through the whole loop with one real example. This page explains the parts. ## Definitions A definition is a trading idea written down precisely enough that Chartnaut can spot it on a chart. *Price breaks the first 15-minute range of the New York session on BTC while above session VWAP* is a definition. So is *a London session sweep of the Asia high that fails to hold*. You describe the idea and the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) writes it as a script. The builder shows the agent's chat beside a chart preview, so you check its marks on real days as it works. [Build a definition](https://docs.chartnaut.com/guides/build-a-definition) covers the builder, and [Scripting](https://docs.chartnaut.com/scripting/overview) covers writing one yourself. A definition can read [indicators](https://docs.chartnaut.com/guides/how-indicators-work) such as VWAP, ATR or your own. When the agent wants one, it asks you first. [Indicators inside definitions](https://docs.chartnaut.com/guides/indicators-inside-definitions) explains how. ![Definition detail page](https://docs.chartnaut.com/captures/how-research-works-definition-detail.png) *A definition's Overview tab with its BTC dataset and event count.* ## Events Every time the definition's setup happens, it records an event: the bar where it happened, plus whatever details the definition was written to record. The opening range definition records the direction of the break and how far price was from VWAP. Events are what everything else is built on. A study measures them, and a Forward Insight fires on them. [Browse events](https://docs.chartnaut.com/guides/browse-events) shows how to open any one of them on a chart and check it with your own eyes. ## Versions and profiles Every working change to a definition is saved as a new version. Events, studies and Forward Insights belong to the version they were made with, so changing the definition never quietly changes an answer you already have. A definition can expose settings, such as the length of the opening range. A profile is a named set of those settings for one version, with its own events and studies. Profiles let you compare a 15-minute range with a 30-minute one without copying the definition. [Versions and profiles](https://docs.chartnaut.com/guides/versions-and-profiles) covers both. ## Running over history A definition finds its events by running over past data. You pick the instrument, the chart interval and a date range, and Chartnaut runs the definition over every bar in it. Two years of BTC found 786 opening range breaks. Each run becomes a dataset on the definition's **Overview** tab, and you can add more instruments and ranges at any time. [Run a definition over history](https://docs.chartnaut.com/guides/run-over-history) walks through it. How many events you can keep depends on your plan, listed on [Definition events](https://docs.chartnaut.com/account/definition-events-limit). ## Studies A study asks a question of the events. How often did price reach the prior day's high? What came first, the target or the stop? Does it matter how far above VWAP the break started? Studies live on the definition's **Studies** tab. You ask the question in plain words and the agent writes the study, shows it to you for approval, and runs it over the datasets you pick. [Build and run a study](https://docs.chartnaut.com/guides/build-and-run-a-study) covers the whole process, including the **Guided**, **Collaborative** and **Technical** ways of working with the agent. ## Results A study's results are the numbers, tables and charts it publishes. For the opening range: bullish breaks from above the upper VWAP band reached the prior day's high 51 times in 61. Every result comes from events you can open and check. A strong percentage from a small group deserves a look at the events behind it before you trade on it. [Read the results](https://docs.chartnaut.com/guides/read-the-results) explains each kind of result and what to watch for. ![Study results](https://docs.chartnaut.com/captures/how-research-works-study-results.png) *Study results for BTC opening range breaks, split by the upper VWAP band.* ## Forward Insights A Forward Insight is a study's answer on the chart. You create one with **Put on chart** under a finished study's results. It is saved to your library, on the definition's **Forward Insights** tab, and shows on charts of its market and timeframe straight away. From then on the latest setup the definition marks shows the insight by itself: a label with its headline number and the outlook drawn ahead of the bar. The next BTC break above the upper band shows 51 in 61 on the bar where it happens. Clicking any mark, live or in a [replay](https://docs.chartnaut.com/guides/replay), opens the full card. [Forward Insights](https://docs.chartnaut.com/guides/forward-insights) covers creating and managing them, and [Forward Insights on the chart](https://docs.chartnaut.com/guides/forward-insights-on-the-chart) covers how they look while you trade. ## Definitions on the chart A definition does not have to be part of a study to be useful. Add it to a chart and it marks the setup as it happens, the same way it marked history. [Definitions on the chart](https://docs.chartnaut.com/guides/definitions-on-the-chart) explains how. ## Research and your own trading A study tells you what the market does. Your [playbooks](https://docs.chartnaut.com/guides/how-playbooks-work) tell you what you do with the same setup, and [Historical Intelligence](https://docs.chartnaut.com/guides/historical-intelligence) learns from your own trades. Together they show whether your version of the setup matches the market's. Definitions shared by other traders are in the [community library](https://docs.chartnaut.com/guides/community-library), ready to add to your library and run over your own history. --- # Build a definition URL: https://docs.chartnaut.com/guides/build-a-definition/ Updated: 2026-11-22T22:28:30Z Ask the Agent to build a definition or use the definition builder, then check its marks on real days before you measure anything. A [definition](https://docs.chartnaut.com/guides/how-research-works) is your setup written precisely enough for Chartnaut to mark it on a chart. You describe it in words, the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) writes the script, and you check its marks on real days before anything is measured. Free keeps 10 definitions. ## Ask the Agent The quickest way is to hand the whole idea to the Agent, especially when you want a question answered at the end of it. 1. Open **Agent** at the top of the sidebar. 2. Describe the setup the way you would to another trader. Name the instrument, the timeframe and exactly what counts: *Mark every 5-minute close outside the first 15-minute range of the New York session on BTC, and record whether price was above session VWAP.* 3. Read the **Plan proposal** card and click **Approve**, or tell it what to change. 4. The agent builds the definition and shows it on a **Result** card, with its marks drawn on a chart beside the chat. 5. Check the marks (see below), then click **Accept**. ![Result card with the definition's marks](https://docs.chartnaut.com/captures/build-a-definition-agent-result.png) *The agent's Result card beside the definition's marks on BTC.* If the definition needs an indicator such as VWAP, the agent asks first. See [Indicators inside definitions](https://docs.chartnaut.com/guides/indicators-inside-definitions). [Test your first trading idea](https://docs.chartnaut.com/guides/test-your-first-trading-idea) follows this route all the way to a finished study. ## Use the definition builder To work on the definition on its own, with the script and the chart side by side: 1. Open **Tools → Definitions** and click **New**. The page asks *What do you want to build?* 2. Type your description and press Enter, or click one of the *Suggested definitions* to start from it. 3. The builder opens: the agent's chat on the left, the **Editor** on the right. The agent writes the script and applies each change as it goes. A *Files updated* message confirms each one. 4. Open the **Chart** tab and check the marks. Use the arrows either side of the date to move a trading day at a time. 5. Tell the agent what is wrong, with the date, until the marks are right. ![Definition builder](https://docs.chartnaut.com/captures/build-a-definition-builder.png) *The definition builder with the chat on the left and the Chart tab on the right.* **Code** shows the script. **Problems** lists anything the checker flagged, **Errors** shows what stopped the script from running, and **Logs** shows what it printed. When something shows up there, ask the agent to fix it. To write the script yourself, click **Build it yourself** under the suggestions, give it a **Name**, and write the script in the builder's **Code** tab. Click **Save draft** when you are done. [Scripting](https://docs.chartnaut.com/scripting/overview) covers the language. ## Check the marks Every number you get later depends on these marks, so step through at least five sessions, including a quiet one and a busy one. - Each mark sits on the exact bar where the setup happened. - It never fires on a day when the condition was false. - It fires once per setup, and stays quiet on the bars that follow. When one is wrong, say what you saw and when: *On 12 March the mark fired at 9:40, before the range had finished forming.* ## Saving and versions Each working change is saved to the definition. If a change does not run, Chartnaut keeps it as a draft and says *Draft saved (not runnable yet)*: fix what **Problems** or **Errors** shows. Once events have been found or a study uses the definition, the next working change starts a new version, so nothing already measured changes under you. See [Versions and profiles](https://docs.chartnaut.com/guides/versions-and-profiles). To change a definition later, open it from **Tools → Definitions** and click **Open editor**. A definition marks the setup as soon as it is saved: add it to a chart to see it live, as in [Definitions on the chart](https://docs.chartnaut.com/guides/definitions-on-the-chart). To count how often it happened, [run it over history](https://docs.chartnaut.com/guides/run-over-history). How many definitions you can keep depends on your plan: 10 on Free and 50 on Pro. To hear when a definition fires on a live market, set a [definition alert](https://docs.chartnaut.com/guides/definition-alerts) on Pro. --- # Versions and profiles URL: https://docs.chartnaut.com/guides/versions-and-profiles/ Updated: 2026-11-22T22:28:30Z How a definition's versions keep your answers fixed, and how profiles let you study different settings side by side. A [definition](https://docs.chartnaut.com/guides/build-a-definition) keeps every working change as a version, and every set of settings you use as a profile. Together they make sure an answer you already have never changes because you edited the definition afterwards. ## Versions Every working change to a definition is saved to its newest version. While nothing depends on that version, each change rewrites it, so ten attempts at getting the marks right do not leave ten versions behind. Once something does depend on it, the next change starts a new version and the old one is frozen. A version is depended on once: - you have [run it over history](https://docs.chartnaut.com/guides/run-over-history) and it found events, or a run is in progress - a [study](https://docs.chartnaut.com/guides/build-and-run-a-study) or an [app](https://docs.chartnaut.com/guides/build-an-app) has used it Events, studies and [Forward Insights](https://docs.chartnaut.com/guides/forward-insights) all belong to the version they were made with. Fix a bug in the definition and your existing events still show what the old version found. Run the new version over history to get events from the fix. ## Look at an older version 1. Open the definition from **Tools → Definitions**. 2. Open the **Versions** tab. Each row shows *Version N*, when it was saved and what changed, with *Latest* on the newest and *AI* on the ones the agent made. 3. Click a version. The whole page switches to it: its datasets, studies and Forward Insights. The version picker beside the definition's name does the same, and shows which version you are looking at. Charts always use the latest version when you add the definition. ![Versions tab](https://docs.chartnaut.com/captures/versions-and-profiles-versions.png) *A definition's Versions tab with the newest version marked Latest.* ## Profiles A definition can expose settings, such as the length of the opening range or the distance that counts as far above VWAP. A profile is a named set of those settings for one version. Each profile is its own bucket. Its events, datasets, studies and runs stay with it, so a 15-minute range and a 30-minute range can be studied side by side without copying the definition. **Default** uses the settings written into the script. ## Make a profile 1. Open the definition and click the **Profile** picker above the tabs. 2. Click **New**. 3. Type a **Profile name**, such as `30-minute range`. 4. Change the settings you want to differ from the default. 5. Click **Save**. ![New profile dialog](https://docs.chartnaut.com/captures/versions-and-profiles-new-profile.png) *The New profile dialog with a name and the definition's settings.* Choose the profile in the picker and everything on the page follows it. Run it over history to give it events of its own. Profiles can only be added or edited on the latest version. On an older one the picker says *Frozen on this version*. When the definition moves to a new version, its profiles come with it. ## Change or remove a profile Click the edit button beside a profile in the picker to change its name or settings. **Default** cannot be edited. If the profile already has events or studies, Chartnaut warns *This profile is in use* before you save: click **Override anyway** only if you mean to replace its settings. The archive button beside a profile removes it from the list. When the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) wants to change a profile's settings, it asks first with a *Change "30-minute range"?* card, and only goes ahead when you click **Override**. ## When the numbers do not match If a study shows fewer events than you expect, check the version picker and the **Profile** picker first. Studies and datasets are shown for the version and profile you have selected, and the **Studies** tab can switch between *This profile* and *All studies*. --- # Run a definition over history URL: https://docs.chartnaut.com/guides/run-over-history/ Updated: 2026-11-22T22:28:31Z Run a definition over the instrument, interval and dates you choose to find every time its setup happened. A [definition](https://docs.chartnaut.com/guides/build-a-definition) only knows about the bars it has run over. Running it over history finds every time its setup happened on the instrument, interval and dates you pick, and keeps each one as an event. Those events are what [studies](https://docs.chartnaut.com/guides/build-and-run-a-study) measure: two years of BTC found 786 opening range breaks. The definition needs a saved version first. If it has none, its **Overview** tab says *Snapshot a version to get started*. ## Ask the Agent When the [Agent](https://docs.chartnaut.com/guides/how-the-agent-works) needs events to answer your question, it asks with a **Data collection proposal** card. It shows the *Instruments*, *Timeframe*, *Range* and *Profile* it wants to use. 1. Check the instrument, the interval and the dates. Two years is a good start for an intraday setup. 2. Click **Collect**, or say what to change in the chat. You can ask for it directly too: *Run the opening range definition over the last two years of ETH on 5-minute bars.* When it finishes, the agent tells you how many events it found. ## Run it yourself 1. Open the definition from **Tools → Definitions**. Check the version and **Profile** pickers: the run uses the ones selected. 2. On the **Overview** tab, find the *Datasets* card and click **Collect events**. Once a definition has datasets, the button reads **Collect more events**. 3. Under **Chart**, search for the instrument. 4. Under **Chart interval**, choose the bar size. If the script only runs on certain intervals, the rest are marked *not allowed*, or the interval is *Set by script*. 5. Under **Date range**, set **From** and **To**. The default is the last 5,000 bars the instrument has data for. 6. Click **Start**. ![Add collection dialog](https://docs.chartnaut.com/captures/run-over-history-dialog.png) *The Add collection dialog set to BTC, 5 minutes and two years.* The run carries on in the background, so you can leave the page. ## Follow the run The run appears under its instrument on the *Datasets* card, with its progress: *Waiting to start*, *Loading market data*, *Scanning*, a percentage with the time left, then *Done*. Click the cancel button beside it to stop it. Each instrument and interval becomes one dataset row, showing its event count, events per day and the dates it covers. Add a second range to the same instrument and interval and it joins that dataset. Run a range you have already covered and Chartnaut says *Already collected*; run one that overlaps and only the missing part is scanned. ![Datasets card](https://docs.chartnaut.com/captures/run-over-history-datasets.png) *The Datasets card with BTC and ETH datasets and their event counts.* Click a dataset row to look through its events: see [Browse events](https://docs.chartnaut.com/guides/browse-events). ## When it goes wrong | What you see | What to do | |---|---| | *Failed* or *Cancelled* on a run | Click **Try again**, or **Dismiss** to clear a run that collected nothing | | *No bars in this range (market closed)* | The dates fall on a weekend or holiday. Pick a range when the market was open | | *This chart doesn't have* a kind of data | The definition reads data, such as volume, that this instrument does not have. Pick another instrument | | *Your plan's collection limit was reached* | You have used your plan's events. Upgrade to collect more | Datasets can't be deleted. Everyone who can run the definition reads the same events, so they stay for all of them, and each event counts toward your plan once. To end a run that is still going, click **Stop collection** on it. How many events you can keep depends on your plan: 15,000 on Free and 150,000 on Pro. See [Definition events](https://docs.chartnaut.com/account/definition-events-limit). How far back you can go is on [Historical data](https://docs.chartnaut.com/account/historical-data). --- # Browse events URL: https://docs.chartnaut.com/guides/browse-events/ Updated: 2026-11-22T22:28:31Z Open a dataset's events, filter them by anything the definition recorded, and check each one on a chart. Once a [definition has run over history](https://docs.chartnaut.com/guides/run-over-history), every setup it found is an event you can open and check. Browse them before you trust a study: a study is only as good as the events it measures, and ten minutes of checking catches a definition that fires a bar early or on the wrong days. ## Open a dataset's events 1. Open the definition from **Tools → Definitions**. 2. On the **Overview** tab, find the *Datasets* card. 3. Click the dataset you want, such as BTC on 5 minutes. The events open in a table, with the count in the header: *786 events*. The page shows the events for the version and [profile](https://docs.chartnaut.com/guides/versions-and-profiles) selected on the definition. ![Events table](https://docs.chartnaut.com/captures/browse-events-table.png) *BTC opening range events in a table, with the Filters rail on the left.* ## What each column holds | Column | What it is | |---|---| | *When* | The bar the event happened on | | *Event* | Which event it is, for a definition that records more than one kind | | *Intent* | The label the script gives the event | | *TF* | The timeframe it was found on | | *Payload* | The details the definition recorded, such as the direction of the break and the distance from VWAP | Each detail in the payload also gets a column of its own. Use the column picker in the header to show or hide them. The table shows 50 events a page, or 100 if you switch it. ## Narrow them down The *Filters* rail on the left filters by **Event**, **Intent**, **Timeframe** and **Date range**. Under **Payload**, click **Add filter** to filter on any detail the definition recorded, such as only bullish breaks, or only breaks more than one band above VWAP. **Reset** clears them all. Filtering is the quickest way to find the events behind a surprising number. If a study says breaks from above the upper band reached the prior day's high 51 times in 61, filter to those 61 and look at the ten that did not. ## Check an event on the chart 1. Click an event. Its detail opens beside the table on the **Overview** tab, listing when and where it happened and everything in its payload. 2. Open the **Interactive** tab. A chart opens on the bar where it happened. 3. Check that the mark sits on the right bar and that the payload matches what you see. ![Event on the Interactive tab](https://docs.chartnaut.com/captures/browse-events-interactive.png) *One opening range break open on the Interactive tab.* If an event is wrong, the definition needs fixing. Open it with **Open editor**, tell the agent the date and what you saw, then run the new version over history. Your old events stay with the old version. See [Build a definition](https://docs.chartnaut.com/guides/build-a-definition). To watch the definition mark setups as they happen, add it to a chart: see [Definitions on the chart](https://docs.chartnaut.com/guides/definitions-on-the-chart). --- # Build and run a study URL: https://docs.chartnaut.com/guides/build-and-run-a-study/ Updated: 2026-11-22T22:28:31Z Ask the Agent a question about a definition's events, approve the study it writes and run it over your datasets. A study asks one question of a [definition's](https://docs.chartnaut.com/guides/how-research-works) events and answers it across every one of them: *How often did the break reach the prior day's high, and does it depend on how far above VWAP it started?* You ask in plain words, the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) writes the study, and nothing runs until you approve it. A study measures events the definition has already found, so [run the definition over history](https://docs.chartnaut.com/guides/run-over-history) first. The Agent offers to when they are missing. ## Ask the Agent 1. Open **Agent** at the top of the sidebar. 2. Ask the question, naming the definition and what you want measured: *Using my BTC opening range definition, how often did breaks reach the prior day's high before the day ended? Split it by distance from VWAP.* 3. Approve the **Plan proposal** card. If the definition has no events yet, a **Data collection proposal** card comes first: click **Collect**. 4. When the study is written, [Supervised](https://docs.chartnaut.com/guides/approvals) mode shows it first on a *Result* card with what the agent *Checked* and *Not checked*. Click **Accept**. In Autonomous mode there is no card for this step. 5. A **Study run proposal** card asks *Run the study on BTC?* and shows the *Instrument*, *Timeframe*, *Range*, *Events in scope* and *Profile*. Check the event count is what you expect, then click **Run**. 6. The chat shows the run's progress. When it finishes, a **Study results** card appears. Click **Open the full report** to see it beside the chat. ![Study run proposal](https://docs.chartnaut.com/captures/build-and-run-a-study-run-proposal.png) *The Study run proposal card with the instrument, range and events in scope.* Approving a run covers its scope. If the study hits a bug, the agent fixes the code and runs it again over the same events without asking a second time. [Test your first trading idea](https://docs.chartnaut.com/guides/test-your-first-trading-idea) follows this route from the first message to a [Forward Insight](https://docs.chartnaut.com/guides/forward-insights). ## Start from the definition 1. Open the definition from **Tools → Definitions** and open the **Studies** tab. 2. Click **New study**. A *Build a study* box opens with the definition already mentioned. 3. Type the question and click **Build**. The Agent opens with your message and works through the steps above. The study is filed under the definition. ## Run it on more markets Open a study from the definition's **Studies** tab. *Results by market* has one row per market with its latest numbers, and a row opens that market's report. To run it somewhere new, click **Run**: 1. Under *Markets*, click a suggested market or **Search markets**. 2. Under *Period*, choose **Latest year of data**, **All data** or **Custom**, and drag the handles for a custom period. 3. Open **Advanced** to change the timeframe or the study's parameters, when it has any. 4. Click **Run**. With several markets the button counts them, such as **Run on 3**. ![Run study dialog](https://docs.chartnaut.com/captures/build-and-run-a-study-builder.png) *The Run study dialog with its markets, period and Run button.* A market without events for that period says *Collection runs first*. The definition [runs over that history](https://docs.chartnaut.com/guides/run-over-history), then the study runs on its own. One run opens straight onto its report; several land in *Results by market*. ## Change a study The agent writes and changes study code. Under *Code* on the study, `study.js` is read-only. Click **Ask the agent for changes**, say what should change and click **Send**. The agent saves a new version, and your past runs stay as they are. [Scripting](https://docs.chartnaut.com/scripting/overview) covers how studies are written. ## Asking a good question - Name the outcome and the time limit: *reached the prior day's high before the session close*. - Say how to split it: by direction, by distance from VWAP, by day of week. - Ask for what happened first when both matter: *the 1R stop or the 2R target*. ## When it goes wrong - *This study doesn't read a definition yet, so there's nothing to run it on*: click **Ask the agent** and name the definition to use. - The Run study dialog says *None of these markets can run in this period*: click **Details** on a market for the reason, then change the period or the market. - A market says *Latest run failed*: click **Ask about this study** at the top and ask the agent what went wrong. Studies are kept on the definition's **Studies** tab. **All** shows every [profile's](https://docs.chartnaut.com/guides/versions-and-profiles) studies; pick the profile's name beside it to see only that profile's. How many studies you can keep depends on your plan: 50 on Free and 1,000 on Pro, on a definition or on your own [trades](https://docs.chartnaut.com/guides/ai-trade-search). How many runs can go at once is on [Runs at once](https://docs.chartnaut.com/account/runs-at-once). --- # Read the results URL: https://docs.chartnaut.com/guides/read-the-results/ Updated: 2026-11-22T22:28:31Z Where a study's results appear, what each kind shows, and how to judge a number by the sample behind it. A finished [study](https://docs.chartnaut.com/guides/build-and-run-a-study) publishes its answer as a set of results: headline numbers, tables, charts and short notes. This page covers where to find them, what each kind shows, and how to tell a result you can trade on from one that needs more events. ## Find the results - In the Agent, the **Study results** card appears in the chat when a run finishes. Click **Open the full report** to see it beside the chat. - In the study builder, the run card in the chat shows them under *Results* once the run has finished. A run over more than one dataset gives each its own tab, such as *BTC · 5m* and *ETH · 5m*, with the dates each one covered. Compare them before you trust a pattern: an edge that shows on BTC and not on ETH is worth a second look. ![Study report](https://docs.chartnaut.com/captures/read-the-results-report.png) *A study report for BTC opening range breaks, split by distance from VWAP.* ## What each result shows | Result | What it shows | |---|---| | Metric | One headline number, such as a hit rate of 64% | | Table | The answer broken down, one row per group, such as one row per VWAP band | | Line chart | How something changes over time or across bars after the event | | Histogram | How a value is spread across all events, such as how far each break travelled | | Box plot | The middle and the spread of a value for each group, side by side | | Bar chart and heatmap | Groups compared at a glance, or two splits at once | | Scatter | Each event as a dot, to see whether two values move together | | Note | What the study says about its own result, in words | Click **Expand** on any result to see it full screen. Tables use a few standard columns. *Events in row* is the sample behind that row. *Hit rate* is the share of those events that reached the target. *Median MFE* and *Median MAE* are how far price typically went in your favour and against you, and *Mean return* is the average result. Figures marked *(bp)* are in basis points: 100bp is 1%. ## Read the sample before the percentage Every number comes from a count of events, and the count decides how much the number is worth. Chartnaut does not flag a small sample for you, so read *Events in row* first. Take the opening range study. Breaks from above the upper VWAP band reached the prior day's high 51 times in 61. Sixty-one events is enough to take seriously. If the same 84% had come from 6 events, it would be three or four lucky days. A rough guide: - Under 30 events in a group, treat the number as a lead to test further. - A split where every group has a similar rate is telling you that split does not matter. That is a useful answer too. - A result that only holds in one year of a two-year run has probably found something about that year. Check it on the other dataset tabs and on more history. ## Check the events behind a number When a number looks too good, open the events behind it. In [Browse events](https://docs.chartnaut.com/guides/browse-events), filter the dataset to the same group, such as breaks from above the upper band, and step through the ones that failed. It is the quickest way to find a definition that marks the wrong bar. ## Ask a follow-up The study's chat stays open after the run. Ask the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) anything about the result, or ask for another split: *Split the same answer by day of week* or *Only count breaks in the first hour*. It updates the study and asks before it runs again. ## Put the answer on the chart When a result is worth acting on, click **Put on chart** under it to turn it into a [Forward Insight](https://docs.chartnaut.com/guides/forward-insights). The next time the setup happens, the chart shows this answer on that bar. If a run shows no results, it says *Run finished with no published results*. The study ran but published nothing: ask the agent to check what the study publishes. --- # Forward Insights URL: https://docs.chartnaut.com/guides/forward-insights/ Updated: 2026-11-22T22:28:31Z Put a study's answer on the chart as a Forward Insight, choose how it splits and manage it on the definition. A Forward Insight takes a [study's](https://docs.chartnaut.com/guides/build-and-run-a-study) answer and puts it on the chart, on the bar where the setup happens. The next time BTC breaks its opening range from above the upper VWAP band, you click the mark and read *51 in 61* there, instead of remembering a report you read last month. It works on a study that measures what happened after the event. A study that only looks at the bars before or during the event says so where the button would be. ## Put a study on the chart **Put on chart** sits under every study result: the *Study results* card in the [Agent](https://docs.chartnaut.com/guides/how-the-agent-works) chat, the full report, agent views, the study page, a run's page and the agent panel on **Trading → Charts**. It is the same whether the Agent ran the study or you did. 1. Click **Put on chart**. 2. *What should it show?* lists the numbers the study already measures. Pick the one you want on the chart, such as the rate of reaching the prior day's high, and click **Continue**. If you came from a results card, the number those results were about is marked *From your results*. Nothing is picked for you. 3. *Split it by* lists the ways the study splits its events, each with its groups and the size of the smallest, such as *Session · 3 groups · smallest 140*. Pick the ones that should change the reading, such as distance from VWAP. Leave it empty for one card for every event. When a group is small, it warns that its numbers will be shaky. 4. Click **Build it**. The agent fits the study to the chart while the sheet shows *Fitting it to your chart…*: it updates the study, runs it again and checks the numbers. This usually takes about a minute. 5. The last step shows the last setups one at a time, *‹ 1 of 5 ›*: the reading drawn over what really happened after each one. They are marked *From the research period*, because the study already counted them. Change the name if you want. 6. Click **Put on chart**. It is saved to your library and shows on the chart straight away. ![Put on chart sheet](https://docs.chartnaut.com/captures/forward-insights-wizard.png) *The Split it by step, with distance from VWAP picked and its groups counted.* On **Trading → Charts**, the preview draws on your chart, which switches to the study's market and timeframe if it needs to, with a button to switch back. Anywhere else it draws on a small chart inside the sheet. Before you click, the sheet tells you what will happen: - When another insight already shows for that definition on that market and timeframe, it names the one this replaces. - When every place your plan has for insights on charts is taken, pick one to replace, or click **Save without showing** to keep it in your library only. - When your library is full, it refuses to save. Remove an insight or upgrade. [Library limits](https://docs.chartnaut.com/account/library-limits) has the numbers. On Charts, the definition is added to the chart if it isn't there, and the latest setup shows the reading. Anywhere else, a confirmation says *On your chart* with the name, market and timeframe, and **Open chart** takes you there. Clicking one of the definition's events opens the card, and the [outlook](https://docs.chartnaut.com/scripting/outlooks) drawn ahead of the event when the study has one. **Insights** under the chart changes what a click opens, per insight. Building saves a new version of the study and a new run, and the Forward Insight is tied to that run. The run you started from is left as it was. You can also create one from the [API](https://docs.chartnaut.com/cli/api-create-insight) or a [connected AI app](https://docs.chartnaut.com/cli/mcp-overview), without the sheet. [From the API or an AI app](https://docs.chartnaut.com/scripting/chart-pins-overview#from-the-api-or-an-ai-app) covers what the study needs. ## What it is tied to A Forward Insight belongs to one [definition](https://docs.chartnaut.com/guides/how-research-works), one [version and profile](https://docs.chartnaut.com/guides/versions-and-profiles) of it, and the timeframe the study ran on. Saving one puts it in your library. It shows on charts where that definition is added with that profile, on that market and timeframe, while it is active, live and in [replay](https://docs.chartnaut.com/guides/replay). **Put on chart** makes it active. [Forward Insights on the chart](https://docs.chartnaut.com/guides/forward-insights-on-the-chart) covers switching which one shows and what the chart then shows. ## Manage your Forward Insights 1. Open the definition from **Tools → Definitions**. 2. Open the **Forward Insights** tab. Each row shows the name, the sample (*n=61*), the timeframe and how many readings it has. 3. Click a row to preview the card it shows on the chart and each of its readings with its own sample. 4. Click **Learn about this** to see all the study's published results, and **Open study** to go to the study. ![Forward Insights tab](https://docs.chartnaut.com/captures/forward-insights-tab.png) *A definition's Forward Insights tab with one insight expanded.* The tab lists the Forward Insights for the profile and version you have selected. When other versions have some too, click **All versions of** followed by the profile's name to see them. To remove one, click its trash button. It is archived and stops showing on the chart. To change one, put the study on the chart again with the split you want and archive the old one. ## Share a Forward Insight When sharing is on for your account, you can share a Forward Insight on a public or unlisted definition. People who add it see its card on their own charts of that definition, measured exactly as you measured it. They get the card and the code that matches events to it, never your study, its other versions or its runs. Sharing is refused, with the reason, when: - the definition is private. Make it public or unlisted first. - the study reads a definition or indicator other people can't get, or one that hides its code. Share it, with its code shown, first. - it was measured on your Rithmic data, which is licensed to you personally. - it was saved before Chartnaut kept its code. Re-save it, then share it. If the study's outlook draws with your own code, people who add the insight get the card only. Saving it again under the same name keeps it shared, so the people who added it get the new version. Stop sharing and it disappears from their charts; share it again and it comes back. Delete it while people still use it and it is retired instead: it keeps working for them, frozen, and nobody new can add it. ## Add someone else's A definition's **Forward Insights** tab lists the insights other people shared on it. Adding one also adds the definition, and anything its study reads, to your library, and puts the definition on your chart at the version and settings the insight was measured with. Insights you add don't count towards your plan's Forward Insight limit. ## When it goes wrong Where the button would be, a study that can't go on the chart says why: | What it says | What to do | |---|---| | *It doesn't measure what happens after the event.* | Click **Ask the agent to fix it**, then put the new run on the chart | | *This run is from before Chartnaut checked this. Run it again.* | Click **Ask the agent to run it again** | | *It isn't built on a definition, so it has no events to show on the chart.* | Click **Ask the agent** to build it on a [definition](https://docs.chartnaut.com/guides/how-research-works) | | *This run found no events.* | Run the study over a range where the definition has events | After you click it: - *This study doesn't publish a metric that can go on the chart yet*: ask the agent to add the number you want as a result, run the study again and put that run on the chart. - Building fails after three tries: nothing is saved. Go back and pick another number or split. - *The agent is still working*: wait for its turn to finish, then click **Put on chart**. - The chart says *No study pin on this chart yet*: the chart's timeframe is not the one the study ran on. Switch the chart to that timeframe. --- # Forward Insights on live events URL: https://docs.chartnaut.com/guides/forward-insights-on-live-events/ Updated: 2026-11-22T22:28:31Z Why a Forward Insight can show the wrong reading on a live event, and how Update fixes the study behind it. A [Forward Insight](https://docs.chartnaut.com/guides/forward-insights) shows the reading for the group an event belongs to, such as *far above VWAP* or *trend up into the break*. On a live event, that group has to be decided from what was known when the event fired. This page explains what goes wrong when a study decides it later, and how to fix it. ## How a study groups events When you pick a split under *Split it by* in **Put on chart**, the [study](https://docs.chartnaut.com/guides/build-and-run-a-study) sorts every event into a group and publishes one reading per group. Click an event on the chart and the popover shows the reading for its group, with the sample behind it. Over history, every event already has all the bars after it. A study can look at them while it decides the group, and its results still add up. ## Why a live event can get the wrong reading A live event has no bars after it yet. If the study decides the group from bars after the event, the chart has to decide without them, and it can put the event in a different group from the one the study would pick once those bars arrive. The popover then shows a real number, from the wrong group. Say the study groups opening range breaks by whether price held above VWAP for the next three bars. That is an outcome, not a setup. On a break that fired a minute ago, nobody knows yet, so the reading you see is a guess. The popover warns you with *This insight can be wrong on live events* and an **Update** button. ## What Update does **Update** opens the study with a request to the [Agent](https://docs.chartnaut.com/guides/how-the-agent-works): group each event using only what was known when it fired, such as the bars before it, indicator values up to that bar and earlier events. Anything the old grouping read from after the event becomes a column in the study's results instead, so you keep that answer in the full report. The readings on the chart stay the same kind of numbers. Each group's sample then counts exactly the events a live mark can land in. ## Need more chart history When the grouping needs data from before the event that the chart has not loaded, such as an indicator with no value yet, the popover says *Need more chart history*. Scroll back or wait for more data, then click the event again. Writing the grouping yourself is covered in [scope](https://docs.chartnaut.com/scripting/study-scope). --- # In sample and out of sample URL: https://docs.chartnaut.com/guides/in-sample-and-out-of-sample/ Updated: 2026-11-22T22:28:31Z What in sample and out of sample mean, explained for beginners, why it matters more than the percentage, and why a replay hides an insight until you pass the date its data ends. Every number on a [Forward Insight](https://docs.chartnaut.com/guides/forward-insights) was measured on a stretch of past market data. That stretch decides which setups can test the number and which can't. This page explains the difference, why it matters more than the percentage, and why Chartnaut hides an insight in a [replay](https://docs.chartnaut.com/guides/replay) until you pass the date its data ends. You don't need any statistics to follow it. ## Where an insight's number comes from Say you think BTC tends to reach the prior day's high after it breaks its opening range from above the upper VWAP band. Chartnaut answers that in three steps: 1. A [definition](https://docs.chartnaut.com/guides/how-research-works) marks every time that break happened. 2. You [run it over history](https://docs.chartnaut.com/guides/run-over-history), January 2024 to December 2025, and it finds 61 breaks. 3. A [study](https://docs.chartnaut.com/guides/build-and-run-a-study) checks what happened after each one. Price reached the prior day's high 51 times. Put that study on the chart and you have a Forward Insight that reads *51 in 61*, or 84%. Those 61 breaks are all the number knows about. ## In sample and out of sample The 61 breaks are the **sample**: the setups the number was measured on. - A setup **in sample** is one of those 61. Its result is already counted in the 51 in 61. - A setup **out of sample** is one the number has never seen. Its result played no part in the 84%. On a timeline it looks like this: ``` before the run the measured dates after the data ends ----------------|==========================================|----------------------> out of sample in sample out of sample ``` The setups after the data ends matter most, because every setup you will ever trade live is one of them. Think of a maths exam. Your teacher gives you a past paper with the answers, you learn it, and then the exam is that same paper. You score 100%, and the score says nothing about whether you can do maths. Sit a paper you have never seen and the score means something. An in-sample setup is the past paper. An out-of-sample setup is the new one. ## Why an in-sample number flatters you An in-sample number tends to look better than the idea really is, even when you are being honest. There are two reasons. **You kept it because it looked good.** Research is trying things. You test the break on its own, then above VWAP, then only in London, then only on Tuesdays, and you keep the version with the best number. Each change makes the number fit those particular 61 setups a little more closely, and tells you a little less about the next one. This is called overfitting, and it is the most common way a strategy looks great on paper and loses money. **Some of it is luck.** Have 20 people each flip a coin ten times, and on average one of them gets 8 or more heads. That person has no gift for coins. Their next ten flips will land around 5 heads like everyone else's. Test 20 filters on the same data and one of them will look brilliant in exactly the same way. In sample, the lucky filter and the good filter look identical. A small sample makes both worse, which is why you [read the sample before the percentage](https://docs.chartnaut.com/guides/read-the-results#read-the-sample-before-the-percentage). ## Why out of sample is so useful Nothing about the number could have been tuned to a setup it never saw, so out-of-sample setups are the only fair test of the idea. A real edge keeps showing up on them. A lucky one falls apart. Say the insight reads 84%, and these are two ways the next 24 breaks could go: | The next 24 breaks | Rate | What it tells you | |---|---|---| | 19 reached the high | 79% | Lower than 84%, which is normal. The idea held up on setups it had never seen | | 12 reached the high | 50% | Most of the 84% came from the sample. Don't trade on that number | Expect the out-of-sample rate to come in below the in-sample one. The question is whether enough of it survives to be worth trading. 24 setups is still a small count, so keep adding to it. ## Where Chartnaut shows it | Where | What you see | |---|---| | An insight's row in the picker and in your library | *Measured Jan 2024 – Dec 2025*, the dates of its sample | | The label on the chart | An amber **In sample** badge next to **Insight**, when the latest setup is one it measured | | The card when you click a mark | An amber note: *This setup is one of the 61 measured. The numbers include it, so it can't test them. Setups after 31 Dec 2025 can.* | | A kept outlook | An **In sample** tag on its frame, and on its row in the card | ![In-sample note on an insight card](https://docs.chartnaut.com/captures/in-sample-card-note.png) *The amber note on a setup the insight measured.* Live, Chartnaut hides nothing. You see every number, and the amber marks tell you which setups can't test it. [Forward Insights on the chart](https://docs.chartnaut.com/guides/forward-insights-on-the-chart) covers the rest of the card. ## Why a replay hides the numbers A replay only teaches you something if you don't know what comes next. You see the market as it was on a past day and make the call yourself. An insight measured over that same day breaks this. Replay a break from March 2025 with the insight showing, and you see 84% and an outlook drawn ahead of the bar. You take the trade and it reaches the high. Of course it does: that win is one of the 51 the number already counted, and the number was worked out from the bars you haven't been shown yet. Do that for a whole session and you finish with a great equity curve and a strategy that feels proven. All you have done is read the answers back to yourself, and the first real test comes with real money. So Chartnaut hides an insight in a replay until the replay passes the date its measurement ends. There is no setting to turn this off. That date falls a little after the end of the study's data, because the last setups in the study read the bars that came after them. It is the end of the data plus the furthest any event read ahead, rounded up to the next bar. | Where the replay is | What you see | |---|---| | Before the date | The definition keeps marking setups. The active insight is paused and reads *Starts 1 Jan 2026 in this replay*. A click on a mark shows no numbers and no outlook, and the card says why. The picker reads *Usable in this replay from 1 Jan 2026* | | Past the date, on a new setup | The numbers and the outlook show in full. This is a true out-of-sample test | | Past the date, on an older setup you click | The numbers show with the amber note. The replay is already past the end of the data, so they give nothing away | ![Replay message on an insight card](https://docs.chartnaut.com/captures/in-sample-replay-hidden.png) *An insight card in a replay before the date its data ends.* ## Leave some data to test on An insight measured right up to today has no history left to test on. You can only wait for new setups live. To keep a test set, stop the sample early: 1. When you [run the definition over history](https://docs.chartnaut.com/guides/run-over-history), set **To** several months before today. A two-year run ending six months ago leaves six months the insight has never seen. 2. Build your [study](https://docs.chartnaut.com/guides/build-and-run-a-study) on that run and put it on the chart. 3. [Start a session](https://docs.chartnaut.com/guides/start-a-session) with a **Fixed date** after the insight's *Measured* range ends, and open it in **Replay**. 4. Trade or tally each new setup, and compare your count with the insight's number. Two habits keep the test honest: - **Test once.** If the out-of-sample setups disappoint you and you go back to adjust the definition, they stop being out of sample. You made the change knowing how they turned out. Fresh setups are the only test left. - **Watch the date when you run it again.** A new run over newer data moves the sample forward, so setups that were a fair test become part of the measurement. Check the *Measured* range on the new insight. --- # Definition alerts URL: https://docs.chartnaut.com/guides/definition-alerts/ Updated: 2026-11-22T22:28:31Z Get a notification when a definition fires on a market. A Pro feature: 12 alerts at once, deep and 1-minute alerts included, more with an add-on. A definition alert tells you when a [definition](https://docs.chartnaut.com/guides/how-research-works) fires on a market, from now on, while Chartnaut is closed. Chartnaut runs the definition every time a bar closes and sends each new event to your phone. Alerts are part of Pro. ## Make an alert Ask the [Agent](https://docs.chartnaut.com/guides/how-the-agent-works), in your own words: *Tell me when my opening range break fires on BTC on 5m.* It needs three things: - **The definition**, one of your own or one in your library. - **The market**, any instrument with live data. - **The timeframe**: 1m, 5m, 15m, 30m, 1h, 2h, 4h, 1d, 1w or 1mo. You can also name a [profile](https://docs.chartnaut.com/guides/versions-and-profiles) to watch, or only some of the definition's events. The alert runs the version that is saved when you make it, so edits you save later do not change it. Asking for the same alert twice gives you the one you already have, and resumes it if it was paused. Each alert you set sends a push notification when it fires, such as *Opening range break fired on the bar that closed at 14:35 UTC.* Ask the Agent which alerts you have, what each noticed last, or to delete one. ## How many you can run | | Free | Pro | |---|---|---| | Definition alerts running at once | None | 12 | | Deep alerts | No | Yes | | Alerts on 1-minute bars | No | Yes | On Pro, each 5 alerts [add-on](https://docs.chartnaut.com/account/add-ons) adds 5 more. A deep alert counts as 3 of your 12. An alert is deep when every check does heavy work: it runs on 1-minute bars, or the definition uses other indicators, reads timeframes beyond the one it runs on, reads the volume tape, or needs more than 1,000 bars of warmup. Twelve light alerts, or four deep ones, fill Pro. At the cap a new alert is refused: *Your plan keeps alerts worth 12 active and yours use 12. Pause or delete one, or add an alerts add-on for more.* ## When an alert pauses An alert stops checking and tells you why, with an *Alert paused* notification, when: - your [definition events](https://docs.chartnaut.com/account/definition-events-limit) allowance is used up. Every event an alert notices counts against it. - it fires more than 100 times in one day. - its checks fail several times in a row. - the definition or its profile is gone. - Pro ends, or you remove an alerts add-on. The alerts you made first keep running and the newest pause. Paused alerts are kept. Once the cause is fixed, ask the Agent for the same alert again and it resumes. --- # How indicators work URL: https://docs.chartnaut.com/guides/how-indicators-work/ Updated: 2026-11-22T22:28:32Z Built-in and custom indicators, where they appear, how definitions use them, and the limits on each plan. An indicator is a value Chartnaut calculates bar by bar and draws on the chart: VWAP, RSI, ATR, an opening range box. Chartnaut comes with a set built in, and the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) builds any that are missing. Your own indicators live under **Tools → Indicators**. ## Built-in and your own Built-in indicators are ready to use on any chart. In the indicator picker they sit under **Native**, grouped as momentum, trend, volume, volatility and oscillator. Your own indicators are the ones you build or add. They sit under **Library** in the same picker: - **Mine** holds the indicators you built or added, next to your [definitions](https://docs.chartnaut.com/guides/how-research-works). - **Community** holds indicators other traders have shared. - **Create your own** links to the indicator and definition libraries, where you start a new one. ![Indicator picker](https://docs.chartnaut.com/captures/how-indicators-work-picker.png) *The indicator picker in Charts, with Native categories and the Library section.* ## Building your own Open **Tools → Indicators**, click **New** and describe what you want in plain words. The agent writes the script and shows it on a preview chart as it works, so you check the result on real days before you use it. Each working change is saved as a new version, listed on the indicator's **Versions** tab. To change it later, open it and click **Make a change**. [Build your own indicator](https://docs.chartnaut.com/guides/build-your-own-indicator) walks through a session VWAP with standard deviation bands from start to finish. [Build a custom indicator](https://docs.chartnaut.com/guides/build-a-custom-indicator) covers the builder in detail, and [Scripting](https://docs.chartnaut.com/scripting/overview) covers writing the code yourself. ## Where indicators appear On a chart in [Charts](https://docs.chartnaut.com/guides/how-charts-works), click **Indicator** in the toolbar, or right-click the chart and choose **Add Indicator**. [Indicators on the chart](https://docs.chartnaut.com/guides/indicators-on-the-chart) covers settings, hiding and removing them. Indicators also feed the rest of Chartnaut. A definition can read VWAP to know whether a break happened above it, and a study can measure how far price travelled in ATRs. When the agent needs an indicator inside a definition, it asks you with a card such as *Add VWAP?* before it uses it. [Indicators inside definitions](https://docs.chartnaut.com/guides/indicators-inside-definitions) explains how that works. Your own indicators can read other indicators too. A band indicator can build on a VWAP you already have, and the preview tells you when the indicator it depends on has no values yet. ## Limits on each plan | | Free | Pro | |---|---|---| | Custom indicators in your library | 10 | Unlimited | | Indicators on one chart | 5 | 15 | | Indicator memory | 2,500 bars | 5,000 bars | Indicator memory is how many bars of history an indicator can warm up on. A 200-bar average needs 200 bars behind it before its first value is settled, and your plan sets the most any one indicator can ask for. The per-chart count includes the indicators each one reads, so a band indicator built on VWAP counts as two. [Library limits](https://docs.chartnaut.com/account/library-limits), [Chart limits](https://docs.chartnaut.com/account/chart-limits) and [Indicator memory](https://docs.chartnaut.com/account/indicator-memory) cover each one. ## The community library Indicators other traders have shared are in the [community library](https://docs.chartnaut.com/guides/community-library). Add one to your library and use it on a chart or inside a definition like one of your own. You can share your own there too. --- # Build a custom indicator URL: https://docs.chartnaut.com/guides/build-a-custom-indicator/ Updated: 2026-11-22T22:28:32Z Build an indicator with the Agent or the indicator builder, or write it yourself, and manage its versions, sharing and limits. A custom [indicator](https://docs.chartnaut.com/guides/how-indicators-work) is a script that calculates a value on every bar and draws it: a session VWAP with bands, an opening range box, a relative volume histogram. You describe it, the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) writes it, and you check it on real days before it goes on your charts. [Build your own indicator](https://docs.chartnaut.com/guides/build-your-own-indicator) walks through one from start to finish; this page covers the options. ## Ask the Agent 1. Open **Agent** at the top of the sidebar. 2. Describe the indicator: what it calculates, when it resets and how it should look. *Build a session VWAP that resets at the New York session open, with bands at 1 and 2 standard deviations. Draw VWAP solid and the bands thinner.* 3. Approve the **Plan proposal** card. 4. The agent builds the indicator and shows it on a **Result** card. Open it, check it on a few days, then click **Accept**. The Agent suits an indicator that is one step in something bigger, such as a [definition](https://docs.chartnaut.com/guides/build-a-definition) that needs it. ## Use the indicator builder 1. Open **Tools → Indicators** and click **New**. The page asks *What do you want to build?* 2. Type your description and press Enter, or click one of the *Suggested indicators*, such as *Opening-range box* or *ATR percentile ribbon*, to fill in the box. 3. The builder opens with the agent's chat on the left and the **Editor** on the right. The agent writes the script and applies each change as it goes; *Indicator updated* confirms each one. 4. On the **Chart** tab, use the arrows either side of the date to step through quiet and busy days. 5. Tell the agent what is wrong, with the date, until it looks right. ![Indicator builder](https://docs.chartnaut.com/captures/build-a-custom-indicator-builder.png) *The indicator builder with the agent's chat and the Chart tab.* **Code** shows the script, **Errors** what stopped it from running and **Logs** anything it printed. ## Write it yourself Click **Build it yourself** under the suggestions, give the indicator a **Name** and, if you like, a description, then write the script in the **Code** tab. When you edit, *You have unsaved changes* appears with a **Save** button. A save that does not compile is still kept, and the chart goes on showing the last version that did. [Scripting](https://docs.chartnaut.com/scripting/overview) covers the language. ## Versions Each working change is saved to the indicator. The **Code** tab shows what happens to the next one: - *v3 not in use yet · changes rewrite it*: nothing uses version 3, so changes keep rewriting it. - *v3 in use · next change starts v4*: a chart, a study or a saved app uses version 3, so the next change starts version 4 and leaves version 3 as it is. A chart that already uses the indicator keeps the version it was added with. Every version is listed on the indicator's **Versions** tab, with *Latest* on the newest and *AI* on the ones the agent made. ## Manage it Click an indicator under **Tools → Indicators** to open it. **Overview** holds its description, **Preview Settings** the settings it exposes, and **Versions** every version. - **Edit** opens the builder again. **Make a change** on **Preview Settings** does the same. - The settings button beside the name renames it. - **Clone** makes a private copy for you to change. - The visibility control sets it **Private**, **Unlisted** (anyone with the link) or **Public** (listed in the [community library](https://docs.chartnaut.com/guides/community-library)). - **Delete** in the row's menu removes it from your library. Charts that use it need another indicator added in its place. ## When it goes wrong The **Chart** tab explains what stopped it, with a button to act on it: | Message | What to do | |---|---| | *Saved, but this script doesn't compile* | Click **Fix with agent** | | *Dependency output empty* | An indicator it reads has no values yet. Click **Diagnose with agent** | | *No market data* | The date is a weekend or holiday. Click **Nearest trading day** | Free keeps 10 custom indicators; Pro is unlimited. At the limit, creating another says *You have reached the Custom indicators limit for your plan*: delete one you no longer use, or upgrade. See [Library limits](https://docs.chartnaut.com/account/library-limits). --- # Indicators inside definitions URL: https://docs.chartnaut.com/guides/indicators-inside-definitions/ Updated: 2026-11-22T22:28:32Z How a definition reads indicator values, how to approve the ones the agent adds, and why the version it reads stays fixed. A [definition](https://docs.chartnaut.com/guides/build-a-definition) can read the values of any [indicator](https://docs.chartnaut.com/guides/how-indicators-work) on every bar. That is how the opening range definition knows whether a break happened above session VWAP, and how a study can measure a move in ATRs. The indicator can be a built-in one, one of your own, or one from the [community library](https://docs.chartnaut.com/guides/community-library). ## Let the agent add it Describe the condition in the definition's own terms and the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) works out which indicator it needs: *only mark breaks where the close is above session VWAP*. Before it uses one, it asks with a card such as *Add VWAP?*, naming the indicator. 1. Check it is the indicator you meant. If you built your own session VWAP, this is where to say so. 2. Click **Approve**. The card reads *Indicator added* and the agent carries on. To turn it down, click **Reject**, say what you want instead and click **Send reason**. The chat waits until you answer: *Approve or reject the indicator above to continue.* ![Add VWAP card](https://docs.chartnaut.com/captures/indicators-inside-definitions-approval.png) *The agent asking to add VWAP to a definition, with Approve and Reject.* When the indicator you want does not exist yet, [build it first](https://docs.chartnaut.com/guides/build-a-custom-indicator), then tell the agent its name. ## See what a definition uses 1. Open the definition from **Tools → Definitions**. 2. On the **Overview** tab, find *Script breakdown*. 3. Under *Dependencies*, each indicator is listed with the name the script calls it by and the version it uses, such as *as vwap* and *v2*. Click an indicator's name to open it. ![Script breakdown dependencies](https://docs.chartnaut.com/captures/indicators-inside-definitions-dependencies.png) *A definition's Script breakdown listing VWAP and ATR under Dependencies.* ## Versions stay fixed A definition names the exact version of each indicator it reads. Once a definition uses a version of your indicator, editing the indicator starts a new version and leaves that one as it was, so the definition's events do not change under you. To move the definition onto the new version, ask the agent to change the version it reads, then run the new version of the definition over history. See [Versions and profiles](https://docs.chartnaut.com/guides/versions-and-profiles). ## On the chart When you add a definition to a chart, the wizard's *Requires* step lists the indicators it brings with it. The indicators it brings count towards your plan's indicators per chart. See [Definitions on the chart](https://docs.chartnaut.com/guides/definitions-on-the-chart) and [Chart limits](https://docs.chartnaut.com/account/chart-limits). ## Opening one that uses indicators you do not have When you open a definition, or anything else, that reads indicators missing from your library, Chartnaut asks first: *Add to your library* lists what it needs. Click **Install and continue** and the page opens once they are added. If one of them was not shared with you, the page cannot open; ask the person who shared it to share that indicator too. To write the indicator calls into a script yourself, see [Scripting](https://docs.chartnaut.com/scripting/overview). --- # Build your own pages URL: https://docs.chartnaut.com/guides/build-your-own-pages/ Updated: 2026-11-22T22:28:32Z Describe a view once and the agent builds it onto every trade, journal day, backtest session, playbook, account or instrument, each showing that page's own data. Every trade, journal day, backtest session, playbook, account and instrument in Chartnaut can carry pages you design yourself. You describe what you want to see, the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) builds it, and from then on it sits on every page of that kind, working on that page's own data. That is a view. Ask for "How far did price run after I exited, in R?" on one trade, and every trade you open has the answer for that trade. ![A custom view open on a trade](https://docs.chartnaut.com/captures/build-your-own-pages-trade-view.png) *A trade with a custom view open as a tab beside Overview and Details.* ## Your questions, on the page Every trader has questions they keep asking about their own trading. Did I leave money on the table? Which hours cost me? Does this setup work better on BTC than on ETH? Usually the answer lives in a spreadsheet you update when you remember to. A view puts the question on the page where you would ask it. Write it once, and it answers again for every trade, every day and every session from then on, including the ones you have not taken yet. ## Where views go Six kinds of page take views. On trades, journal days and instruments a view is a tab, added with **+ View**. On backtest sessions, accounts and playbooks it is a report: open **Reports** and click **Create custom report**. | Page | Add it from | A view there works on | An idea to start with | |---|---|---|---| | [Trade](https://docs.chartnaut.com/guides/views-on-trades) | **+ View** in the trade's tabs | this trade | How far did price run after I exited, in R? | | [Journal day](https://docs.chartnaut.com/guides/views-on-journal-days) | **+ View** in the day's tabs | this day | Which hours of the day did I make or lose money? | | [Backtest session](https://docs.chartnaut.com/guides/views-on-backtest-sessions) | **Reports → Create custom report** | this session | Win rate and average R by hour of entry | | [Account](https://docs.chartnaut.com/guides/views-on-accounts) | **Reports → Create custom report** | this account | Drawdown by week, with my largest losing streak | | [Playbook](https://docs.chartnaut.com/guides/views-on-playbooks) | **Reports → Create custom report** | this playbook | Which symbols this playbook works best on | | [Instrument](https://docs.chartnaut.com/guides/views-on-instruments) | **+ View** on the instrument's page | this instrument | My results on this market by weekday | Each guide has more ideas for its page. ## One view, every page A view is written once and runs on whichever page you open it on. A drawdown view added to one account shows each account's own drawdown. A breakdown added to one playbook shows the playbook you are looking at. Views are yours. Adding one puts it on every page of that kind for you, and nobody else sees it on their pages. ![Custom reports listed on a playbook](https://docs.chartnaut.com/captures/build-your-own-pages-playbook-reports.png) *A playbook's Reports tab, with your views under Your custom reports.* ## Views and apps Views and [apps](https://docs.chartnaut.com/guides/build-an-app) are built the same way, by the agent, and both are listed in **Tools → Apps**. They differ in where they open. - A *view* is made for one kind of page and opens inside it, on that page's trade, day, session, playbook, account or instrument. - An *app* is a page of its own. You open it from **Tools → Apps**, and it shows whatever it was built to show: a pre-market briefing, a ranking of all your playbooks, a watchlist screener. Every view is an app that declares which kind of page it reads. [Build your first app](https://docs.chartnaut.com/guides/build-your-first-app) walks through a standalone one. ## Two ways to build Click **+ View** or **Create custom report**, describe the view and press **Build**. Chartnaut then asks *How should it be built?* - *Build it for me* is for simple, well-defined views: a table, a breakdown, one chart. The agent will build it on its own and add it to the page when it is ready. It is not live yet, so build with **Build it with me** for now. - **Build it with me** is for anything with several parts or custom logic. The app builder opens with your description already sent to the agent, previewing the page you came from. You watch it work, test it, steer it in the chat, and press **Publish** when it is right. One of the two is marked *Suggested*, based on how involved your description is. Tick **Don't ask again** and **Build** becomes a button for your chosen way, with the other one in its menu. [Add a view](https://docs.chartnaut.com/guides/add-a-view) covers both in detail. ![Choosing how a view is built](https://docs.chartnaut.com/captures/build-your-own-pages-build-choice.png) *The How should it be built? step with both options and Suggested.* ## Views other people built Under the description box, **Explore community views** lists the public views made for this kind of page. Each one previews on the page you are on, so you see it working on your own trade or day before you add it. Views you have already built for this kind of page are listed under *Your views*, one click to add. [Community views](https://docs.chartnaut.com/guides/community-views) has more. Every view and app declares what data it touches before it runs. [What views and apps can see and change](https://docs.chartnaut.com/guides/app-permissions) explains what that covers. ## Taking a view off On a trade, journal day or instrument, hover the view's tab and click its ×. On a report page, click the × on the view's row. It comes off every page of that kind and stays in **Tools → Apps**, so **+ View** lists it again under *Your views* whenever you want it back. ## Ideas worth building Start with the question you ask most often. A few that traders build first: - On a [trade](https://docs.chartnaut.com/guides/views-on-trades): where price went in the hour after you exited, measured in R. - On a [journal day](https://docs.chartnaut.com/guides/views-on-journal-days): your P&L by hour, next to how many trades you took in each. - On a [backtest session](https://docs.chartnaut.com/guides/views-on-backtest-sessions): win rate by weekday, to see whether the session's result leans on one day. - On an [account](https://docs.chartnaut.com/guides/views-on-accounts): how long each drawdown took to recover. - On a [playbook](https://docs.chartnaut.com/guides/how-playbooks-work): the trades where you broke a rule, and what they cost. - On an [instrument](https://docs.chartnaut.com/guides/views-on-instruments): your results on that market by session, London against New York. --- # Add a view URL: https://docs.chartnaut.com/guides/add-a-view/ Updated: 2026-11-22T22:28:32Z Start a view from + View or Create custom report, build it with the agent, and change or remove it later. You add a view from the page it belongs on. Describe what you want to see, the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) builds it with you in the app builder, and it appears on every page of that kind. [Build your own pages](https://docs.chartnaut.com/guides/build-your-own-pages) explains what a view is, and [Add your first view](https://docs.chartnaut.com/guides/add-your-first-view) walks through one from start to finish. A view is an app, so it counts against your plan's apps: 5 on Free and 15 on Pro. The agent runs on [AI credits](https://docs.chartnaut.com/guides/ai-credits) or [your own AI subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription). ## Where to start | Page | Click | |---|---| | Trade, journal day, instrument | **+ View** at the end of the page's tabs | | Backtest session, account, playbook | **Reports**, then **Create custom report** at the top of the list | Both open the same box, *Build a custom view*, with an example for that page as its placeholder. ## Build it with the agent 1. Type what you want to see, naming the numbers, how to group them and the chart you want. 2. Press **Build**. Chartnaut asks *How should it be built?* 3. Click **Build it with me**. ![How should it be built](https://docs.chartnaut.com/captures/add-a-view-choose.png) *The How should it be built? step, with Build it with me suggested.* The app builder opens with your description sent to the agent, and the preview set to the page you came from. 1. Wait while *Working* shows above the preview. 2. Open the **App** tab and check the numbers against what you know of that page. 3. Click **Preview as** and pick another trade, day or session to see the view on different data. 4. Ask for changes in the chat until it is right. The agent builds and checks the view, and leaves publishing to you. Press **Publish** in the builder when the preview looks right, and again after any change you make in **Code**. Until the first publish, your view's tab opens on *Ready to publish* with a **Publish** button, or on *Not built yet* with **Open in builder** if nothing compiles yet. **Build it for me** sits on the same step. It is for simple views the agent will finish on its own, and it is not live yet: choosing it shows a notice and builds nothing. One of the two options is marked *Suggested*. Ticking **Don't ask again** skips the step next time and turns **Build** into a button for the way you picked, with **Ask me each time** in its menu. Tick it on **Build it with me**. ## Add a view you already have Under the box, *Your views* lists the published apps in your library that fit this kind of page and are not on it yet, including ones added from Community. Click one to add it. **Explore community views** opens views other traders have shared: see [Community views](https://docs.chartnaut.com/guides/community-views). Trades, journal days, backtest sessions, accounts and playbooks all hand a view a set of trades. A trade hands over itself, a set of one. So a view built on any of them fits the rest. Build *Win rate by hour of entry* on a playbook and it is offered on accounts too, working on that account's trades. ![Create custom report on a playbook](https://docs.chartnaut.com/captures/add-a-view-report-row.png) *The add-a-view box opened from Create custom report on a playbook.* ## Change or take off a view To change a view, open **Tools → Apps**, open the view's menu and click **Open editor**. Ask the agent for the change. Every page shows the new version once it is published. To take a view off, hover its tab and click ×, or click × on its row under *Your custom reports*. It comes off every page of that kind and stays in **Tools → Apps**. Views cannot be reordered on a page. ## When it goes wrong - *This app needs data collected first* on the view: it reads a definition's events that have not been gathered for these trades. [What views and apps can see and change](https://docs.chartnaut.com/guides/app-permissions) explains the choice. - A trade view shows an error on an open trade: trade views read closed trades only. --- # Views on trades URL: https://docs.chartnaut.com/guides/views-on-trades/ Updated: 2026-11-22T22:28:32Z What a view on a closed trade can read, and six views worth building on your trades. A view on a trade answers a question about one closed trade, and answers it again for every trade you open. It sits as a tab beside **Overview** and **Details** in the [trade detail](https://docs.chartnaut.com/guides/trade-detail) pane. The same view works on a set of trades too. [Add it](https://docs.chartnaut.com/guides/add-a-view) to a journal day, backtest session, account or playbook and it runs on their trades. ![A view on a trade](https://docs.chartnaut.com/captures/views-on-trades-tab.png) *A trade's tabs with a custom view open beside Overview and Details.* ## What it works on The view is handed the trade you are looking at: its symbol, side, entry and exit prices, open and close times, and the R it made, along with the session, playbook and instrument it belongs to. From there it can read the rest of your data around that trade: - the market's bars before, during and after the trade - the trade's fills and orders - how far it went for you and against you while it was open, in R and in money - your notes, tags and custom fields - a [definition's](https://docs.chartnaut.com/guides/how-research-works) events on that market Trade views read closed trades only. ## Ideas worth building Each of these is a description to type into **+ View**. - `How far did price run after I exited, in R? Show the furthest point in my direction in the hour after the exit, and when it got there.` Tells you whether you are leaving money on the table. - `Show the best and worst R this trade reached while it was open, next to the R I closed it at.` Your heat and your give-back on one line. - `Was I tilting before this trade? List my five trades before it with their results and the minutes between each.` Catches revenge trades after a loss. - `Where did my entry sit in the day's range and in the first hour's range, as a percentage?` Shows whether you buy highs and sell lows. - `Did my London sweep of the Asia high fire on this market in the hour before my entry?` Checks the trade against your own [definition](https://docs.chartnaut.com/guides/build-a-definition). - `Replay this trade on the chart with my indicators.` The price action around the trade, drawn inside the tab. ## Adding one 1. Open **Trading → Trades** and click a closed trade. 2. Click **+ View** in its tabs. 3. Describe the view, press **Build** and choose **Build it with me**. [Add a view](https://docs.chartnaut.com/guides/add-a-view) covers the rest, and [Add your first view](https://docs.chartnaut.com/guides/add-your-first-view) builds the first idea above step by step. --- # Views on journal days URL: https://docs.chartnaut.com/guides/views-on-journal-days/ Updated: 2026-11-22T22:28:32Z What a view on a journal day can read, and six views worth building on your trading days. A view on a journal day works on the trades you closed that day, and every day in the [daily journal](https://docs.chartnaut.com/guides/daily-journal) gets its own answer. It sits as a tab beside **Journal** and **Trades**. ![A view on a journal day](https://docs.chartnaut.com/captures/views-on-journal-days-tab.png) *A journal day's tabs with a custom view open beside Journal and Trades.* ## What it works on The view is handed the day's date and the trades closed on it, counted in your own time zone as the journal counts them, with the symbols you traded that day. Each trade carries its symbol, side, prices, times, R, P&L, session and playbook. It can also read the market's bars for that day, your notes and tags, and the rest of your trade history, so a day can be set against the days before it. A day hands a view a set of trades, the same as a backtest session, an account and a playbook do. A view you build here is offered under *Your views* on those pages as well. ## Ideas worth building Each of these is a description to type into **+ View**. - `Which hours of the day did I make or lose money? Show P&L by hour next to how many trades I took in each.` Finds the hour that costs you. - `My P&L through the day as a line, with each trade marked where it closed.` The shape of the day at a glance. - `How many trades did I take after my first loss, and what did they make in total?` Shows whether the day went wrong after the first red trade. - `Compare today's win rate and average R with my last 20 trading days.` Tells you whether today was normal. - `Group today's trades by symbol, with R and P&L for each.` For days you trade several markets. - `Show BTC's range today against its 20-day average range, and how much of it my trades caught.` Separates a quiet market from a slow trader. ## Adding one 1. Open **Trading → Journal** and pick a day you traded. 2. Click **+ View** at the end of the day's tabs. 3. Describe the view, press **Build** and choose **Build it with me**. The builder previews the view on the day you came from. Use **Preview as** to check it on a busy day and a quiet one. [Add a view](https://docs.chartnaut.com/guides/add-a-view) covers the rest. --- # Views on backtest sessions URL: https://docs.chartnaut.com/guides/views-on-backtest-sessions/ Updated: 2026-11-22T22:28:32Z What a view on a backtest session can read, and six reports worth building on your sessions. A view on a backtest session works on the trades you took in that session. It is listed as a report under *Your custom reports*, beside the built-in [session reports](https://docs.chartnaut.com/guides/session-reports), and every session you open gets its own answer. ![A custom report on a session](https://docs.chartnaut.com/captures/views-on-backtest-sessions-reports.png) *A session's Reports list with Your custom reports at the top.* ## What it works on The view is handed the session's closed trades and the session itself: its name, starting balance, when you started and ended it, and the stretch of market time it replayed. Each trade carries its symbol, side, prices, R, P&L and the simulated times it opened and closed, so hour and weekday breakdowns use the market's clock, not the day you practised. It can also read the market's bars over the session's window, your notes and tags, and the playbook the session was collecting for. A session hands a view a set of trades, the same as a journal day, an account and a playbook do. A view you build here is offered under *Your views* on those pages too. ## Ideas worth building Each of these is a description to type after **Create custom report**. - `Win rate and average R by hour of entry.` Shows which part of the session your edge lives in. - `Win rate by weekday, to see whether this session's result leans on one day.` A good result carried by two Mondays is worth knowing about. - `Equity curve from the starting balance, with the largest drawdown marked and how many trades it took to recover.` The path behind the final number. - `My R distribution, and which trades make the tail.` Tells you whether a few big winners carry the session. - `Split the session into first half and second half, with expectancy for each.` Checks whether you got better or tired as you went. - `Compare this session's expectancy with my live trades on the same playbook.` Tests whether practice matches the real thing. ## Adding one 1. Open **Tools → Backtest** and open a session. 2. Open **Reports** and click **Create custom report**. 3. Describe the view, press **Build** and choose **Build it with me**. [Add a view](https://docs.chartnaut.com/guides/add-a-view) covers the rest. For how sessions work, see [How backtesting works](https://docs.chartnaut.com/guides/how-backtesting-works). --- # Views on playbooks URL: https://docs.chartnaut.com/guides/views-on-playbooks/ Updated: 2026-11-22T22:28:33Z What a view on a playbook can read, and six reports worth building on your setups. A view on a [playbook](https://docs.chartnaut.com/guides/how-playbooks-work) works on every trade filed under it, live and backtest. It is listed as a report under *Your custom reports*, beside the built-in [playbook reports](https://docs.chartnaut.com/guides/playbook-reports), and each playbook you open gets its own answer. ![A custom report on a playbook](https://docs.chartnaut.com/captures/views-on-playbooks-reports.png) *A playbook's Reports list with Your custom reports at the top.* ## What it works on The view is handed the playbook's closed trades and the playbook itself: its name, description and trade count. Each trade carries its symbol, side, prices, times, R, P&L, the account or session it came from, and the notes, tags and custom fields you gave it. It can also read the market's bars for the symbols those trades are on, and a [definition's](https://docs.chartnaut.com/guides/how-research-works) events on those markets. A playbook hands a view a set of trades, the same as a journal day, a backtest session and an account do. A view you build here is offered under *Your views* on those pages too. ## Ideas worth building Each of these is a description to type after **Create custom report**. - `Which symbols this playbook works best on, with expectancy and trade count for each.` Tells you where to take the setup and where to leave it. - `Expectancy and win rate by session, London against New York.` Finds the session the setup belongs to. - `The trades where I broke one of this playbook's rules, and what they cost in R.` Puts a number on discipline. - `My backtest trades against my live trades on this playbook, side by side.` Shows whether the live results match the practice. - `My streaks on this playbook, and what happens after a loss.` Tells you whether to stop after two losers. - `Hold time against R: do my quick exits cost me?` For setups you cut early. ## Adding one 1. Open **Trading → Playbooks** and open a playbook. 2. Open **Reports** and click **Create custom report**. 3. Describe the view, press **Build** and choose **Build it with me**. [Add a view](https://docs.chartnaut.com/guides/add-a-view) covers the rest. --- # Views on accounts URL: https://docs.chartnaut.com/guides/views-on-accounts/ Updated: 2026-11-22T22:28:33Z What a view on an account can read, and six reports worth building on your accounts. A view on an account works on every trade closed on that account. It is listed as a report under *Your custom reports* on the account's **Reports**, and each account you open gets its own answer: a drawdown view added to your prop account shows your demo account's drawdown when you open that one. ![A custom report on an account](https://docs.chartnaut.com/captures/views-on-accounts-reports.png) *An account's Reports list with Your custom reports at the top.* ## What it works on The view is handed the account's closed trades and the account itself: its label, currency, broker, status, equity and margin. Each trade carries its symbol, side, size, prices, times, R, P&L and playbook. It can also read the market's bars for the symbols you traded, your notes and tags, and the account's fills and orders. See [How accounts work](https://docs.chartnaut.com/guides/how-accounts-work) for what an account holds. An account hands a view a set of trades, the same as a journal day, a backtest session and a playbook do. A view you build here is offered under *Your views* on those pages too. ## Ideas worth building Each of these is a description to type after **Create custom report**. - `Drawdown by week, with my largest losing streak.` The two numbers a funded account lives or dies by. - `How long each drawdown took to recover, and where I am in the current one.` Tells you how deep the current hole is compared with the ones you climbed out of. - `A daily P&L calendar for this account, with the worst day each month marked.` A month on one screen. - `My largest position size each week, next to that week's result.` Shows whether size goes up after wins or after losses. - `Results by playbook on this account, with expectancy and trade count.` Finds the setup that pays for the rest. - `Average loss against average win, month by month.` Catches losses creeping up before the balance shows it. ## Adding one 1. Open **Trading → Accounts** and open an account. 2. Open **Reports** and click **Create custom report**. 3. Describe the view, press **Build** and choose **Build it with me**. [Add a view](https://docs.chartnaut.com/guides/add-a-view) covers the rest. --- # Views on instruments URL: https://docs.chartnaut.com/guides/views-on-instruments/ Updated: 2026-11-22T22:28:33Z What a view on an instrument can read, and six views worth building for the markets you trade. A view on an instrument works on one market, such as BTC or GOLD, and answers again for every instrument you open. It sits as a tab beside **Home** on the instrument's page. To open an instrument's page, press ⌘K (Ctrl+K on Windows) or click **Search** in the sidebar, type the symbol and pick the instrument. ![A view on an instrument](https://docs.chartnaut.com/captures/views-on-instruments-tab.png) *An instrument page with a custom view open beside Home.* ## What it works on The view is handed the instrument: its symbol and tick size. It reads the rest itself: - the market's bars, on whichever timeframes it needs - your own trades on that symbol - [indicators](https://docs.chartnaut.com/guides/how-indicators-work) worked out on those bars - a [definition's](https://docs.chartnaut.com/guides/how-research-works) events on that market Unlike the other five pages, an instrument view is about the market first and your trading second, so it suits dashboards you check before trading it. ## Ideas worth building Each of these is a description to type into **+ View**. - `My results on this market by weekday.` Shows the days you should sit out. - `Seasonality by hour and weekday over the last year.` When this market moves, and when it does not. - `My history on this instrument: every trade, its R, and the running total.` Your whole record on one market. - `The average range of the Asia, London and New York sessions over the last 60 days, with today's so far.` Tells you whether today is a big day or a quiet one. - `An indicator dashboard across timeframes: trend on the 5m, 1h and daily, and where price sits against VWAP.` A pre-trade check in one tab. - `How often my opening range break definition fired here in the last three months, and what followed.` Your research, per market. ## Adding one 1. Open the instrument's page. 2. Click **+ View** beside **Home**. 3. Describe the view, press **Build** and choose **Build it with me**. The builder previews the view on the instrument you came from; **Preview as** switches it to another. [Add a view](https://docs.chartnaut.com/guides/add-a-view) covers the rest. --- # Build an app URL: https://docs.chartnaut.com/guides/build-an-app/ Updated: 2026-11-22T22:28:33Z Build a page of your own with the agent or from Tools → Apps, publish it, open it and share it. An app is a page of your own in **Tools → Apps**: a monthly review, a ranking of your playbooks, a watchlist board. It shows whatever it was built to show, across all your data, where a [view](https://docs.chartnaut.com/guides/build-your-own-pages) shows one trade, day or report at a time. [Build your first app](https://docs.chartnaut.com/guides/build-your-first-app) walks through one from start to finish. Free builds 5 apps and Pro 15. The [agent](https://docs.chartnaut.com/guides/how-the-agent-works) builds it, on [AI credits](https://docs.chartnaut.com/guides/ai-credits) or [your own AI subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription). ## Ask the agent 1. Open **Agent** at the top of the sidebar. 2. Describe the page you want to open each morning, for example: `Build me a monthly review comparing this month's expectancy and drawdown with the last three months.` 3. If the agent sends a *Plan proposal* card, read it and click **Approve**. 4. When the agent finishes, a *Result* card marked *App* appears. Click **Open** to see the app beside the chat. 5. Check a number or two against what you know, ask for changes in the chat, then click **Accept**. [Approvals](https://docs.chartnaut.com/guides/approvals) explains each card. ## Or start from Tools → Apps 1. Open **Tools → Apps** and click **New app**. The page asks *What should this app show?*, with *Suggested apps* such as *Playbook ranking* and *Drawdown recovery* underneath. 2. Type your description, or pick a suggestion, and press Enter. ![The new app page](https://docs.chartnaut.com/captures/build-an-app-new.png) *The new app page with its Suggested apps.* The app builder opens with your description sent to its agent. To write the code by hand instead, click **Build it yourself** under the suggestions, give the app a name and click **Create**. It starts from a working skeleton you edit. ## The builder The chat is on the left and the app on the right, in four tabs: | Tab | What it shows | |---|---| | **App** | The app drawn on your real data | | **Code** | The files the agent writes. You never have to edit them | | **Details** | Warnings, what the app can change, and what it has collected | | **Logs** | How each panel's numbers were worked out, step by step | **Run** draws the app from the code as it stands, unsaved edits included. **Publish** compiles it, checks what it references and stores a new version; the dialog ends on *Published version N*. The agent publishes as the last step of a build once its checks pass, so press **Publish** yourself after editing **Code**. The builder saves as you go. [The builders' agents](https://docs.chartnaut.com/guides/builder-agents) covers what the chat can do. ## Reference data in an app An app can show the same reference data your scripts read: the economic calendar, rates and yields, [options levels](https://docs.chartnaut.com/guides/research-with-options-levels) and option chains. Ask for it in plain words, such as `A card with today's SP500 call wall, put wall and gamma flip` or `A list of next week's high-importance US and euro-area releases`. In the **Code** tab the agent reads it with `reference`, using the same filters as [`dataset(...)`](https://docs.chartnaut.com/scripting/datasets) except that an app names its instrument: ```ts import { reference } from "@canvas/data"; export const levels = reference("options.eod.levels", { where: { instrument: "SP500", view: "combined" }, lookback: "5d", }); ``` Each row is shown as it stood when you opened the app, so a forecast revised later or tomorrow's levels never appear early. Reference data refreshes every five minutes whatever the app's refresh setting. Each person who opens the app needs the plan for that dataset, listed on [Datasets by plan](https://docs.chartnaut.com/account/datasets-by-plan): below it, the panel says which plan it needs and the rest of the app still works. The same data also works as lines on a chart and inside reports. Ask for things like `SP500 15-minute returns grouped by gamma regime` or `How often price touched the call wall within an hour of a high-importance release`. The agent attaches the dataset to the chart's timeline: ```ts const sp = timeline.market({ id: "sp", tf: "15m", range: last("120d") }); const L = sp.attachReference(levels); export const callWall = L.last.callWall; ``` Every bar reads the value that was published before that bar closed, the same value an indicator reading the dataset plots on that bar. A bar before the data begins is blank, never zero. Your trades can carry it too. Ask for `My win rate by gamma regime at entry, per playbook` or `Trades entered within an hour of a high-importance release`. Each trade reads the data as it stood at its own entry, so a trade at 9:49 New York sees the previous day's levels and one at 9:51 sees that morning's. Fills, orders, definition events, sessions and instruments work the same way, each at its own moment. Two more shapes cover the questions traders ask most: - **Weeks and months.** `High-importance releases and options expiries per week` counts what fell inside each week and marks the third-Friday expiry weeks. - **Event studies.** `How SP500 moves in the two hours after CPI, split by gamma regime` lines every release up on one axis, starting from the release bar, using the levels published before each release. ## Using an app Click its row in **Tools → Apps** to open it. The header has **Refresh** to redraw it with current data, **Edit** to go back to the builder, and **Data** for what the app has collected. The row's label shows how it refreshes: *Manual*, *Live*, or an interval such as *Every 5m*. The row's menu holds **Open app**, **Open editor**, **Clone**, **Rename** and **Archive**. ![An app's menu in Tools → Apps](https://docs.chartnaut.com/captures/build-an-app-row-menu.png) *An app's row menu in Tools → Apps.* ## Sharing it Each app starts *Private*, seen only by you. The visibility control on its row switches it to **Unlisted**, for anyone with the link, or **Public**, to list it in Community. People who add it see their own data in it, never yours. [Community library](https://docs.chartnaut.com/guides/community-library) covers publishing, and [What views and apps can see and change](https://docs.chartnaut.com/guides/app-permissions) covers what an app can reach. --- # What views and apps can see and change URL: https://docs.chartnaut.com/guides/app-permissions/ Updated: 2026-11-22T22:28:33Z What views and apps can read and change, the data they ask to collect, and where to check before adding one. Every [view](https://docs.chartnaut.com/guides/build-your-own-pages) and [app](https://docs.chartnaut.com/guides/build-an-app) declares what it reads and what it can change before it runs, and Chartnaut holds it to that list. This page explains what those declarations cover, where to read them, and the one question an app can ask you when it opens. ## What an app reads An app reads your own data and nobody else's. When you open an app someone else built, it runs on your trades, your accounts and your journal, and none of it goes back to the person who wrote it. They see their data in it, and you see yours. An app can read: - your trades, positions, orders and fills - your accounts, backtest sessions, playbooks and tags - notes and custom fields on your trades - market data for the symbols it names - reference data: the economic calendar, rates and options data, as [your plan](https://docs.chartnaut.com/account/datasets-by-plan) allows - the events of [definitions](https://docs.chartnaut.com/guides/how-research-works), and the indicators and studies it runs from the library A read the app has not declared is refused, so an app cannot reach past its list. ## What an app can change Most apps only read. An app that writes can do three things to your trades: set their tags, set their notes, and set their custom fields. It declares which, and nothing else is open to it: it cannot place orders, delete trades or touch your accounts. An app that can change your data shows *Writes* in its header while you use it. Hover it to see what it can change. The app makes its writes through its own controls, such as a button that tags a trade, and Chartnaut does not ask you to confirm each one. Check the declarations below before you add an app that writes. ## Collecting data before it opens Some apps need a definition's events gathered around your trades before their numbers mean anything, or a study run over them. When that has not happened yet, the app stops on *This app needs data collected first*, listing each dataset under *Required data* with its markets, span and size. ![Data needed before an app opens](https://docs.chartnaut.com/captures/app-permissions-consent.png) *The screen asking to collect data before an app opens.* - **Collect and open** gathers the data and then opens the app. Collecting runs once and is included in your plan. - **Open without it** opens the app straight away, with blanks wherever that data is needed. The answer is remembered for that page of the app, and you are asked again only when the app starts needing something new. To change your mind, open **Data** in the app's header: it lists what was collected for the app, with **Reset for this page** and **Reset all** to be asked again. ## Where to read the declarations Before adding an app from Community, open it and choose the **Data it touches** tab. It shows: | Section | What it lists | |---|---| | *Access it declares* | **Can read** and **Can change**, the data the app is allowed to use | | *Data it reads* | Each of your datasets it reads, in plain words | | *Market data* | The symbols and timeframes it uses | | *Library scripts it runs* | Indicators, definitions and studies it attaches, and whether each is pinned to a version | | *What it remembers* | Anything it stores for you, which survives a republish and stays if you remove the app | | *Writes it can make* | Each change it can make to your data | ![Data it touches](https://docs.chartnaut.com/captures/app-permissions-data-tab.png) *An app's Data it touches tab in Community.* For an app of your own, the builder's **Details** tab shows the same facts about what it can change and what it has collected. [Community views](https://docs.chartnaut.com/guides/community-views) covers adding someone else's view to your pages. --- # Community views URL: https://docs.chartnaut.com/guides/community-views/ Updated: 2026-11-22T22:28:33Z Find public views for a page, try them on your own data, add them, and share your own. Community views are [views](https://docs.chartnaut.com/guides/build-your-own-pages) other traders have built and made public. You try each one on your own trade, day or report before adding it, so you see it working on your data, not a screenshot of theirs. ## Find one for this page 1. Open a page that takes views: a trade, journal day or instrument, or the **Reports** of a backtest session, account or playbook. 2. Click **+ View**, or **Create custom report** on a report page. 3. Click **Explore community views** under the description box. *Community views* lists every public view made for that kind of page. A view for a set of trades fits trades, journal days, sessions, accounts and playbooks alike, so the same view turns up on all five. Each card shows its name, description, author and how many people have added it. Search by name, description or author in the box at the top. ![Community views](https://docs.chartnaut.com/captures/community-views-list.png) *Community views for trades, with search and the view cards.* ## Try it on your data Click a card. The view opens *Previewing on this trade* (or this day, session, account, playbook or instrument), drawn on the page you came from with your own data. If the view needs data gathered first, it asks before drawing: see [What views and apps can see and change](https://docs.chartnaut.com/guides/app-permissions). Check a number you know. Click the back arrow to try another. ![A community view previewed on a trade](https://docs.chartnaut.com/captures/community-views-preview.png) *A community view previewed on your own trade, with Add to this page.* ## Add it 1. Click **Add to this page**. 2. If the view uses other pieces, such as someone's indicator, a dialog lists them first. Confirm it, then click **Add to this page** again. The view goes into your library and onto every page of that kind, only for you. It sits in **Tools → Apps** beside your own work, and **+ View** lists it under *Your views* on the other pages it fits. ## Views you add are the author's A view added from Community is still its author's. You cannot edit it, and it updates when they publish a new version. To make it your own, open **Tools → Apps**, open the view's menu and click **Clone**: you get a copy you can change with **Open editor**. Taking it off a page works like any view: click the × on its tab or report row. It stays in your library until you remove it there. ## Nothing fits yet *Nothing shared yet* means no one has published a view for that kind of page. **Build your own** takes you back to the description box. **Browse the community** opens Community on its **Apps** tab, where [Community library](https://docs.chartnaut.com/guides/community-library) explains searching and adding. ## Share one of yours Open **Tools → Apps** and set your view's visibility to **Public** on its row. It then shows in *Community views* on every page of its kind, for anyone. People who add it run it on their own data, and none of theirs comes back to you. --- # How the agent works URL: https://docs.chartnaut.com/guides/how-the-agent-works/ Updated: 2026-11-22T22:28:33Z What the agent builds, Supervised and Autonomous modes, the approval cards, the builders' own agents, and running it on credits or your own subscription. The agent builds the pieces of Chartnaut for you from a description in plain words. Open **Agent** at the top of the sidebar, say what you want, and it writes the code, checks it against real market data and hands the result to you to approve. ## What it can build | Ask for | What you get | Example | |---|---|---| | An [indicator](https://docs.chartnaut.com/guides/how-indicators-work) | Values drawn on the chart, bar by bar | A session VWAP with ±1σ and ±2σ bands that reset at the New York session open | | A [definition](https://docs.chartnaut.com/guides/how-research-works) | Your setup, marked every time it happened in history | A London sweep of the Asia high that fails to hold | | A [study](https://docs.chartnaut.com/guides/build-and-run-a-study) | What followed every one of those events, measured | How often New York opening-range breaks on ETH continue or fail back inside | | A [Forward Insight](https://docs.chartnaut.com/guides/forward-insights) | A study's answer on the chart as the setup forms | Put the opening-range study on BTC charts | | An [app](https://docs.chartnaut.com/guides/build-an-app) or [view](https://docs.chartnaut.com/guides/build-your-own-pages) | A page of your own, or a tab on every trade, day or report | A pre-market briefing of overnight moves and what you still hold | It also searches your library, so "find my fair-value-gap studies" works as a request. The examples on the **Agent** page are a good place to start. It can answer questions about your results too: "which session has the most consistent win rate across my last ten runs?" It runs a short program over your data and keeps what it works out, so the next question builds on the last. [Work with your data](https://docs.chartnaut.com/guides/work-with-your-data) covers it. One request can cover several pieces. Ask for a study of London sweeps and the agent writes the definition, runs it over history, builds the study and runs it, asking you at each point that needs a decision. ## Supervised and Autonomous Next to the model picker in the chat box is a coloured capsule that sets how closely the agent checks in with you. - **Supervised** walks you through each step on the charts, so you can correct a mistake as it happens. The agent shows you each piece before anything uses it: a definition before it runs over history, a study before its run. New conversations start here. - **Autonomous** suits easier tasks the agent is likely to get right first time. It works through to your goal and shows you the finished result. Supervised costs a click where it matters most. A definition that marks the wrong bars is caught before it runs over years of data, and before a study is built on top of it. If you change mode while the agent is working, the new mode applies from its next turn. ![Choosing Supervised or Autonomous](https://docs.chartnaut.com/captures/how-the-agent-works-supervision.png) *The mode capsule open, showing the Supervised and Autonomous cards.* ## Approval cards When the agent needs a decision it stops and shows a card in the chat. Nothing on the card happens until you act on it. | Card | What it asks | Your answer | |---|---|---| | Plan | The steps it intends to take, and what done means | **Approve** | | Question | Something it needs to know from you | Pick an option or type an answer | | Data | The instruments, timeframe and profile a definition will run over | Approve to run it | | Profile override | Whether to change a profile that existing results depend on | **Override** | | Study run | The instrument, timeframe and number of events in scope | **Run** | | Result | The finished indicator, definition or app, with what it checked and what it did not | **Accept**, or **Open** to look first | To ask for a change instead, type it in the chat. The card keeps your reply on record, and the agent carries on from it. Study results arrive as their own card with **Put on chart** and **Open the full report**, and a Forward Insight you put on the chart shows *On your chart*. [Approvals](https://docs.chartnaut.com/guides/approvals) covers each card. ![A plan waiting for approval](https://docs.chartnaut.com/captures/how-the-agent-works-plan-card.png) *A plan card in the chat with its steps and the Approve button.* ## The builders' own agents Each builder has an agent of its own in its chat: the indicator builder, the definition builder, the study builder and the app builder. Each one works on the single thing open in front of you, with its code and its preview beside the chat. Use **Agent** for work that spans several pieces, and a builder's chat to refine one. [The builders' agents](https://docs.chartnaut.com/guides/builder-agents) explains the differences. ## What it costs Agent work uses [AI credits](https://docs.chartnaut.com/guides/ai-credits), which you buy separately from your [plan](https://docs.chartnaut.com/start/plans). How they are billed is covered in [your account docs](https://docs.chartnaut.com/account/ai-credits-billing). In [Chartnaut Desktop](https://docs.chartnaut.com/start/chartnaut-desktop) you can run the agent on an AI subscription you already pay for. Open **Settings → AI providers** in the sidebar and connect your Claude subscription, your ChatGPT subscription through Codex, or both. Chartnaut's AI then runs on that subscription instead of credits, and the page shows how much of its 5-hour and weekly allowance you have used. [Use your own AI subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription) walks through it. --- # Work with your data URL: https://docs.chartnaut.com/guides/work-with-your-data/ Updated: 2026-11-22T22:28:33Z Ask the agent questions about your study results: it runs a program over your data, keeps what it works out as files, and builds on them. The agent can answer questions about your results by writing a short program and running it over your data. Ask it in plain words, the way you would ask an analyst: it pulls the runs it needs, does the arithmetic, and tells you the answer with the numbers behind it. ## What to ask | Ask | What the agent does | |---|---| | Across all runs of my London sweep [study](https://docs.chartnaut.com/guides/build-and-run-a-study), which session has the most consistent win rate? | Reads every run, compares each session's win rate run to run, and ranks them by how much they move | | At which holding period does the edge in my forward-returns study disappear? | Lines up the result at each holding period and finds where it stops holding | | Compare my last two runs of the same study. What got better and what got worse? | Exports both runs, joins them result by result, and reports the changes | | Has this setup been getting weaker? Split the runs by month. | Groups the runs by month and shows the trend | | Find every result across my last 20 runs with a high win rate and fewer than 30 trades. | Filters every run's results and lists the ones that look too good to trust | It works from the results your studies have already published. Starting a new study run still goes through its [approval card](https://docs.chartnaut.com/guides/approvals). ## Files the agent keeps What the agent works out is saved as files in the conversation, so it can build on them instead of starting again. Ask for a breakdown, then ask it to split that by long and short: it reads the breakdown it saved and adds to it. Each file records what made it: which run it was exported from, or which earlier file it was worked out from. Ask "what have we saved so far?" to see the files, their sizes and where each came from. Files belong to the conversation they were made in. They stay while the conversation is in use, and are cleared after 30 days without use. A cleared file leaves a note saying what it was, so the agent can rebuild it from the same runs when you come back. ## What you see in the chat Each time the agent runs a program, the chat shows a **Code** row with the first line it printed and the files it wrote. Open the row to see the full output. Two warnings can appear on the row: - **A read failed and the program carried on.** One of the runs could not be read, so the answer may leave it out. The agent says which, and the files it wrote are marked as incomplete until it runs again. - **Older files evicted to make room.** Your saved files reached your plan's space, so the oldest ones from your least recently used conversations were cleared. Each one leaves a note saying how to rebuild it. ## Limits Saved files count against your plan's agent workspace space, and each program has a time and size limit of its own. The numbers for each plan are on [Agent workspace](https://docs.chartnaut.com/account/agent-workspace). Each program also takes one of your [runs at once](https://docs.chartnaut.com/account/runs-at-once) while it runs. --- # Approvals URL: https://docs.chartnaut.com/guides/approvals/ Updated: 2026-11-22T22:28:33Z Every card the agent stops on, the button that answers it, and how to ask for a change instead. When the [agent](https://docs.chartnaut.com/guides/how-the-agent-works) needs a decision it stops and puts a card in the chat. Nothing on the card happens until you act on it. This page covers every card, its button, and what happens after you press it. ## Approving, or asking for a change Each card has one button to go ahead. To ask for something different, type it in the chat box and send it: the card is sent back with your message on it, and the agent carries on from there. On a *Question* card, what you type is your answer. If two cards are waiting at once, the chat box cannot tell which one you mean. Use the buttons on the cards. Once you decide, the card folds into one line saying what it was about and what you chose, such as *Plan approved* or *Sent back for changes*, with anything you typed. Click it, or **Show decision**, to open the card again. ## The cards | Card | What it shows | Button | What happens next | |---|---|---|---| | *Plan proposal* | The steps the agent will take, and what *Done means* | **Approve** | It starts work | | *Question* | Something only you can answer, with options | An option, or type your own | It carries on with your answer | | *Data collection proposal* | The instruments, timeframe, date range and profile a [definition](https://docs.chartnaut.com/guides/how-research-works) will [run over](https://docs.chartnaut.com/guides/run-over-history) | **Collect** | The definition runs over that history | | *Profile override proposal* | A [profile](https://docs.chartnaut.com/guides/versions-and-profiles) change, and how many datasets, study runs and studies depend on the profile | **Override** | The profile changes in place | | *Study run proposal* | The instrument, timeframe, range and events in scope for a [study](https://docs.chartnaut.com/guides/build-and-run-a-study) | **Run** | The study runs, with its progress in the chat | | *Result* | The finished indicator, definition or app, with what the agent *Checked* and *Not checked* | **Accept**, or **Open** to look first | It keeps the piece and moves on | ![A data collection proposal](https://docs.chartnaut.com/captures/approvals-collection-card.png) *A Data collection proposal card with its instruments, range and Collect.* ## What each one is for *Plan proposal* sets out the work before the agent starts. Read *Done means*: it is what the agent will check before calling the job finished. *Data collection proposal* and *Study run proposal* start work over history, so the agent asks before either in both modes. Check the instrument and the dates. A study run approval covers that scope, so if the agent fixes its code and runs again on the same scope, it does not ask twice. *Profile override proposal* comes up when the agent wants to change settings that existing results were made with. Overriding can leave saved Forward Insights and study results out of step with the chart. If you would rather keep them valid, reply asking for a new profile instead. *Result* puts what the agent built beside the chat when you click **Open**, so you can check it on a chart or on real data. Read *Not checked* before accepting: it is what you still need to look at yourself. ![A result card](https://docs.chartnaut.com/captures/approvals-result-card.png) *A Result card for a definition, with Checked, Not checked, Open and Accept.* ## Cards that only tell you something - *Study run* shows the run's progress while it works: *Queued…*, *Loading data…*, *Running the study…*, then *Study run complete* with how many events it processed. - *Study results* arrives when a run finishes. **Put on chart** on the card turns the answer into a [Forward Insight](https://docs.chartnaut.com/guides/forward-insights), and **Open the full report** shows it beside the chat. - A Forward Insight you put on the chart is confirmed in the chat: *On your chart*, with its name, market and timeframe, and **Open chart**. One saved without showing says *Saved*. ## Supervised and Autonomous In **Supervised**, the agent shows each piece with a *Result* card before anything uses it: a definition before it runs over history, a study before it runs. In **Autonomous**, it stops for data collection, study runs and questions, and shows the finished result at the end. [How the agent works](https://docs.chartnaut.com/guides/how-the-agent-works) explains choosing between them. --- # The builders' agents URL: https://docs.chartnaut.com/guides/builder-agents/ Updated: 2026-11-22T22:28:34Z The agents in the indicator, definition and app builders, what each asks before changing, and the preview's agent buttons. Each builder in Chartnaut has an agent in its chat, working on the one thing open in front of you. The [indicator](https://docs.chartnaut.com/guides/build-a-custom-indicator), [definition](https://docs.chartnaut.com/guides/build-a-definition) and [app](https://docs.chartnaut.com/guides/build-an-app) builders all put the chat on the left and the code and preview on the right, so you watch each change land. Use **Agent** in the sidebar for work that spans several pieces, such as an idea taken from definition to study to chart. Use a builder's chat to shape one piece until it is right. [How the agent works](https://docs.chartnaut.com/guides/how-the-agent-works) covers the main agent. ## Talking to a builder's agent On a new piece the chat box asks you to describe it, and once there is code it asks *What should change?* Describe the change with specifics: a date, a bar, a number you expected. Type @ in the chat box to hand the agent context from your library, such as another indicator, a definition, a playbook or a trade. The model picker in the chat box sets which model does the work, and each message runs on [AI credits](https://docs.chartnaut.com/guides/ai-credits) or [your own AI subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription), the same as the main agent. ## How each builder handles changes | Builder | Code changes | Asks you before | |---|---|---| | Indicator | Applied straight to the code | Using an indicator from your library | | Definition | Applied straight to the code | Using an indicator from your library | | App | Applied straight to the code | Nothing: it publishes once its checks pass | In the indicator and definition builders, each edit shows as a line in the chat listing the files it changed. When the agent wants to use an indicator from your library, it asks with an *Indicator proposal* card: *Add VWAP?*, with the settings it chose. **Approve** adds it; **Reject** opens a box for what should change. A [study](https://docs.chartnaut.com/guides/build-and-run-a-study) has no builder chat. **Agent** writes it, and in Supervised mode shows each new version on a *Result* card before running it. Every run waits for a *Study run proposal*. [Approvals](https://docs.chartnaut.com/guides/approvals) covers both cards. In the app builder, the agent writes the code and checks the app on real data. It never publishes: press **Publish** when the preview looks right. **Preview as** shows a view on a different trade, day or report while you talk it through. ## Asking the agent about the preview When the preview hits a problem, a banner above it names it, often with a button that hands it to the agent: - **Fix with agent** on a runtime error, a script too heavy to run, or a preview with no visible output. - **Diagnose with agent** when the preview is waiting on data, or an indicator the script depends on returns nothing. - **Ask agent** on other warnings in the definition builder. The button sends the banner's details to the chat, so the agent starts from the error itself instead of your description of it. ![A preview banner with Fix with agent](https://docs.chartnaut.com/captures/builder-agents-fix-banner.png) *A preview error banner with Fix with agent.* When you open a piece that belongs to someone else with **Try it out**, the banners show without these buttons. --- # AI credits URL: https://docs.chartnaut.com/guides/ai-credits/ Updated: 2026-11-22T22:28:34Z What AI credits pay for, what a message costs, and how to check and top up your balance. AI credits pay for the AI in Chartnaut: the [agent](https://docs.chartnaut.com/guides/how-the-agent-works), the [builders' chats](https://docs.chartnaut.com/guides/builder-agents) and every other chat in the app. You buy them separately from your [plan](https://docs.chartnaut.com/start/plans), they never expire, and each message you send spends a little of them. They work the same on every plan, Free included. In [Chartnaut Desktop](https://docs.chartnaut.com/start/chartnaut-desktop) you can skip credits altogether by running the AI on a Claude or ChatGPT subscription you already pay for. See [Use your own AI subscription](https://docs.chartnaut.com/guides/use-your-own-ai-subscription). ## What a message costs Each message is charged for the work the model does on it, so the cost depends on the model you pick and how much the message involves. A long agent turn that reads code, runs checks and writes a definition costs more than a one-line question. The model picker in the chat box shows each model as *Low cost*, *Medium cost* or *Higher cost*, with its dollar price per typical query, worked out from one ordinary analysis turn. One credit is $0.01, so a query priced at $0.05 spends 5 credits. ## Check your balance 1. Open the menu under your name and click **Subscription**. 2. Find *AI credits*. *Available* is what you have left, with how much you used in the last 30 days underneath. ![AI credits balance](https://docs.chartnaut.com/captures/ai-credits-balance.png) *The AI credits balance on the Subscription page, with Add credits.* For the detail, scroll to *Usage & billing* and open **AI usage**. It shows credits used, messages and conversations for the period you pick, a daily chart of credit cost, and usage by model. Messages that ran on your own subscription are counted under *On your subscription*, with no credits spent. ## Add credits 1. On **Subscription**, click **Add credits** beside your balance. 2. Pick a package, or type an amount under *Custom*. 3. Check the *Summary*, then click **Purchase**, which shows the total you get. 4. Pay on the checkout page that opens. ![Add credits](https://docs.chartnaut.com/captures/ai-credits-add.png) *The Add credits dialog with packages, custom amount and summary.* The packages are 500, 1,000, 2,500, 5,000 and 10,000 credits. From 2,500 up, each one shows its bonus credits under the amount, and the *Summary* adds them to the total. Payment is handled by PayProGlobal. [AI credits billing](https://docs.chartnaut.com/account/ai-credits-billing) covers pricing and bonuses in full, and **Transactions** under *Usage & billing* lists every purchase. ## Running out When your balance reaches zero, chats show *No AI credits remaining.* above the chat box, with an **Add credits** link to the Subscription page. You can still type, but a message on credits will not go through until you top up. Messages on your own AI subscription carry on as normal. The chat box does not show your balance as you work. Check it on **Subscription** before a long session with the agent. --- # Use your own AI subscription URL: https://docs.chartnaut.com/guides/use-your-own-ai-subscription/ Updated: 2026-11-22T22:28:34Z Run Chartnaut's AI on your own Claude or ChatGPT subscription in Chartnaut Desktop, without spending credits. If you already pay for Claude or ChatGPT, Chartnaut Desktop can run its AI on that subscription instead of [AI credits](https://docs.chartnaut.com/guides/ai-credits). The [agent](https://docs.chartnaut.com/guides/how-the-agent-works), the [builders' chats](https://docs.chartnaut.com/guides/builder-agents) and every other chat work the same; the requests count against your subscription's own limits, and no credits are spent. This works only in [Chartnaut Desktop](https://docs.chartnaut.com/start/chartnaut-desktop), because your provider sign-in stays on your own computer, where a browser cannot reach it. In the browser, the page explains this and offers nothing to connect. To work the other way round, from inside claude.ai or ChatGPT, [connect them to Chartnaut over MCP](https://docs.chartnaut.com/cli/mcp-overview). ## Connect a subscription 1. In Chartnaut Desktop, open **Settings → AI providers** in the sidebar. 2. Beside **Claude** or **Codex**, click **Connect**. Codex is how a ChatGPT subscription connects. 3. The first time, a dialog explains the arrangement before anything starts, including that providers intend subscriptions for their own apps and that any enforcement falls on your provider account. Confirm it to go on. 4. Sign in with the provider in the browser window that opens. The button reads *Waiting for browser…* until you finish. ![AI providers](https://docs.chartnaut.com/captures/use-your-own-ai-subscription-providers.png) *Settings, AI providers, with Claude connected and its usage meters.* When it is done, the row shows your account as *Connected*, and Chartnaut switches that subscription on for its models. ## Choose which models use it The switch lives in the model picker in any chat box, not on the settings page. The picker has a column per provider, and the *Anthropic* and *OpenAI* columns each carry a switch beside the name. - Switched on, the column reads *On your Claude subscription* (or ChatGPT), and each model it serves shows *On your subscription · no credits*. A model it cannot serve shows *Not served by your subscription*. - Switched off, the column reads *Uses Chartnaut credits*. ![The model picker's subscription switch](https://docs.chartnaut.com/captures/use-your-own-ai-subscription-picker.png) *The model picker with the Anthropic column switched to your subscription.* Each provider is set separately, so you can run Claude models on your subscription and other models on credits. ## Watching your allowance Under each connected account on **AI providers**, two meters show how much of your *5h* and *weekly* allowance you have used, with when the weekly one resets. They appear once you have sent a message on the subscription. **AI usage** on the Subscription page counts messages that ran on your subscription under *On your subscription*. ## More than one account **Add account** connects a second account for the same provider. **Use this** switches which one serves, and **Disconnect** removes one from this computer. To revoke access completely, sign out with the provider as well. ## What stays where Your provider sign-in is stored on this computer only. Chartnaut never receives it and keeps no record of which account you use. Your conversations still go through Chartnaut, which is how chats are saved and how the AI reaches your charts and studies. ## When it goes wrong - *Chartnaut Desktop isn't running* or *Claude isn't connected* in the model picker: open Desktop, or click **Connect** there to go to **AI providers**. - With Desktop closed, models switched to your subscription stop working. They do not fall back to credits; switch the column off to use credits. - The account says it is signed out: click **Disconnect** on it, then **Connect** and sign in again. - *Rate limited by the provider*: you have hit your subscription's limit. Wait for it to reset, or switch the column off to carry on with credits. --- # Community library URL: https://docs.chartnaut.com/guides/community-library/ Updated: 2026-11-22T22:28:34Z Browse Discover, add indicators, definitions and apps to your library, clone them to make them yours, and choose who sees your own work. Community is where people using Chartnaut share what they build: [indicators](https://docs.chartnaut.com/guides/how-indicators-work), [definitions](https://docs.chartnaut.com/guides/how-research-works) and [apps](https://docs.chartnaut.com/guides/build-an-app). You can add anything published there to your own library, copy it to make it yours, and publish your own work for others. To open it, go to **Tools → Apps**, **Tools → Definitions** or **Tools → Indicators** and click the **Community** tab at the top of the list. Each one opens Community on its own kind. ## Discover The first tab, **Discover**, is the front page. It is laid out in sections: - *Featured today*: picked by hand, and changes daily. - *Recently updated*: the newest work across apps, definitions and indicators. - *Browse by theme*: themes such as Liquidity, Structure, Volume & VWAP, Sessions & time and Risk & review. A theme gathers all three kinds, so Liquidity brings back sweep definitions, liquidity indicators and apps about stop runs together. - *Apps*, *Definitions* and *Indicators*: the latest of each kind, with a link to see them all. - *People publishing*: authors ranked by how much of their work they have shared. Click one to see everything they have published. ![The Discover tab](https://docs.chartnaut.com/captures/community-library-discover.png) *Community's Discover tab with Featured today and Browse by theme.* ## Searching and browsing The other tabs list one kind each: **Apps**, **Definitions** and **Indicators**, with **Everything** for all three in one list. Narrow any of them to a theme, search with *Search everything published…*, and sort by **Best match**, **Most installed**, *Recently updated*, **Newest** or **Name**. Click anything to open it. You see the same detail its author sees, without the author's controls: the description, what a definition marks, the inputs an indicator takes, its versions, and for an app, the data it reads. ## Adding to your library 1. Open the item in Community. 2. Click **Add to library**. If it depends on other pieces, such as an app that uses someone's indicator, a dialog lists them first. Pieces under *Added to your library* come with it. Anything already built into an app shows under *Already inside this canvas*, and anything the author has not shared shows under *We can’t add these*. Once it is added, the button reads **Open**, and the item sits in your own library beside your own work. **Remove from library** takes it out again. ![An app open in Community](https://docs.chartnaut.com/captures/community-library-detail.png) *A community app's detail with the Add to library button.* ## Cloning An item you added is the author's. To change it, clone it: **Clone** makes your own editable copy, which you can open in its builder and change as you like. Indicators and definitions show **Clone** on their detail when the author allows copies. Apps have **Clone** in their row's menu in **Tools → Apps**. ## Views from Community Views are apps made for one kind of page, and they are shared the same way. On a trade, journal day or instrument, click **+ View**; on a session, account or playbook, click **Create custom report** under **Reports**. Then **Explore community views** lists the public views that fit that page and previews each one on it before you add it. See [Community views](https://docs.chartnaut.com/guides/community-views). ## Publishing your own Each indicator, definition and app you own has a visibility setting, shown by an icon on its row in the library and on its detail. A new app starts **Private**. | Visibility | Who can see it | |---|---| | **Private** | Only you | | **Unlisted** | Anyone with the link. Use **Copy link** to share it | | **Public** | Everyone, listed in Community | 1. Open the library the item is in. 2. Click its visibility setting. 3. Choose **Public**. It appears in Community for others to find and add. For an app, **Publish** in the app builder and visibility are two separate steps. **Publish** stores a new version of the app. Visibility decides who can open it. [Build an app](https://docs.chartnaut.com/guides/build-an-app) covers the builder. ## From the CLI or API The same library is searchable outside the app. `chartnaut library search` finds your own scripts, Chartnaut's built-ins and the community's public indicators and definitions, and `chartnaut library show` describes one: its settings, outputs and events, never its code. [Search the library](https://docs.chartnaut.com/cli/api-search-library) covers the API call. Another author's indicator or definition runs from the CLI, the API or an AI app only once it is in your library, the same rule as in the app. `chartnaut library add bob/vwap-bands` adds it: like the dialog, it lists the scripts it needs and asks before adding them, and `chartnaut library remove` takes it out again. From the API it is [Add to your library](https://docs.chartnaut.com/cli/api-add-to-library), and an AI app connected over [MCP](https://docs.chartnaut.com/cli/mcp-overview) shows you the list and asks before it adds anything. --- # Overview URL: https://docs.chartnaut.com/scripting/overview/ Updated: 2026-11-22T22:28:34Z This section is the code reference for indicator, definition and study scripts: every declaration, hook and ctx call, with examples you can paste into a builder's Code tab. This section is the code reference for indicator, definition and study scripts: every declaration, hook and `ctx` call, with examples you can paste into a builder's **Code** tab. You do not need code to use Chartnaut. The [Agent](https://docs.chartnaut.com/guides/how-the-agent-works) and each [builder's agent](https://docs.chartnaut.com/guides/builder-agents) write these scripts for you. Open these pages to write a script yourself, to read what an agent wrote, or to fix a lint error, a budget warning or a definition that emits nothing. ## Map of this section | Section | Use it for | |---|---| | [Getting started](https://docs.chartnaut.com/scripting/choose-your-dsl-overview) | Which script type to write, how a script is laid out, a first script of each type | | [Accuracy and guarantees](https://docs.chartnaut.com/scripting/what-chartnaut-guarantees) | What the engine promises about bars, warmup, seams and anchors, and the limits and errors you can hit | | [Shared runtime](https://docs.chartnaut.com/scripting/runtime-overview) | What every script shares: bar data, `ctx.accum`, inputs, dependencies, drawing, layers, timeframe handles, sessions, budgets, lint codes. Start here for APIs | | [Indicator API](https://docs.chartnaut.com/scripting/indicator-api) | Overlay or pane, series types, panes and scales, `onBar`, layers | | [Indicator examples](https://docs.chartnaut.com/scripting/indicator-examples) | Ten library indicators, from Volume to VWAP | | [Definition API](https://docs.chartnaut.com/scripting/definition-api) | `events.declare`, `ctx.emit` and labels, multi-file packages | | [Definition examples](https://docs.chartnaut.com/scripting/definition-examples) | Bull bar, EMA cross, session opening-range break | | [Study API](https://docs.chartnaut.com/scripting/study-api) | `onEvent` and `onFinish`, `ctx.collect` and `ctx.publish`, results, Forward Insights | | [Study examples](https://docs.chartnaut.com/scripting/study-examples) | Event count, forward return, stop or target first hit | | [Agents](https://docs.chartnaut.com/scripting/agents-overview) | What the Agent and each builder's agent write, and the checks they run | | [Troubleshooting](https://docs.chartnaut.com/scripting/troubleshooting-overview) | FAQ, and pages that go from a symptom to its fix | What definitions, studies and indicators are for is covered in the guides: [How research works](https://docs.chartnaut.com/guides/how-research-works) and [How indicators work](https://docs.chartnaut.com/guides/how-indicators-work). This section covers how to write them. ## Write scripts from a terminal or a coding agent The same scripts run outside the app. The [Chartnaut CLI](https://docs.chartnaut.com/cli/overview) and the [Chartnaut API](https://docs.chartnaut.com/cli/api-overview) take the code, run it on Chartnaut's servers on the instrument, timeframe and range you ask for, and return what the script produced: an indicator's series, a definition's events or a study's results. You never receive raw candles. Both work on every plan, at its limits: Free keeps 10 definitions and 50 studies. ``` chartnaut new definition or-break chartnaut validate definitions/or-break chartnaut run definitions/or-break --on EURUSD --tf 5m --last 30d chartnaut push definitions/or-break -m "first version" ``` `chartnaut run` on a folder runs your local files and saves nothing. `chartnaut push` saves a new version, the same one you see in the app's builder, and `chartnaut pull` brings down a script you saved in the app. [Saving and versions](https://docs.chartnaut.com/cli/saving-and-versions) Claude Code and Codex work well here. `chartnaut init` writes a guide the agent reads, and `chartnaut docs ` prints any page in this section in the terminal. [Working with Claude Code and Codex](https://docs.chartnaut.com/cli/claude-code-and-codex) ## How to read the API 1. Learn the shared pieces in [Shared runtime](https://docs.chartnaut.com/scripting/runtime-overview): drawing, `indicators.declare`, inputs, timeframe handles. 2. Open the Indicator, Definition or Study section only for what that type adds: series outputs, events, or collect and publish. 3. To put a study's numbers on Charts, see [Show studies on charts](https://docs.chartnaut.com/scripting/show-studies-on-charts). ## The pipeline 1. Indicator draws values on the chart, bar by bar (`onBar`, `ctx.plot`). 2. Definition marks a setup every time it happened in history (`events.declare`, `ctx.emit` with a required label). 3. Study measures what followed those events (`onEvent`, `ctx.publish`). 4. Forward Insight shows a study's answer on Charts when the setup forms again. You create one with **Put on chart** on a finished study's results. ![Definition events painted on a chart preview](https://chartnaut.com/blog/definition_builder.png) *A definition's events marked on the builder's chart preview.* ## Common questions ### Do I have to write code? No. Start with [Test your first trading idea](https://docs.chartnaut.com/guides/test-your-first-trading-idea) or [Build your own indicator](https://docs.chartnaut.com/guides/build-your-own-indicator), which use the Agent. ### Which script type should I write? See [Choose your DSL](https://docs.chartnaut.com/scripting/choose-your-dsl-overview). ### Where are `ctx.plot`, `ctx.range`, `ctx.hline` and `ctx.mark` documented? In [Drawing on the chart](https://docs.chartnaut.com/scripting/drawings-and-paint). ### I want lines and histograms on the chart. Read [Series types](https://docs.chartnaut.com/scripting/series-outputs), then [Build a custom indicator](https://docs.chartnaut.com/guides/build-a-custom-indicator). ### I want to mark a setup in history. Read [Emit and labels](https://docs.chartnaut.com/scripting/emit-and-labels), then [Build a definition](https://docs.chartnaut.com/guides/build-a-definition). ### I want to measure what happens after a setup. Read the [Study API](https://docs.chartnaut.com/scripting/study-api), then [Build and run a study](https://docs.chartnaut.com/guides/build-and-run-a-study). ### I want study numbers on my live chart. See [Show studies on charts](https://docs.chartnaut.com/scripting/show-studies-on-charts) and [Forward Insights](https://docs.chartnaut.com/guides/forward-insights). ### My script is slow or fails with a budget warning. See [Budgets and limits](https://docs.chartnaut.com/scripting/budgets). ### How do the agents write this code? See the [Agents overview](https://docs.chartnaut.com/scripting/agents-overview). --- # Overview URL: https://docs.chartnaut.com/scripting/choose-your-dsl-overview/ Updated: 2026-11-22T22:28:34Z This page tells you which kind of script to write before you open a builder's Code tab. This page tells you which kind of script to write before you open a builder's **Code** tab. Chartnaut has three script types. An [indicator](https://docs.chartnaut.com/guides/how-indicators-work) draws values on the chart. A [definition](https://docs.chartnaut.com/guides/how-research-works) marks a setup every time it happened in history. A [study](https://docs.chartnaut.com/guides/build-and-run-a-study) measures what usually followed those marks. A fourth step, the [Forward Insight](https://docs.chartnaut.com/guides/forward-insights), puts a study's answer on Charts; you create it with **Put on chart**, not by writing a script. ## Decision table | Goal | Script | Key APIs | Written by | |---|---|---|---| | Lines, histograms, boxes or levels on the chart | Indicator | `meta`, `output.*`, `onBar`, `ctx.plot` | The indicator builder's agent, or the Agent | | Mark a setup in history | Definition, `kind: "flow"` | `events.declare`, `ctx.emit` | The definition builder's agent, or the Agent | | Measure what followed each event | Study | `flows.declare`, `dimensions.declare`, `scope`, `onEvent`, `results.declare`, `ctx.publish` | The study builder's agent, or the Agent | | Show a study's answer on Charts | Forward Insight | **Put on chart** on a finished study's results | A dedicated agent inside the **Put on chart** sheet | A definition can also be `kind: "indicator"`: a multi-file script that paints but emits no events. ## How they connect ``` Indicator (draws values) ↓ can be a dependency of Definition (emits events) ↓ run over history → events Study (measures and publishes results) ↓ Put on chart → Forward Insight (the answer on Charts, on the bar where the setup forms) ``` Studies never call `ctx.emit`. They read the events of the definitions they declare with `flows.declare`. ## Builder or Code tab | Job | In the app | Reference | |---|---|---| | Build an indicator | **Tools → Indicators**, then **New** | [Indicator API](https://docs.chartnaut.com/scripting/indicator-api) | | Build a definition | **Tools → Definitions**, then **New** | [Definition API](https://docs.chartnaut.com/scripting/definition-api) | | Build a study | The definition's **Studies** tab, then **New study** | [Study API](https://docs.chartnaut.com/scripting/study-api) | | Put a study's answer on Charts | **Put on chart** on the study's results | [Show studies on charts](https://docs.chartnaut.com/scripting/show-studies-on-charts) | In the indicator and definition builders, **Build it yourself** under the suggestions opens an empty script. In the study builder, **Show Code** opens the script. To build without code, start from [Test your first trading idea](https://docs.chartnaut.com/guides/test-your-first-trading-idea) or [Build your own indicator](https://docs.chartnaut.com/guides/build-your-own-indicator). Both use the [Agent](https://docs.chartnaut.com/guides/how-the-agent-works). Most APIs (drawing, inputs, `indicators.declare`, timeframe handles, sessions, budgets) are documented once under [Shared runtime](https://docs.chartnaut.com/scripting/runtime-overview). The Indicator, Definition and Study sections cover what each type adds. [Script anatomy](https://docs.chartnaut.com/scripting/script-anatomy) shows the layout every script follows. --- # Script anatomy URL: https://docs.chartnaut.com/scripting/script-anatomy/ Updated: 2026-11-22T22:28:34Z Every Chartnaut script has two parts: top-level declarations that say what exists (settings, outputs, events, results, dependencies), then hooks that run over bars or events. Every Chartnaut script has two parts: top-level declarations that say what exists (settings, outputs, events, results, dependencies), then hooks that run over bars or events. Declarations run once when the script loads. Chartnaut derives the script's manifest from them on save: the settings dialog, the outputs, the dependency pins, the timeframes it reads. You never edit that manifest by hand. Hooks do the per-bar or per-event work. Shared helpers (bar data, drawing, dependencies) are documented under [Shared runtime](https://docs.chartnaut.com/scripting/runtime-overview). ## Declarations Call these at the top level of the file, never inside a function. | Script | Declarations | |---|---| | Indicator | `meta`, `dialog`, `input.*`, `output.*`, `pane`, `scale`, `layout`, `indicators.declare`, `timeframe`, `warmup` | | Definition | `meta`, `input.*`, `events.declare`, `snapshots.declare`, `outputs.declare`, `output.layer`, `imports.use`, `indicators.declare`, `timeframe`, `warmup` | | Study | `meta`, `flows.declare`, `indicators.declare`, `dimensions.declare`, `results.declare` | A runtime call that names something you never declared fails lint or typecheck, or draws nothing. Declare first, then call. ## Hooks | Script | Hook | When it runs | |---|---|---| | Indicator | `onBar(ctx)` | Once per bar, and again on every tick of the forming bar | | Indicator with `meta({ mode: "once" })` | `onBar(ctx)`, then optionally `onRunEnd(ctx)` | Once per bar over a fixed window, drawing only inside it, then `onRunEnd` once at the end | | Definition | `export function onBar(ctx)` | Once per bar, in the entry file only | | Study | `export function onEvent(ctx)`, then `export function onFinish(ctx)` | Once per event from a declared definition, then once at the end. `onFinish` is optional | A timeframe handle can carry its own handler, `timeframe("1d").onBar((ctx) => ...)`, which runs once per closed bucket of that timeframe. It keeps state and never draws. See [Timeframe handles and runOn](https://docs.chartnaut.com/scripting/mtf-and-runon). ## Minimal templates ### Indicator ```js meta({ shortName: "EMA", kind: "overlay" }); dialog({ title: "EMA" }); const length = input.number({ id: "length", label: "Length", default: 20, min: 1 }); warmup((w) => w.ema(length)); output.line({ id: "ema", color: "#2196f3" }); layout( tab({ id: "main", title: "Main" }, section({ id: "p", title: "Parameters" }, length)) ); function onBar(ctx) { const k = 2 / (ctx.params.length + 1); const ema = ctx.accum("ema", null, (prev) => prev == null ? ctx.close : prev + k * (ctx.close - prev) ); ctx.plot("ema", ema); } ``` ### Definition ```js meta({ name: "Tick Signal", kind: "flow", slug: "tick-signal" }); events.declare({ id: "tick", intent: "alert", payload: { reason: { type: "string", description: "Why this fired" } }, paint: "pin", }); outputs.declare({ id: "close_line", kind: "line", name: "Close" }); export function onBar(ctx) { ctx.plot("close_line", ctx.close); if (ctx.close > ctx.open) { ctx.emit("tick", { reason: "bullish_bar" }, { label: "Bull bar", price: ctx.close, }); } } ``` ### Study ```js meta({ name: "Tick count", kind: "study" }); flows.declare({ slug: "tick-signal", as: "sig", version: 1 }); results.declare({ id: "rows", kind: "table", title: "Rows", description: "One row per Tick Signal event, with its time.", }); export function scope(ctx) { if (ctx.event.flow !== "sig") return null; return {}; } export function onEvent(ctx, scope) { ctx.collect("rows", { time: ctx.event.time }); } export function onFinish(ctx) { ctx.publish("rows", ctx.collected("rows")); } ``` `version` in `flows.declare` is the definition version the study reads. Set it to the definition's current version: lint fails with `flows/missing-version` without one. `scope(ctx)` runs first for each event and returns its group, `{}` when the study declares no dimensions, or `null` to leave the event out; `onEvent` runs only for the events it keeps. Lint fails with `study/scope-required` without it. See [scope](https://docs.chartnaut.com/scripting/study-scope). Every result carries a `description`, which Forward Insight cards show. ## Rules that apply everywhere - Keep state across bars in `ctx.accum`, never in a module-level `let` or `var`. Studies have no `ctx.accum`: read earlier events with `ctx.collected(...)` inside `onEvent`. - A script that keeps state declares how far back that state remembers, with a top-level `warmup(...)` call after its inputs: `w.ema(length)` for an EMA, `w.wilder(length)` for RSI, ATR or ADX, `w.day()` for state that resets each day, and `w.forever()` for a running total. Lint fails with `window/warmup-required` when it is missing, and with `state/never-forgets` when a running total declares a count. See [Warmup and memory](https://docs.chartnaut.com/scripting/warmup-and-memory). - `onBar` runs again on every tick of the forming bar, and the chart rolls back what the previous tick wrote to `ctx.accum` first. Anything that must happen only on a closed bar returns early when `ctx.barConfirmed === false`. - A timeframe is a string literal (`"15m"`), `"chart"`, or an `input.timeframe` handle. Never pass `ctx.params.` to `timeframe()`: lint rejects it with `tf/no-ctx-at-module-scope`. - No `Date.now()`, `new Date()`, network or async code. Read time from `ctx.time`. - Pin every dependency to a real version: `indicators.declare({ slug, as, version })` and `flows.declare({ slug, as, version })`. --- # First indicator guide URL: https://docs.chartnaut.com/scripting/first-indicator-guide/ Updated: 2026-11-22T22:28:35Z This walkthrough builds an overlay indicator by hand: an EMA with a length and a colour setting, and an arrow on every bar that closes up through it. This walkthrough builds an overlay indicator by hand: an EMA with a length and a colour setting, and an arrow on every bar that closes up through it. When you finish, you will know how `meta`, inputs, `warmup`, `output.*` and `onBar` fit together. To have the agent write it for you instead, follow [Build your own indicator](https://docs.chartnaut.com/guides/build-your-own-indicator). ![Indicator Code tab with live chart preview](https://chartnaut.com/blog/indicator_building.png) *The indicator builder: the script beside a live chart preview.* ## Steps 1. Open **Tools → Indicators** and click **New**. 2. Click **Build it yourself** under the suggestions and give the indicator a **Name**. 3. In the **Code** tab, replace the script with the one below and click **Save**. 4. Open the **Chart** tab. Step through a few days with the arrows beside the date. On a chart, the indicator's settings dialog shows *Length* and *Color* in a *Parameters* section, the layout the script declares. A save that does not compile is still kept. The chart goes on showing the last version that did, and **Errors** shows what stopped it. [Build a custom indicator](https://docs.chartnaut.com/guides/build-a-custom-indicator) covers the builder itself. ## Full script ```js meta({ shortName: "EMA Cross", kind: "overlay" }); dialog({ title: "EMA Cross" }); const length = input.number({ id: "length", label: "Length", default: 20, min: 1, }); const color = input.color({ id: "color", label: "Color", default: "#2196f3", }); warmup((w) => w.ema(length)); const emaLine = output.line({ id: "ema", color: "#2196f3", colorFrom: color }); output.markers({ id: "cross_up", on: emaLine, color: "#26a69a" }); layout( tab({ id: "main", title: "Main" }, section({ id: "params", title: "Parameters" }, length, color)) ); function onBar(ctx) { const k = 2 / (ctx.params.length + 1); const st = ctx.accum( "st", () => ({ time: null, ema: null, close: null, prevEma: null, prevClose: null }), (s) => { if (s.time !== ctx.time) { // A new bar: the values held so far belong to the previous bar. s.prevEma = s.ema; s.prevClose = s.close; s.time = ctx.time; } s.ema = s.prevEma == null ? ctx.close : s.prevEma + k * (ctx.close - s.prevEma); s.close = ctx.close; return s; } ); ctx.plot("ema", st.ema); if (st.prevEma != null && st.prevClose <= st.prevEma && ctx.close > st.ema) { ctx.mark("cross_up", { shape: "arrowUp", position: "belowBar", text: "Cross" }); } } ``` ## What each part does | Piece | Job | |---|---| | `meta({ kind: "overlay" })` | Draws on the price pane. `"pane"` draws in a pane of its own below price | | `input.number` / `input.color` | Settings the trader can change. Read them as `ctx.params.length` and `ctx.params.color` | | `warmup((w) => w.ema(length))` | How many bars before the visible range the EMA needs to settle: `w.ema` is 30 times the length | | `output.line` / `output.markers` | The series the chart may draw. `colorFrom` ties the line colour to the setting; `on: emaLine` puts the arrows on the line | | `layout` | The settings dialog's tabs and sections | | `ctx.accum` | Memory across bars: the EMA and the previous bar's close and EMA | | `ctx.plot` / `ctx.mark` | Values for the declared outputs, bar by bar | `onBar` runs again on every tick of the bar that is still forming, and `ctx.accum` keeps what the last run wrote. That is why the script stores the previous bar's values and recomputes the current bar from them, instead of stepping the EMA forward on every call. ## Common mistakes - Plotting an id you never declared with `output.*`. - Keeping the EMA in a module-level `let` instead of `ctx.accum`. - Leaving out `warmup`. A script that keeps state fails lint with `window/warmup-required`. - Passing `price` to a marker with `position: "aboveBar"`, `"belowBar"` or `"inBar"`. Only `"atPriceTop"`, `"atPriceMiddle"` and `"atPriceBottom"` take a price, and they require one. - Setting `kind: "pane"` when you meant an overlay on price. [Settings inputs and dialog](https://docs.chartnaut.com/scripting/inputs-dialog-layout) and [Drawing on the chart](https://docs.chartnaut.com/scripting/drawings-and-paint) cover the rest of what an indicator can declare and draw. --- # First definition guide URL: https://docs.chartnaut.com/scripting/first-definition-guide/ Updated: 2026-11-22T22:28:35Z This walkthrough builds a small definition by hand: it marks every bar that closes above its open, with a label on each mark, ready to run over history and measure with a study. This walkthrough builds a small [definition](https://docs.chartnaut.com/guides/how-research-works) by hand: it marks every bar that closes above its open, with a label on each mark, ready to run over history and measure with a study. In the API a definition is a *flow*: `kind: "flow"`, `flows.declare`, `imports.use({ flowId })`. Both words mean the same thing. To have the agent write a definition for you instead, follow [Test your first trading idea](https://docs.chartnaut.com/guides/test-your-first-trading-idea). ![Definition builder with event markers on chart](https://chartnaut.com/blog/definition_builder.png) *The definition builder: the script beside the events it marked.* ## Steps 1. Open **Tools → Definitions** and click **New**. 2. Click **Build it yourself** under the suggestions and give the definition a **Name**. 3. Paste the script below into the **Code** tab and click **Save draft**. 4. Open the **Chart** tab and check the marks. The text on each mark is the emit's `label`, not the event id. 5. [Run the definition over history](https://docs.chartnaut.com/guides/run-over-history) to collect its events, then [build a study](https://docs.chartnaut.com/guides/build-and-run-a-study) on them. **Problems** lists what lint flagged, **Errors** what stopped the script from running, and **Logs** what it printed with `ctx.log`. ## Full script ```js meta({ name: "Bull bar", kind: "flow", slug: "bull-bar", shortName: "BullBar", }); events.declare({ id: "bull_bar", intent: "signal", payload: { range: { type: "number", description: "High minus low of the bar, in price units" }, }, paint: "pin", }); outputs.declare({ id: "close_line", kind: "line", name: "Close", color: "#64b5f6", }); export function onBar(ctx) { ctx.plot("close_line", ctx.close); if (ctx.close <= ctx.open) return; const range = ctx.high - ctx.low; ctx.emit( "bull_bar", { range }, { label: `Bull · R=${range.toFixed(2)}`, subtitle: `close ${ctx.close.toFixed(2)}`, price: ctx.close, } ); } ``` ## What each part does | Piece | Job | |---|---| | `meta({ kind: "flow" })` | Lets the script emit events. `kind: "indicator"` paints only, and its emits are refused | | `slug` | The stable name studies and other scripts use to depend on this one. Renaming it breaks every consumer | | `events.declare` | The event's id, a short `intent` tag, and a payload schema. Every payload field has a `type` and a plain-English `description`: study agents read those descriptions | | `paint` | How an emit shows on the chart: `"pin"` (the default), `"highlight_event_bar"`, `"highlight_price"`, `"highlight_event_bar_and_price"` or `"none"` | | `outputs.declare` | A series the definition draws, fed by `ctx.plot` | | `ctx.emit(id, payload, opts)` | Records one event. `opts.label` is the text on the pin; `subtitle` is a smaller line under it; `price` sets where the pin sits on the chart | `timeStart` and `timeEnd` in `opts` set the event's time range and both default to `ctx.time`. A point-in-time event needs neither. ## Rules that bite early - Every `ctx.emit` needs a non-empty `label`. Lint warns with `events/emit-missing-label`, and a run drops the emit. - Payload keys `_displayLabel` and `_displaySubtitle` are reserved. Pass that text as `label` and `subtitle` instead. - To fire at most once per day, session or level, declare `oncePer: { keys: [...] }` on the event, naming payload fields. The runtime keeps one emit per unique combination of those fields over the whole run. Never build your own dedupe set in `ctx.accum`. - `paint: "highlight_price"` and `"highlight_event_bar_and_price"` draw at a price. Declare `payload.price` as a number, or lint warns with `events/paint-needs-price`. `opts.price` overrides it on the chart only; a run over history ignores it. - `paint: "none"` hides the events on the chart. Lint warns with `events/hidden-paint-explicit`. - The entry file uses `export function onBar(ctx)`. Helpers in other files use relative imports such as `import { isBull } from "./lib/bars.js"`. See [Multi-file packages and imports](https://docs.chartnaut.com/scripting/imports-and-modules). [Emit and labels](https://docs.chartnaut.com/scripting/emit-and-labels) and [Events and snapshots](https://docs.chartnaut.com/scripting/events-and-snapshots) cover every option. --- # First study guide URL: https://docs.chartnaut.com/scripting/first-study-guide/ Updated: 2026-11-22T22:28:35Z This walkthrough builds a small study by hand: it reads the events of the Bull bar definition from the first definition guide, counts them, and publishes a count, a table and a ... This walkthrough builds a small [study](https://docs.chartnaut.com/guides/build-and-run-a-study) by hand: it reads the events of the Bull bar definition from the [first definition guide](https://docs.chartnaut.com/scripting/first-definition-guide), counts them, and publishes a count, a table and a one-line answer. A study answers "what usually happens next?" over events a definition already marked. It never marks new events itself. To have the agent build a study for you instead, follow [Test your first trading idea](https://docs.chartnaut.com/guides/test-your-first-trading-idea). ![Study run results in Research](https://chartnaut.com/blog/study_mode.png) *Study results: metrics and tables published from the definition's events.* ## Before you start You need a definition that has been [run over history](https://docs.chartnaut.com/guides/run-over-history), so there are events to read. ## Steps 1. Open the definition from **Tools → Definitions**, open its **Studies** tab and click **New study**. 2. Click **Show Code** and replace the script with the one below. Set `slug` and `version` in `flows.declare` to your definition's. 3. Click **Save draft**. 4. Click **Run Study**. The agent proposes a run: pick the datasets, check the *Run window*, and click **Run**. 5. Read the results on the run card. [Read the results](https://docs.chartnaut.com/guides/read-the-results) explains each part. **Lints** in the code view lists what the study's lint found before you run it. ## Full script ```js meta({ name: "Bull bar count", kind: "study" }); flows.declare({ slug: "bull-bar", as: "bull", version: 1 }); results.declare({ id: "readout__count", kind: "metric", size: "xs", title: "Event count", description: "How many bull-bar events the run read.", }); results.declare({ id: "rows", kind: "table", title: "Events", description: "One row per bull-bar event: its time and the bar's high-to-low range.", }); results.declare({ id: "answer", kind: "prose", role: "answer", title: "Answer", description: "The result in one sentence.", }); export function scope(ctx) { if (ctx.event.flow !== "bull") return null; return {}; } export function onEvent(ctx, scope) { ctx.collect("rows", { time: ctx.event.time, range: ctx.event.payload.range, }); } export function onFinish(ctx) { const rows = ctx.collected("rows"); const avg = rows.length ? rows.reduce((sum, r) => sum + r.range, 0) / rows.length : 0; ctx.publish("readout__count", { value: rows.length, label: "Events" }); ctx.publish("rows", rows); ctx.publish("answer", { body: `${rows.length} bull bars, with an average range of ${avg.toFixed(2)}.`, role: "answer", }); } ``` ## What each part does | Piece | Job | |---|---| | `flows.declare({ slug, as, version })` | Which definition's events the study reads, under which alias, at which version | | `results.declare` | Each result the study publishes: its `kind`, `title` and a plain-English `description` | | `ctx.event` | The current event: `flow` (the alias), `id`, `time`, `instrument` and `payload` | | `scope(ctx)` | Runs first for each event and returns its group from what was known when it fired. With no dimensions declared it returns `{}`; `null` leaves the event out | | `onEvent(ctx, scope)` | Measures each event `scope` kept. The second argument is the group `scope` returned | | `ctx.collect` / `ctx.collected` | Rows gathered in `onEvent`, read back in `onFinish` | | `ctx.publish` | Sends a finished result, once, from `onFinish` | ## Rules that bite early - Studies read events. They never call `ctx.emit`, and they have no `ctx.accum`, `timeframe(...)` handles or `outputs.declare`. - `ctx.collect` belongs in `onEvent` and `ctx.publish` in `onFinish`. Publishing from `onEvent` fails the run. - Every study exports `scope(ctx)`, and it returns on every path: a group object, or `null`. Lint fails with `study/scope-required` without the export and `study/scope-no-return` for a bare `return;`. [scope](https://docs.chartnaut.com/scripting/study-scope) covers what it can read. - `flows.declare` and `indicators.declare` pin a `version`. Lint fails with `flows/missing-version` or `indicators/missing-version` without one. - A branch on `ctx.event.flow` names a declared alias, or lint fails with `study/event-flow-branch-mismatch`. A read of `ctx.event.payload.` names a field the definition declares, or lint fails with `study/payload-key-undeclared`. - Every result carries a `description`: Forward Insight cards show it. Lint warns with `study/result-missing-description` without one. - A study with a table or chart result also publishes a small `readout__*` metric, and a study with two or more non-prose results publishes a `kind: "prose"` result with `role: "answer"`. Lint warns with `study/readout-missing` and `study/missing-answer-prose` otherwise. - Never publish a metric whose value is `NaN` or `Infinity`. Guard the empty case, as `onFinish` does above. This study only counts, so it has nothing to put on Charts. A [Forward Insight](https://docs.chartnaut.com/guides/forward-insights) needs a study that measures what followed each event, with `dimensions.declare` for the ways it splits events. [Declarations](https://docs.chartnaut.com/scripting/declarations) covers dimensions and their roles, and [Collect and publish](https://docs.chartnaut.com/scripting/collect-and-publish) covers every result kind. --- # What Chartnaut guarantees URL: https://docs.chartnaut.com/scripting/what-chartnaut-guarantees/ Updated: 2026-11-22T22:28:35Z One answer per bar: the same value in the browser and on the server, on every chart timeframe, live, in replay and over history, with no look-ahead and no repainting. A script on Chartnaut gives one answer for a given bar. The number on your chart, the number in a replay, the number a definition recorded when it ran over history and the number a study measured are the same number. This page lists what that covers and why it matters when real money follows the result. The guarantees hold for scripts that follow the rules on [Bars and clocks](https://docs.chartnaut.com/scripting/bars-and-clocks) and declare their memory honestly ([Warmup and memory](https://docs.chartnaut.com/scripting/warmup-and-memory)). Where you can break one by accident, the page that owns it says how. ## The promises | Guarantee | What it means for a bar at 14:35 on Tuesday | |---|---| | Same answer in the browser and on the server | Your chart and a definition run over history compute the same value for it | | Same answer on every chart timeframe | A `timeframe("1h")` handle reads the same value there on a 5m, 15m or 1h chart | | Same answer whatever you loaded | Scrolling back, reloading or opening the chart a week later leaves its value unchanged | | Same answer live, in replay and over history | The value you watched form is the value history records for it | | No look-ahead | Nothing computed for it reads a price that printed after it | | No repainting of confirmed bars | Once it closes, its value is fixed | | Honest about missing history | If the history behind it was cut short, the script is told and so are you | ## Same answer in the browser and on the server Chartnaut runs your script in two places: in your browser for the chart, and on Chartnaut's servers when a [definition runs over history](https://docs.chartnaut.com/guides/run-over-history), when a study measures its events, and when an app computes. Both engines follow one set of rules for time grids, warmup, higher-timeframe buckets and when a level is taken out, and the rules are pinned together so a change reaches both or neither. Why it matters: a [study](https://docs.chartnaut.com/scripting/study-api) measures the events a definition recorded on the server. A [Forward Insight](https://docs.chartnaut.com/guides/forward-insights) then shows that study's numbers on your live chart, where the definition runs in your browser. If the two engines disagreed, the setup on your chart would be a slightly different setup from the one the statistics describe, and the win rate beside it would belong to something else. ## Same answer on every chart timeframe A higher-timeframe value is built from the chart's bars, so the question is whether those bars line up with the higher timeframe's buckets. On Chartnaut every pair of timeframes tiles exactly: every bucket grid starts at midnight UTC, including 4h, and weeks start on Monday. A daily bucket read from a 4h chart is the same UTC day as on a 5m chart. Lower-timeframe reads follow the same rule at the live edge: the 5m bucket still forming inside a 1h bar is not handed out as closed. Why it matters: a daily level or a 1h trend filter that shifts when you change the chart's timeframe is a level you cannot trade from. You would be choosing between two answers to one question. ## Same answer whatever you loaded State that remembers (an EMA, a running high, a swing list) has to start somewhere. On most charting platforms it starts at the first bar that happened to load, so scrolling back or reloading moves every value computed after it. Chartnaut starts that memory from fixed points on a time grid instead. The start point for a bar depends on the bar's own time and your declared warmup, never on where loading began. [Seams and anchors](https://docs.chartnaut.com/scripting/seams-and-anchors) explains what this gives you. Why it matters: a backtest is only as good as the values it read. If an EMA reads 101.20 on Monday and 101.35 on Friday for the same historical bar, one of those runs measured a price you never saw on your chart. ## Same answer live, in replay and over history The forming bar is recomputed on every tick, and it becomes the confirmed bar history records. When a live chart crosses a boundary of the time grid, Chartnaut recomputes from the fixed start point, so live values continue to match what a fresh run over the same bars produces. In [replay](https://docs.chartnaut.com/guides/replay), scripts see only the bars revealed so far; lower-timeframe buckets that end after the replay clock stay hidden. ## No look-ahead - A higher-timeframe handle's `last` and `bars(n)` hold closed buckets only. The unfinished bucket is `forming`, named as such, and holds only what has printed up to the current chart bar. - `ctx.summary` measures up to the last closed bucket. - In replay the reveal boundary is the only clock. - `Date.now()` is refused in definitions and on the server. A script reads time from `ctx.time`. Why it matters: the most common way a backtest flatters itself is a higher-timeframe value that already knows how the bucket closed. A daily high read at 10:00 that includes the 15:00 spike makes a breakout rule look clairvoyant. ## No repainting of confirmed bars A value on a confirmed bar is a function of that bar's time, the bars before it, your settings and the script. Nothing that happens later changes it: more history loading, a new bar arriving, a different chart timeframe or a server run. The forming bar moves until it closes, because the market is still printing it. Two things do recompute confirmed bars, and both are visible: editing the script or its settings, and a change of plan that changes how far back memory reaches. ## Honest about missing history When the history behind a value was cut short, by your plan, by the instrument's first bar or by the platform's 2015 floor, the script can read it through `history.truncated` and `reason`, and the chart shows it beside the indicator. An indicator that declared history it has not received yet waits with "loading history" instead of drawing a provisional value and redrawing it later. Why it matters: "all-time high" computed from three years of data is a three-year high. A script that knows that can say so. ## Where most platforms fall short - Values repaint: a signal appears on a live bar, then vanishes or moves once the bar closes or the chart reloads. - Results depend on loaded history: the same indicator reads differently after scrolling back, so two traders on the same chart see different numbers. - Higher-timeframe values peek: a request for the daily close on an intraday chart returns the close of a day that has not finished. - The alerting server and the chart disagree: the alert fires on a condition the chart never showed, or the chart shows a signal the server never sent. - Odd bucket grids: a 4h bar that starts at 02:00 cannot tile a day, so daily values assembled from it are off by two hours. Chartnaut's guarantees exist because each of these turns a study into a measurement of something you will never trade. --- # Bars and clocks URL: https://docs.chartnaut.com/scripting/bars-and-clocks/ Updated: 2026-11-22T22:28:35Z Confirmed and forming bars, when onBar runs, what a higher or lower timeframe can know at a bar, the UTC time grids, and sessions. Every script runs against a clock made of bars. This page sets out what a bar is, when your code runs, what a higher or lower timeframe can know at a given bar, and how the time grids are laid. Each rule is something Chartnaut guarantees or something your script must do to keep the guarantees on [What Chartnaut guarantees](https://docs.chartnaut.com/scripting/what-chartnaut-guarantees). ## What a bar is A bar is one bucket of time on one timeframe: its open, high, low, close and volume, stamped with the bucket's start in `ctx.time` (unix seconds, UTC). A bar is either confirmed, meaning its bucket has ended and a later bar has arrived, or forming, meaning it is the newest bar on a live chart and is still printing. | | Confirmed bar | Forming bar | |---|---|---| | Where | Every bar in history, every bar in a run over history | The right edge of a live chart, and the last bar of a server run that ends now | | Values | Fixed | Change on every tick | | `onBar` runs | Once | Once per update, until the next bar arrives | | `ctx.barConfirmed` | `true` | `false` | Runs over history, dry runs and replays of past bars have no live edge: every bar is confirmed. A server run that ends at the current time, such as a canvas attaching an indicator, a chart preparing a dependency or a study's visuals, cannot know its newest bar has closed, so that one bar has `ctx.barConfirmed` `false`. ## When onBar runs `onBar(ctx)` runs once per bar, oldest first. On a live chart it runs again for the forming bar every time that bar updates, and once more when the next bar arrives and confirms it. The engine handles the re-runs for what it owns: the forming bar's plots replace what the previous run plotted for that bar, and higher-timeframe buckets never close on a bar that is still forming. State in `ctx.accum` is rolled back too: before each re-run, the chart undoes what the previous run of the forming bar wrote to plain values, objects and arrays. An array that appends holds the forming bar once, an EMA updated with `prev + k * (close - prev)` steps once per bar, and a counter counts bars. Scripts that fold state once per bar by hand, as below, still work. The last pattern is how to act only on a close. ### Fold on confirmed bars, show a live value ```js meta({ shortName: "EMA", kind: "overlay" }); const length = input.number({ id: "length", label: "Length", default: 20, min: 1 }); warmup((w) => w.ema(length)); output.line({ id: "ema" }); export function onBar(ctx) { const k = 2 / (ctx.params.length + 1); const st = ctx.accum("ema", () => ({ done: NaN }), (s) => s); const live = Number.isFinite(st.done) ? st.done + k * (ctx.close - st.done) : ctx.close; if (ctx.barConfirmed !== false) st.done = live; // store once, when the bar is closed ctx.plot("ema", live); // every tick shows the right value } ``` When the next bar arrives, the previous bar runs once more as a confirmed bar and its value is stored. The forming bar's ticks never touch `st.done`. ### Replace the tip, keep a live reading ```js export function onBar(ctx) { const st = ctx.accum("swings", () => ({ buf: [], lastT: null }), (s) => s); if (st.lastT === ctx.time) st.buf.pop(); // same bar again: overwrite it st.buf.push({ t: ctx.time, h: ctx.high, l: ctx.low }); st.lastT = ctx.time; if (st.buf.length > 50) st.buf.shift(); // read st.buf here: the forming bar appears once, as its latest values } ``` ### Act only on closed bars ```js export function onBar(ctx) { if (ctx.barConfirmed === false) return; // skip the forming bar const st = ctx.accum("swings", () => ({ buf: [] }), (s) => s); st.buf.push({ t: ctx.time, h: ctx.high, l: ctx.low }); if (st.buf.length > 50) st.buf.shift(); } ``` The last pattern draws nothing on the forming bar. Use it for signals you only want on a close: a level created from a closed swing, an event that must not appear and then vanish. ## The newest bar `ctx.isLastBar` is `true` on the newest bar of the live chart, on every tick, and on the last bar of a one-off run: an indicator run with `chartnaut run`, the agent's dry run, the last bar of a `mode: "once"` window. It is always `false` in definitions and in runs that are stored and stitched together: a definition's events, studies, canvases. Chartnaut caches results in pieces and reuses them, and which bar is newest depends on when you run. So there is no `lastBarIndex` or `lastBarTime`, and `isLastBar` is only set where the run's end really is the newest bar. Draw with it through an output that keeps one drawing: a `priceLine`, a `mode: "replace"` `hline`, or a layer row. See [Price and bar data](https://docs.chartnaut.com/scripting/bar-fields). ## Time is the bar's time Read time from `ctx.time`. `Date.now()` is refused in definitions and on the server, and `new Date()` without arguments is flagged, because the wall clock differs between a live chart, a replay and a run over last year's bars. `ctx.barIndex` counts bars from the start of the current pass, so the same bar has a different index on a chart, in replay and on the server. Key anything that must be stable, such as ids, dedupe keys and "last seen" markers, on `ctx.time`. ## Higher timeframes: what a value knows at a bar A `timeframe("1d")` handle on a 5m chart gives you three reads, each with a fixed promise: | Read | What it holds at the 14:35 bar | Can it change later? | |---|---|---| | `daily.last` | Yesterday's complete daily bucket | No | | `daily.bars(n)` | The last `n` complete daily buckets | No | | `daily.forming` | Today from the open up to and including the 14:35 bar | Yes, until today closes | None of them includes a price that printed after the current chart bar. `last` stays `undefined` until the first bucket closes, so guard it. A bucket closes on the chart bar whose end reaches the bucket's end: the daily on the 23:55 bar of a 5m chart. Every bucket that ends at one instant closes in the same step: at Monday 00:00 the 1m, the 4h, the day, the week and the chart bar close together. Act on a close with `closedThisBar`. The full reference for handles is [Timeframe handles and runOn](https://docs.chartnaut.com/scripting/mtf-and-runon). ### Reading a higher timeframe safely ```js meta({ shortName: "D-EMA20", kind: "overlay" }); warmup(600); // 20-day EMA: about 30x its length output.line({ id: "ema" }); const daily = timeframe("1d"); daily.onBar((ctx) => { const k = 2 / 21; ctx.accum("ema", NaN, (e) => (Number.isFinite(e) ? e + k * (ctx.close - e) : ctx.close)); }); export function onBar(ctx) { const e = daily.state.ema; // advanced through the last closed day if (Number.isFinite(e)) ctx.plot("ema", e); } ``` The EMA is folded in the handler, once per closed day, so it never sees today's unfinished close. Folding `daily.forming.close` into state from `onBar` would re-fold on every chart bar and every tick. ## Lower timeframes A `timeframe("1m")` handle on a 5m chart runs its handler once for each 1m bucket that closed inside the chart bar, oldest first. At the live edge the newest 1m bucket is still forming and is not handed out as closed, so a 1m value read from a 5m chart matches the 1m chart tick for tick. There is no `forming` for a lower timeframe. ## The time grids All grids are UTC. | Timeframe | Buckets start | |---|---| | `1m` `5m` `15m` `30m` | On the minute grid from midnight UTC | | `1h` `2h` | On the hour grid from midnight UTC | | `4h` | 00:00, 04:00, 08:00, 12:00, 16:00, 20:00 UTC | | `1d` | 00:00 UTC | | `1w` | Monday 00:00 UTC, the one offset grid | | `1mo` | Calendar month, 00:00 UTC on the 1st | A month is 28 to 31 days, so `1mo` is never a fixed number of seconds. Write it `"1mo"`: `"1M"` also means a month, and `"1m"` is one minute. Every other pair of timeframes tiles: each higher bucket is a whole number of lower buckets, and their boundaries line up. That is why a handle reads the same value on every chart. The exception is `1w` with `1mo`, because a week can straddle two months. A week belongs to the month it ends in, and a monthly handle on a weekly chart reads the last month that closed by that week's close. A daily bucket is a UTC day, which is not the same as an exchange's trading day. If your logic needs the New York cash session, use a session. ## Sessions and time zones `ctx.session(opts)` tracks a window inside a day, week or month in any IANA time zone, and handles daylight saving: ```js const s = ctx.session({ period: "daily", open: { hour: 9, minute: 30 }, close: { hour: 16 }, tz: "America/New_York" }); if (s.didOpen) { /* reset per-session state here */ } ``` The default time zone is `"UTC"`. Gate logic on `didOpen`, `didClose` and `isOpen`, never on counting bars, because the number of bars in a session changes with the chart timeframe and with market holidays. A session reset also shortens the warmup a script needs, see [Warmup and memory](https://docs.chartnaut.com/scripting/warmup-and-memory). The session API is on [Sessions](https://docs.chartnaut.com/scripting/session-api). ## Rules for the script author - Key stable things on `ctx.time`, never on `ctx.barIndex`. - Keep state in `ctx.accum` so the forming bar's writes roll back. A signal that must not appear and then vanish waits until `ctx.barConfirmed` is not `false`. - Draw "on the last bar" with `ctx.isLastBar` and an output that keeps only its latest emit. - Fold higher-timeframe state in the handle's handler, from closed buckets. - Read `forming` only for display of the unfinished bucket, and never fold it into state. - Read time from the bar. Keep `Date.now()`, `new Date()` and `Math.random()` out of scripts. - Use sessions for exchange hours; the daily bucket is a UTC day. --- # Warmup and memory URL: https://docs.chartnaut.com/scripting/warmup-and-memory/ Updated: 2026-11-22T22:28:35Z What warmup guarantees, how to declare it with warmup(...) and retain(...), how it resolves on each timeframe, memory limits per plan, and how to spot a warmup that is too short. Warmup is how far back your script's memory reaches. Declare it and Chartnaut walks that much history before every value it keeps, so each value has converged and does not depend on where your chart started loading. This page covers what warmup guarantees, how to declare it, how it resolves on each timeframe, how much your plan allows and how to tell when you declared too little. ## What warmup guarantees With a warmup of `L` on a timeframe, every bar's value is computed from a walk that starts at least `L` buckets before it, from a fixed point on the time grid ([Seams and anchors](https://docs.chartnaut.com/scripting/seams-and-anchors) explains the grid). So: - A value never depends on how much history your chart loaded, on a reload, or on scrolling. - The chart and a run over history start each bar's memory from the same point and compute the same value, whether that history is computed in one pass or in chunks. - Every timeframe the script reads resolves its own count from the same declaration. A count such as `warmup(1000)` is 1,000 buckets on each of them. A length of time such as `w.day()` is one day on each of them: 288 buckets on `5m`, 24 on `1h`. A script that keeps state and declares no warmup is refused by the lint (`window/warmup-required`), because its values would depend on where the run began. A script that keeps no state, such as a plot of `ctx.volume`, declares nothing. ## Declaring it Call `warmup(...)` once, at the top level, after your inputs. It can read input handles, so the depth follows the settings a reader picks. ```js const length = input.number({ id: "length", label: "Length", default: 14, min: 1 }); warmup((w) => w.wilder(length)); // RSI: 50x the length ``` It takes a plain number or a function of `w`, the builder: | Declaration | What it means | |---|---| | `warmup(500)` | A constant count of bars, taken as written | | `w.window(length)` | A lookback of `length` bars: SMA, Donchian, a rolling percentile. The same as `w.of(length)` | | `w.ema(length)` | EMA convergence, 30x the length. The same as `w.of(length).times(30)` | | `w.wilder(length)` | Wilder smoothing (RSI, ATR, ADX, RMA), 50x the length | | `w.span("1d")` | A length of time. Units are `m`, `h`, `d` and `w`: `"90m"`, `"4h"`, `"3d"`, `"2w"` | | `w.day()` | One day, the same as `w.span("1d")` | | `w.max(a, b)` | The larger of two needs: independent pieces of state | | `w.sum(a, b)` | Stages that feed each other add up: an EMA of an EMA, MACD's signal | | `w.when(mode).is("daily").then(a).otherwise(b)` | A depth that depends on a select or a toggle | | `w.forever()` | State that never forgets: a running sum, a count, an all-time high | | `w.of(handle).times(k)` | A setting scaled by your own factor, such as `0.5` for a script that smooths over half its period | | `w.range(handle, "hi")` | One end of an `input.range` | | `w.maxOf(handle)`, `w.sumOf(handle)` | The largest or the total of a multi-select, or of one field across an array input's rows: `w.maxOf(bands, "period")` | Terms combine. A script with a daily reset and an RSI declares `warmup((w) => w.max(w.day(), w.wilder(length)))`. MACD stacks its signal on its slow EMA: `warmup((w) => w.sum(w.ema(slow), w.ema(signal)))`. VWAP picks by its anchor setting: ```js const calculationMode = input.select({ id: "calculationMode", label: "Reset Time", default: "daily", options: [ { value: "consistent", label: "Remain Consistent" }, { value: "daily", label: "Reset Daily" }, { value: "weekly", label: "Reset Weekly" }, { value: "monthly", label: "Reset Monthly" }, { value: "london", label: "Reset at London Session Open" }, ], }); warmup((w) => w.when(calculationMode) .is("consistent").then(w.forever()) .is("weekly").then(w.span("7d")) .is("monthly").then(w.span("31d")) .otherwise(w.day())); ``` The declaration is the largest need across every piece of state the script keeps. One piece that never forgets makes the whole declaration `w.forever()`. ## Choosing the term | Your state | Declare | |---|---| | A lookback of N bars | `w.window(length)` | | An EMA | `w.ema(length)` | | RSI, ATR, ADX or any Wilder average | `w.wilder(length)` | | Resets every session or every day | `w.day()` | | Resets weekly or monthly | The longest gap between resets: `w.span("7d")`, `w.span("31d")` | | Carries the previous session forward, such as yesterday's value area | The span that covers it: `w.span("3d")` reaches across a weekend | | Never resets: a running total, a count, an all-time high, a trend flag | `w.forever()` | | No state at all | Nothing | State that resets on a boundary wants a length of time. A count of bars is a different stretch of time on every timeframe, so the lint suggests a span when a script resets on `ctx.session.isStart` and declares a count (`window/reset-wants-span`). ## How it resolves A declaration resolves separately on each timeframe the script reads, against the settings the reader picked. - A plain number and a span are taken as written. A span becomes the number of buckets that covers it, rounded up, at least 1. - An expression that reads a number from a setting (`w.of`, `w.window`, `w.ema`, `w.wilder`, `w.range`, `w.maxOf`, `w.sumOf`) resolves to at least 50 bars, because a setting can carry a number nobody chose, such as `0`. A `w.when` that only chooses between spans and constants is taken as written. - Everything is capped at the viewer's indicator memory, covered below. `w.day()` on each timeframe: | Timeframe | Bars | |---|---| | `1m` | 1,440 | | `5m` | 288 | | `15m` | 96 | | `1h` | 24 | | `4h` | 6 | | `1d` | 1 | The warmup also sets how wide each stretch of the grid is, and stretches are aligned to UTC midnight. With `w.day()`, every intraday timeframe's stretches start at UTC midnight, so the chart and every timeframe handle share the same boundaries. That shared grid is what keeps values identical whether history is computed in one pass or in chunks, on any chart and at any time. The settings dialog shows what the declaration means on the chart's timeframe, for example *Remembers 288 bars on 5m (1 day).* ### Why smoothed indicators need twice as much What an average still remembers of its starting point after `L` bars is `(1 − k)^L`. An EMA uses `k = 2 / (n + 1)`. Wilder smoothing, used by RSI, ATR and ADX, uses `k = 1 / n`, half as large, so its memory fades half as fast and it needs twice the bars to forget its start by the same amount. That is why `w.ema` is 30x and `w.wilder` is 50x. The shipped indicators follow this: RSI declares `w.wilder(length)`, ADX stacks two Wilder stages as `w.sum(w.wilder(period), w.wilder(period))`, and Keltner Channels takes `w.max` of its EMA and its ATR. ## Memory limits by plan Your plan sets indicator memory: the most buckets a script can hold for one timeframe. It bounds `warmup`, `retain`, and the history loaded behind every timeframe handle. | Plan | Indicator memory | |---|---| | Free | 2,500 buckets | | Pro | 5,000 buckets | It counts buckets, so the span it covers depends on the timeframe. For a market that trades around the clock: | Timeframe | 2,500 buckets | 5,000 buckets | |---|---|---| | `1m` | 1.7 days | 3.5 days | | `5m` | 8.7 days | 17 days | | `1h` | 3.4 months | 6.8 months | | `4h` | 1.1 years | 2.3 years | | `1d` | 6.8 years | Every bar since 2015 | Markets closed at weekends stretch each span further. Free holds three years of history, so a daily handle on Free reaches that far back whatever the memory limit says. See [Plans](https://docs.chartnaut.com/start/plans) for the rest of each plan. The limit is the viewer's. A script you share resolves against the plan of whoever runs it, and a definition run over history resolves against the plan of the account that started it. ## What `w.forever()` means on your plan `w.forever()` means as far back as the plan allows, back to the instrument's first bar. Where your memory limit reaches the start of the history you hold, as it does on daily charts on every plan, a never-forgetting value is exact: a running total is the total over all of that history. Where it does not, on intraday timeframes, the value counts from a fixed point on the grid between one and two memory limits back, and that point moves forward one limit at a time. A cumulative line such as On-Balance Volume on a 5m chart on Pro therefore restarts its origin every 5,000 bars, and its level steps at those instants. Its shape between steps is exact. A running high stays correct as long as the high is inside the window. For an extreme or total over a longer span, use `ctx.summary`, which has no memory limit: [Summaries and long windows](https://docs.chartnaut.com/scripting/summary-and-long-windows). Because `w.forever()` follows the plan, the same never-forgetting script can read differently on a Free account and a Pro account on intraday timeframes. When your state can be reset on a boundary, resetting it and declaring the span between resets removes that dependence. ## Asking for more than your plan allows Over-declaring is never an error. The script runs with your limit and tells you: - In the builder, the advisory `window/clamped-to-cap` names the effective values: *the declared warmup/retain for 1h exceeds your plan's 5,000-bucket cap and was clamped. Effective warmup 5000, retain 64.* - On the chart, the indicator shows "History capped": *This script asked for more 1h history than your plan's 5,000-bucket limit allows, so it measures from* a date. On Free it offers an upgrade. - In the script, `history.truncated` is `true` with `reason: "cap"`. The other ways history comes up short read the same way, with their own reason: | `reason` | What the chart says | Means | |---|---|---| | `cap` | History capped | You declared more than your memory limit | | `plan` | History limited by your plan | Your plan's history window stops there | | `instrument` | History starts at this instrument's first bar | Nothing earlier exists | | `floor` | History truncated | The platform's data starts on 2 February 2015 | Read it before stating an extreme: ```js const daily = timeframe("1d"); export function onBar(ctx) { const h = daily.history; const label = h.truncated ? `high since ${new Date(h.from * 1000).toISOString().slice(0, 10)}` : "all-time high"; } ``` ## How to tell warmup was not enough Too little warmup does not break a script. It leaves some of the starting point in each value, and that shows in one place: the grid boundaries, where every value's starting point moves forward. Signs: - A line takes a small step at regular intervals, one warmup's worth of bars apart, where price did nothing unusual. - The same indicator at a higher period steps more than at a lower one. - A level or swing that resets daily moves at those instants on a 5m chart, because it declared a count shorter than a day. To check, double the warmup and compare. If confirmed values move beyond the last digit you care about, the smaller number was short. Declare the named term rather than a number picked by eye: `w.ema` and `w.wilder` leave nothing visible. The lint catches the common mismatches, all on [Lint and error codes](https://docs.chartnaut.com/scripting/lint-and-error-codes): - `state/never-forgets`: a running sum, count or high declared with a count. Its value would mean "since the grid point" rather than "since the instrument began". Declare `w.forever()`, or reset it and declare the span between resets. - `window/forever-on-decaying`: `w.forever()` on state that only fades fetches your whole memory limit for no gain. Declare `w.ema` or `w.wilder`. - `window/decay-under-factor`: an EMA or Wilder average whose length is readable from the script, declared under 30x or 50x. - `window/reset-wants-span`: state that resets on `ctx.session.isStart` declared as a count. Declare `w.day()` or a span. ## Warmup and retain `retain(...)` answers a different question: how many past buckets stay readable through a timeframe handle's `bars(n)`. The maximum of the last 250 daily highs needs `retain({ "1d": 250 })` and no warmup, because nothing accumulates. Unset, 64 buckets of each timeframe stay readable. ```js retain(64); // every timeframe retain({ "1d": 250, "1h": 500 }); // per timeframe retain((r) => r.span("20d")); // 20 days of whichever timeframe is read retain((r) => r.max(r.of(lookback), 64)); // follows a setting retain((r) => r.forever()); // as far back as the plan allows ``` Both are capped by your memory limit. The details are on [Timeframe handles and runOn](https://docs.chartnaut.com/scripting/mtf-and-runon). --- # Seams and anchors URL: https://docs.chartnaut.com/scripting/seams-and-anchors/ Updated: 2026-11-22T22:28:35Z Where computed history joins, why every value starts its memory from a fixed point on a time grid, what is guaranteed at the straddling bucket, and what your script must do to keep it. A seam is a place where one stretch of computed history meets the next. Every chart has them: where the history loaded before your chart meets the chart's own bars, and at fixed points on a time grid where a script's memory restarts. An anchor is the fixed point a stretch starts its memory from. This page says what Chartnaut guarantees at seams and what your script must do to keep it. ## The problem anchors solve A script that remembers has to start remembering somewhere. The obvious place is the first bar available, and that is where most engines start. The first bar available is an accident: it depends on how far you scrolled, when you opened the chart, and whether the value is being computed in your browser or on a server running a definition over a date range. Two runs over the same bars that start in different places compute different values for the same bar, and no amount of extra history fixes it, because the gap moves with the start. Chartnaut starts memory from anchors instead. An anchor is a point on a grid laid over time itself, and the anchor for a bar is decided by the bar's own time and your declared warmup, nothing else. ## How the grid is laid Time on each timeframe is cut into stretches, each one warmup long, starting from the same UTC grid every bucket uses. With `warmup(1000)` on a 5m chart, each stretch is 1,000 five-minute bars. With `warmup((w) => w.day())`, each stretch is one UTC day on every timeframe: 288 bars on 5m, 24 on 1h, each starting at UTC midnight, so the chart and every timeframe handle share the same boundaries. Every bar inside a stretch is computed from a walk that starts at the beginning of the previous stretch. So each value has between one and two warmups of history behind it, and the start point is the same whoever asks. When the anchor would fall before the first bar of data, it is the first bar of data. On a coarse timeframe that makes the grid disappear: a daily EMA with a warmup longer than the daily history is computed over all of it, the full-history value. ## What anchors guarantee - A value on a confirmed bar is the same however much history your chart loaded, after a reload and after scrolling. - The chart and a run over history start each bar's memory from the same anchor, so they compute the same value. - Live values continue to match history. When a live chart crosses into a new stretch, Chartnaut recomputes from the new anchor, so the live value at that bar is the one a fresh load would give. - A replay computes each revealed bar exactly as a live chart would have. - A timeframe handle reads the same on every chart timeframe. A higher timeframe's anchor only moves when its own stretch does, and every grid tiles with every other. - Levels, zones and trendlines that seal when price takes them out seal on the same bar on the chart and on the server, across stretch boundaries. Their `expires` is a duration, so a level expires at the same instant on a 5m chart, a 4h chart and the server. ## The loading seam and the straddling bucket The other seam is where history loaded behind your chart meets the chart's bars. A timeframe handle reads two sources split at that instant: buckets that ended before it come from stored history at the handle's own timeframe, and buckets after it are built from the chart's bars. One higher-timeframe bucket usually straddles the seam: a day that started before your chart's first bar and ends after it. The chart's bars cover only its tail. Chartnaut guarantees: - When the straddling bucket closes, `last` and `bars(n)` hold its true open, high, low, close and volume for the whole bucket, the same bucket a chart that loaded all of it sees. - While it is still forming, `forming.open` is the true open. `forming.high`, `forming.low` and the running volume cover only the part on your chart until it closes. This matters only when your chart's history starts inside the current higher-timeframe bucket, such as a daily handle on a chart whose first bar is today. Read `forming` with that in mind, and use `last` for anything you fold into state. ## What a script must do to keep the guarantee Anchoring fixes where memory starts. It cannot fix state that ignores it. - Declare warmup honestly. A warmup shorter than your state's memory leaves part of the starting point in each value, visible as a step at each stretch boundary. Size it with the table on [Warmup and memory](https://docs.chartnaut.com/scripting/warmup-and-memory). - Size self-resetting state by its longest gap. A value that resets each session declares `warmup((w) => w.day())`, one day on every timeframe (288 bars on 5m), so each stretch starts at UTC midnight and never cuts a session short. - Keep memory in `ctx.accum` or a handle's state. Each stretch starts fresh and is rebuilt from its anchor, so nothing survives from the chart's first bar. State is correct when the walk from the anchor can rebuild it. - Declare `w.forever()` for state that never forgets, and know what it means on your plan: on intraday timeframes the origin moves one memory limit at a time. - Fold state once per bar. State that changes on each tick of the forming bar drifts from what history computes ([Bars and clocks](https://docs.chartnaut.com/scripting/bars-and-clocks)). - Key identity on `ctx.time`. `ctx.barIndex` restarts with each pass and each stretch. - Declare level lifecycle on the output: `output.hline({ id, mode: "invalidateOnCustomFunction", invalidateWhen: "wickAbove", expires: "5d" })`. A function passed per emission cannot be re-checked once its stretch is done, so the lint refuses it (`output/invalidate-per-emit-fn`). Pass per-level numbers through `meta` and read them in the declared rule. - Scope `oncePer` keys to time. Dedupe runs over the whole run, and a chart and a run over history start in different places. Include a time-bound payload field in `keys`, such as the session key `s.key`, and the result is the same in both. Keys whose values recur forever, such as a `side` field alone, fire once per run, wherever that run started. - Keep randomness and the wall clock out. `Math.random()` and `new Date()` do not give the same value in your browser and on the server. ## Seams you can see | Where | What you see | Is it expected? | |---|---|---| | A stretch boundary, one warmup of bars apart | A small step in a line | No: warmup is too short for the state | | A stretch boundary on a `w.forever()` intraday script | A cumulative line changes level | Yes: the origin moved one memory limit | | The loading seam | Nothing | Values are identical on either side | | The straddling bucket while forming | A forming high or low that misses the part before your chart | Yes, until the bucket closes | | The start of your plan's history window | "History limited by your plan" beside the indicator | Yes: values there have less history behind them | --- # Limits and errors URL: https://docs.chartnaut.com/scripting/limits-and-errors/ Updated: 2026-11-22T22:28:36Z Every limit a script or run can reach, per plan where it varies, what you see when you reach it, and the errors and warnings script authors meet with what to do about each. Every limit a script or a run can reach, in one place, with what you see when you reach it. Then the errors and warnings script authors meet most, what each means and what to do. Budgets are explained in more depth on [Budgets and limits](https://docs.chartnaut.com/scripting/budgets). ## Limits that depend on your plan | Limit | Free | Pro | |---|---|---| | Indicator memory, buckets per timeframe | 2,500 | 5,000 | | Indicators on one chart, dependencies included | 5 | 15 | | Extra timeframes one indicator reads, beyond the chart's own | 2 | 4 | | Script runs at once | 1 | 3 | | Stored definition events | 15,000 | 150,000 | | Datasets one script reads | 2 | 4 | | History window | 3 years | Since 2015 | What you see: - Indicator memory: the script runs with your limit, the chart shows "History capped" and the builder shows `window/clamped-to-cap`. See [Warmup and memory](https://docs.chartnaut.com/scripting/warmup-and-memory). - Indicators on one chart: counted over distinct indicators after dependencies are added, so one indicator that declares two dependencies counts as three, and a dependency shared by two indicators counts once. Past the limit the new indicator shows "too many indicators for your plan" and does not run. Nothing is removed. - Extra timeframes: counted from the timeframes the indicator reads with its current settings, not counting the chart's own. Past the limit it shows "reads too many timeframes" and does not run. Change its timeframe settings and it runs again. - Runs at once: dry runs by the agents, runs through the API and study runs share one pool per account. A run that finds every slot busy waits, and fails with *all of this account's run slots are in use* if none frees up. - Stored events: a definition running over history stops storing events when the account reaches its limit, and the run fails with *Collected events plan limit reached. Upgrade to continue collecting.* - History window: values near the start of the window show "History limited by your plan", and `history.reason` is `"plan"`. ## Limits on the chart These apply to indicators and definitions running in your browser, the same on every plan. | Limit | Hard limit | Warning at | |---|---|---| | One calculation pass | 30 seconds | 2 seconds | | One `onBar` or handler call | 5 seconds | | | Warmup walk through timeframe handlers | 10 seconds | 2.5 seconds | | Loop iterations in one handler call | 350,000 | | | Loop iterations in one pass | 10,000 per bar, between 2 million and 50 million | | | `ctx` calls in one handler call | 500,000 | | | Points plotted in one pass | 2,000,000 | 500,000 | | Events emitted in one pass | 100,000 | 25,000 | | `ctx.accum` slots | 1,024 | 256 | | Live levels, zones and trendlines | 10,000 | 2,500 | | Rows in one layer | 20,000 | 5,000 | | Size of one layer | 32 MB | 4 MB | A hard limit stops the indicator. Its status names the budget, the value reached and the limit, such as `indicator_points exceeded`, with the bar it stopped on and a suggested fix. A warning lets it run and tells you. The fixes are on [Budget exceeded](https://docs.chartnaut.com/scripting/budget-exceeded). ## Limits on the server These apply when a definition runs over history, when an indicator is computed on the server for a definition, and to dry runs. | Limit | Value | What you see | |---|---|---| | Compute time | 5 minutes per run, and per stretch of a run over history | *flow execution timeout: exceeded 5m0s* | | Events emitted in one run | 100,000 | *flow emit exceeded cap of 100000 events per run* | | Points plotted in one run | 2,000,000 | *indicator output exceeded cap of 2000000 points per run* | | Call depth | 1,024 nested calls | A stack overflow error | | Compiling the script | 30 seconds | A timeout | | Memory | Shared by every script running on the server | *memory_limit: the script used too much memory and was stopped* | The memory guard watches the server as a whole. When running scripts together pass its limit, every script running at that moment is stopped, because memory cannot be traced to one script. Run yours again. If it stops again, it is the one holding too much: an array that grows every bar and is never trimmed, or a map keyed by something unbounded. ## Limits on studies | Limit | Chart preview | Server run | |---|---|---| | Whole run | 10 minutes, warning at 2 | 10 minutes, warning at 8 | | One `onEvent` call | 15 seconds | 15 seconds | | Events measured | 50,000 | 100,000 | | Annotations | 10,000 | 10,000 | | Published payload | 2 MB | 100 MB | | Bars read forward from an event | 1,000 | 5,000 | | Rows collected per key / in total | 100,000 / 500,000 | 100,000 / 500,000 | | `onFinish` | 30 seconds | 30 seconds | Ten `onEvent` calls that time out stop the run as `too_many_event_timeouts`; ten that throw stop it as `too_many_event_errors`. Fewer are reported as warnings on the run. See [Study API](https://docs.chartnaut.com/scripting/study-api). ## Errors and warnings you will meet ### Lint on save An error means the script will not run as written; an advisory means it runs and something deserves a look. The ones tied to accuracy: - `window/warmup-required`: the script keeps state and declares no warmup. Declare one ([Warmup and memory](https://docs.chartnaut.com/scripting/warmup-and-memory)). - `window/warmup-inert`: a warmup with timeframe handles, none of which has a handler. There is nothing to walk; remove the warmup or add the handler. - `window/declare-with-call`: a `warmup` or `retain` key inside a definition's `meta({ window })`. Declare it with the `warmup(...)` or `retain(...)` call after your inputs. - `state/never-forgets`: a running total declared with a count. Declare `w.forever()`, or reset it and declare the span between resets. - `window/forever-on-decaying` (advisory): `w.forever()` on state that fades. Declare `w.ema` or `w.wilder`. - `window/reset-wants-span` (advisory): state that resets each session declared as a count. Declare `w.day()` or a span. - `window/decay-under-factor` (advisory): an EMA or Wilder average declared under 30x or 50x its length. Declare `w.ema` or `w.wilder`. - `window/clamped-to-cap` (advisory): more than your memory limit. It runs at the limit. - `output/expires-required`: a level that can be taken out needs `expires`, such as `"5d"` or `"max"`. - `output/invalidate-per-emit-fn`: move the rule to the output declaration. - `caps/non-deterministic`: `Date.now()`, `new Date()`, `performance.now()` or `crypto.randomUUID` in a definition. Read time from `ctx.time`. Every code is on [Lint and error codes](https://docs.chartnaut.com/scripting/lint-and-error-codes). ### A runtime error on one bar On the chart, a throw on any bar stops the indicator. Its status shows the message and the time of the bar it failed on. On the server, the error is recorded against that bar and the run continues with the next one. The usual cause is reading something that is not there yet: a dependency before its warmup, `handle.last` before the first close, `bars(n)` shorter than `n`. Guard it and return: ```js const atr = ctx.indicators.atr14?.atr?.value; if (atr == null) return; ``` ### A dependency's output is empty A definition run lists it with the dependency and output, for example *dependency output "trend.ema" (ema@v3) had zero finite values across the completed window*. Check the output id and version against the dependency, check its timeframe, and check that the window is longer than its warmup. See [Dependency unavailable](https://docs.chartnaut.com/scripting/dependency-unavailable). ### History is short "History capped", "History limited by your plan", "History starts at this instrument's first bar" and "History truncated" say the script ran with less history than it declared, and why. `history.truncated` and `history.reason` tell the script the same. "loading history" means the declared history is still arriving and the indicator waits for it rather than drawing a value that would change. "history not loaded" means nothing is fetching it: reload the chart. ### A budget was exceeded The status names the limit, the value reached and the bar. The fix depends on the limit: less work per bar for time and loop limits, fewer outputs for point and event limits, sealing old rows for layer limits. See [Budget exceeded](https://docs.chartnaut.com/scripting/budget-exceeded). ### The chart is on the wrong timeframe A script with `runOn` does not run on other timeframes. The chart names the timeframe it is on and the ones to switch to. Switch the chart, or widen `runOn` if the script is correct there ([Timeframe handles and runOn](https://docs.chartnaut.com/scripting/mtf-and-runon)). ### Not running on this plan "too many indicators for your plan" and "reads too many timeframes" leave the indicator on the chart without running it. Remove another indicator, reduce the timeframes in its settings, or upgrade. Nothing you added is deleted. --- # Nuances worth knowing URL: https://docs.chartnaut.com/scripting/nuances/ Updated: 2026-11-22T22:28:36Z Subtle behaviours that surprise script authors: forming-bar re-runs, barIndex, UTC days, Monday weeks, "max" per plan, oncePer across runs, errors on the chart and the server. Behaviours that follow from the guarantees and still surprise authors. Each entry says what happens and what to do. ## The forming bar runs many times `onBar` runs again for the forming bar on every tick. The chart rolls back what the previous tick wrote to `ctx.accum` first, so state steps once per bar. What it cannot roll back is a decision you showed: a cross on the forming bar can appear and vanish. Gate those on `ctx.barConfirmed !== false`. Patterns are on [Bars and clocks](https://docs.chartnaut.com/scripting/bars-and-clocks). `ctx.barConfirmed` is also `false` on the last bar of a server run that ends at the current time, such as a canvas attaching an indicator. It is `true` on every bar of a definition's run over history and of a dry run. ## ctx.barIndex is not an identity It counts from the start of the current pass, and a pass restarts at every stretch of the time grid and on every full recalculation. The same bar has different indices on your chart, in replay and on the server. Use `ctx.time` for ids, dedupe keys and "bars since" arithmetic: `(ctx.time - st.lastT) / 300` on a 5m chart. ## isLastBar is false in stored runs `ctx.isLastBar` is `true` only on the newest bar of the live chart and of a one-off run. In a definition, a study or a canvas it is always `false`, because those results are cached in pieces and the newest bar depends on when you run. Draw "on the last bar" with a `priceLine`, a `mode: "replace"` `hline` or a layer row, which keep only their latest emit. ## Skipping a plot joins the line A bar where you do not call `ctx.plot` is bridged: the line joins the values either side. To break it, emit `NaN`. See [Series types](https://docs.chartnaut.com/scripting/series-outputs). ## A daily bucket is a UTC day `timeframe("1d")` and `ctx.summary("1d", …)` measure midnight to midnight UTC. A London or New York session, or a forex trading day that starts at 17:00 New York time, is a session question. Use `ctx.session` with the `tz` you need ([Sessions](https://docs.chartnaut.com/scripting/session-api)). ## Weeks start on Monday The weekly bucket runs Monday 00:00 to Monday 00:00 UTC. Markets that open on Sunday evening put those hours in the previous week. ## The forming higher-timeframe bucket is still moving `daily.forming` at 14:35 holds today so far. Plotting it is fine; folding it into state from `onBar` folds a moving value once per chart bar. Fold closed buckets in the handle's handler and read `last` or `state` from `onBar`. ## closedThisBar depends on the chart `h.closedThisBar` counts buckets that closed on this chart bar: a 5m handle on a 1h chart reports 12 on each confirmed hour, and 1 on a 5m chart. The handle's values are identical on both charts; the count describes the chart bar you are on. ## The first forming bucket can miss its start When your chart's history starts inside the current higher-timeframe bucket, that bucket's `forming.high` and `forming.low` cover only the part on the chart until it closes. Its open is correct, and once it closes all its values are. Use `last` for anything that matters. ## A warmup that reads a setting never goes below 50 A `warmup(...)` expression that reads a number from a setting, such as `w.ema(length)`, resolves to at least 50 buckets, because a setting can hold a number nobody chose. A plain number and a span are used as written: `w.day()` on `1h` is 24. The floor does not affect correctness; it explains a walk longer than you declared. ## w.forever() follows the viewer's plan `w.forever()` resolves to the memory limit of whoever runs the script. On daily charts that reaches all the history they hold. On intraday charts a running total restarts its origin every memory limit, so two accounts on different plans can see a different level for the same cumulative line. Reset the state on a boundary and declare the span between resets when you can. ## Over-declaring costs time, never correctness A warmup larger than needed is fetched and walked every time the grid moves. It is clamped at your memory limit and reported, never refused. Size it from the table on [Warmup and memory](https://docs.chartnaut.com/scripting/warmup-and-memory) rather than rounding up to the limit. ## Session resets shorten the warmup a script needs A value that resets at every session open forgets everything before the reset, so its warmup is the longest gap between resets, whatever its lookback. Declare it as a length of time: `warmup((w) => w.day())` for a daily reset, which is 288 bars on 5m and 24 on 1h, and `w.span("7d")` for a weekly one. A span resolves on every timeframe the script runs on. ## oncePer dedupes over the whole run A run over history and a live chart start in different places. If the `oncePer` keys can repeat forever, the first match wins wherever the run began, and the two can disagree. Put a time-bound field, such as the session key, in the keys. ## A level can only be taken out by a declared rule Levels, zones and trendlines seal by the rule on their output declaration (`invalidateWhen` preset or declared function, or `invalidateOnEvent`), checked across the whole run on the chart and on the server. A function passed with one emission is refused, because once its stretch of the grid is done nothing can re-check it. Every sealing output also needs `expires`: a duration, so it expires at the same instant on every timeframe. ## A throw behaves differently on the chart and the server On the chart one throwing bar stops the indicator and names the bar. When a definition runs over history, the error is recorded for that bar and the run carries on. Guard every read that can be missing so neither happens. ## Math.random and the wall clock On the server `Math.random()` is seeded from the bar, so it repeats; in your browser it is not. `Date.now()` is refused in definitions and on the server. Scripts that need variety should derive it from `ctx.time` and the bar's prices. ## Dependencies run on their own timeframe A declared dependency read through a timeframe handler's `ctx.indicators` is computed on that handler's timeframe. The same dependency read from `onBar` is computed on the chart's timeframe. They are different series with different values, both correct. ## A shared script uses the viewer's plan Indicator memory, the indicator count and the timeframe count are the viewer's, so a script you publish can run with less history, or not run, on a smaller plan. Read `history.truncated` and say what the script measured. ## History arrives before values An indicator that declared history waits with "loading history" until it lands, so it never draws a provisional value. On a slow connection that wait is visible. "history not loaded" means nothing is fetching it; reload the chart. --- # Overview URL: https://docs.chartnaut.com/scripting/runtime-overview/ Updated: 2026-11-22T22:28:36Z Most of the scripting API is the same whether you write an indicator or a definition: reading price, declaring settings, drawing on the chart, reading other indicators, other ti... Most of the scripting API is the same whether you write an indicator or a definition: reading price, declaring settings, drawing on the chart, reading other indicators, other timeframes, sessions, limits and lint. This section covers those shared pieces. An [indicator](https://docs.chartnaut.com/guides/how-indicators-work) and a [definition](https://docs.chartnaut.com/guides/build-a-definition) run on the same per-bar runtime, so every `ctx` field on these pages exists on both. A [study](https://docs.chartnaut.com/guides/build-and-run-a-study) runs once per event instead, and has its own versions of a few of them. The Indicator, Definition and Study sections cover only what each type adds. ## Pages in this section | Page | Indicator | Definition | Study | |---|---|---|---| | [Price and bar data](https://docs.chartnaut.com/scripting/bar-fields) | yes | yes | candle helpers instead | | [Remembering values across bars](https://docs.chartnaut.com/scripting/accum-state) | yes | yes | no, use `ctx.collect` | | [Settings inputs and dialog](https://docs.chartnaut.com/scripting/inputs-dialog-layout) | yes | yes | no | | [Declaring indicator dependencies](https://docs.chartnaut.com/scripting/indicators-declare) | yes | yes | yes | | [Dependency outputs](https://docs.chartnaut.com/scripting/dependency-outputs) | yes | yes | yes | | [Drawing on the chart](https://docs.chartnaut.com/scripting/drawings-and-paint) | yes | yes | annotation helpers | | [Layers & rows](https://docs.chartnaut.com/scripting/layers-and-rows) | yes | yes | reads only | | [Timeframe handles and runOn](https://docs.chartnaut.com/scripting/mtf-and-runon) | yes | yes | `runOn` only | | [Summaries and long windows](https://docs.chartnaut.com/scripting/summary-and-long-windows) | yes | yes | no | | [Sessions](https://docs.chartnaut.com/scripting/session-api) | yes | yes | own helpers | | [Budgets and limits](https://docs.chartnaut.com/scripting/budgets) | yes | yes | yes | | [Lint and error codes](https://docs.chartnaut.com/scripting/lint-and-error-codes) | yes | yes | yes | What Chartnaut promises about these APIs, such as the same value on every chart and on the server, is on [What Chartnaut guarantees](https://docs.chartnaut.com/scripting/what-chartnaut-guarantees). ## Documented under each script type | Topic | Page | |---|---| | `meta` kinds, series outputs (`histogram`, `bandTemplate`, …), panes | [Indicator API](https://docs.chartnaut.com/scripting/indicator-api) | | `events.declare`, `ctx.emit`, imports, multi-file packages | [Definition API](https://docs.chartnaut.com/scripting/definition-api) | | `onEvent` / `onFinish`, `ctx.collect`, `ctx.publish`, chart pins | [Study API](https://docs.chartnaut.com/scripting/study-api) · [Show studies on charts](https://docs.chartnaut.com/scripting/show-studies-on-charts) | --- # Price and bar data URL: https://docs.chartnaut.com/scripting/bar-fields/ Updated: 2026-11-22T22:28:36Z Every call to onBar(ctx) hands you the current bar and the context around it: prices, volume, time, whether the bar has closed, the instrument and the chart. Indicators and defi... Every call to `onBar(ctx)` hands you the current bar and the context around it: prices, volume, time, whether the bar has closed, the instrument and the chart. Indicators and definitions get the same fields. Studies do not receive a bar. They read candles around each event instead: see [Results and stats](https://docs.chartnaut.com/scripting/results-and-stats). ## The bar | Field | Type | Meaning | |---|---|---| | `open` / `high` / `low` / `close` | number | OHLC of the current bar | | `volume` | number | Volume of the current bar | | `volumeBid` / `volumeAsk` | number | Bid and ask volume. `0` when the feed has no split | | `time` | number | Bar open time, unix seconds, UTC | | `barIndex` | number | 0-based index within this calculation pass | | `barConfirmed` | boolean | `false` only on the last bar of a run whose newest bar may still be printing | | `isLastBar` | boolean | `true` on the newest bar of the live chart and of a one-off run. Always `false` in definitions and stored runs | | `volumePriceLevels` | `PriceLevel[]` | Volume traded at each price on this bar. Needs the volume-candles data source | | `priceLevels` | `PriceLevel[]` | Deprecated name for `volumePriceLevels`. Same rows | | `params` | object | Resolved settings, keyed by input id. See [Settings inputs and dialog](https://docs.chartnaut.com/scripting/inputs-dialog-layout) | ## CFD volume FX, metals and index CFDs have no exchange volume, so Chartnaut measures quote activity instead. Each time the bid and the ask both move up, the bar gains 10,000 units of aggressive buying. Each time both move down, it gains 10,000 units of aggressive selling. A quote that moves only one side adds nothing. | Field | On a CFD bar | |---|---| | `volumeAsk` | Aggressive buying: units that lifted the offer | | `volumeBid` | Aggressive selling: units that hit the bid | | `volume` | `volumeBid + volumeAsk` | Delta is `volumeAsk - volumeBid`, positive when buyers were aggressive. History, the forming bar and the server all use this convention, so a delta indicator keeps its sign at the live edge. The level depends on the feed. A busier quote feed moves more often, so the same market reads higher on one provider than another, and the level steps when Chartnaut changes provider. Compare CFD volume within one stretch of history, and prefer ratios (VWAP, relative volume) over absolute thresholds. Some 1m bars are estimated: they were built from a provider's minute candles, which carry a tick count and no direction. Their volume is on another scale and their bid/ask split says nothing about who was aggressive. Scripts receive their stored values unchanged. `barIndex` restarts at 0 on every full recalculation and carries on from the last tick on an incremental update. For a counter that survives both, derive it from `ctx.time` or keep it in [`ctx.accum`](https://docs.chartnaut.com/scripting/accum-state). ## The forming bar On a live chart the runtime calls `onBar` again for the forming bar on every tick. Before each re-run the chart undoes what the previous run wrote to `ctx.accum`: plain values, objects and arrays go back to how the last closed bar left them, so a buffer that appends once per call still holds the forming bar once. Plain data is all a slot may hold, so this covers every slot: see [State with ctx.accum](https://docs.chartnaut.com/scripting/accum-state). Guard on `barConfirmed` when something must happen only on a close, such as a signal that must not appear and then vanish: ```js if (ctx.barConfirmed === false) return; // act on closed bars only ``` `barConfirmed` is `false` only on the last bar of a run whose newest bar may still be printing: the forming bar of the live chart, and the last bar of a server run that ends at the current time (a canvas attaching an indicator, a chart preparing a dependency, a study's visuals). It is `true` on every bar when a definition runs over history, in the agent's dry run and when a script runs over history. Test it with `=== false` or `!== false`. ## The newest bar `ctx.isLastBar` is `true` on the newest bar of the live chart, on every tick, and on the last bar of a one-off run: an indicator run with `chartnaut run` or `run_script`, the agent's dry run, and the last bar of a `mode: "once"` window. It is always `false` in definitions and in runs that are stored and stitched together: a definition's events, studies and canvases. There is no `lastBarIndex` or `lastBarTime`. Results are cached in pieces and reused by later runs, and which bar is newest depends on when you run, so a value that depended on it would differ between a cached piece and a fresh one. Use `isLastBar` for things drawn once at the right edge, with an output that keeps only its latest emit: ```js output.priceLine({ id: "last" }); export function onBar(ctx) { if (ctx.isLastBar) ctx.hline("last", ctx.close); // one level at the newest close } ``` A `mode: "replace"` `hline` or a [layer](https://docs.chartnaut.com/scripting/layers-and-rows) row works the same way. ## Time comes from the bar Scripts run over bars, not the wall clock, so the same bar gives the same answer on every chart and on the server. `Date.now()` throws. `new Date()` with no argument, `performance.now()` and `crypto.randomUUID()` fail lint with `caps/non-deterministic`. `new Date(ctx.time * 1000)` is fine. `Math.random()` works and is seeded per bar, so a bar draws the same numbers whichever window it is computed in. ## Instrument, chart and history | Field | Contents | |---|---| | `ctx.instrument` | `symbol`, `displaySymbol`, `tickSize`, `precision`, `multiplier`, `assetClass`, `category`, `sessions` (`{ start, end, type }` in exchange time) | | `ctx.chart` | `timeframe` (e.g. `"5m"`), `timeframeSeconds` | | `ctx.history` | `{ from, buckets, truncated, reason? }`: where this run's chart-timeframe history starts | | `ctx.log` | `info` / `warn` / `error(message, data?)`, shown in the builder's Logs tab | `ctx.instrument` has the same values on the chart and on the server, and never throws: an unknown instrument reads as `tickSize` 0.01, `precision` 2, `multiplier` 1. Size price rows and round levels with `tickSize`, never a literal. Check `ctx.history.truncated` before you call a value "all-time". `reason` is `"cap"`, `"plan"`, `"instrument"` or `"floor"`; see [Warmup and memory](https://docs.chartnaut.com/scripting/warmup-and-memory). `ctx.log` writes only in the indicator and definition builders, and a flood is truncated per calculation. `ctx.session` and `ctx.summary` have their own pages: [Sessions](https://docs.chartnaut.com/scripting/session-api) and [Summaries and long windows](https://docs.chartnaut.com/scripting/summary-and-long-windows). ## dataSource Set the feed on `meta`. The default is ordinary candles. ```js meta({ shortName: "Footprint", kind: "overlay", dataSource: { type: "volume-candles", settings: { purgeStrategy: "floor-aware" } }, }); ``` `type: "volume-candles"` loads the volume-at-price tape and fills `volumePriceLevels`. Without it the array is `[]`. The agent's dry run always leaves the tape empty, so check tape scripts on the chart preview. In the object form, `settings.purgeStrategy` is required: leave it out and lint fails with `meta/volume-candles-purge-required`. Write `"floor-aware"`. The string form `dataSource: "volume_candles"` needs no settings and runs as `"floor-aware"`. | `purgeStrategy` | What it does today | |---|---| | `"floor-aware"` | The chart keeps the tape for the bars in view plus 50 bars before them. Older rows past 4,000 bars move out of memory and load again when you scroll back. | | `"max-bars"` | Accepted by lint. Behaves the same as `"floor-aware"`. | | `"session-daily"` | Accepted by lint. The chart treats it as `"floor-aware"`. | The setting only concerns how the chart holds tape in memory. It never changes the rows a bar receives, and a definition run over history on the server ignores it. Each `PriceLevel` row has `price`, `totalVolume`, `totalBuyVolume`, `totalSellVolume`, `volumeDelta` and `batchCount`. `volumePriceLevels` is a volume profile: how much traded at each price. A TPO or market profile counts time instead. Build that by bucketing bars, for example in a `timeframe("30m")` handler, not by reading the tape. --- # Remembering values across bars URL: https://docs.chartnaut.com/scripting/accum-state/ Updated: 2026-11-22T22:28:36Z Anything your script remembers from one bar to the next, such as an EMA, a session open or a "closed above yesterday" flag, lives in ctx.accum. Never in a module-level let or var. Anything your script remembers from one bar to the next, such as an EMA, a session open or a "closed above yesterday" flag, lives in `ctx.accum`. Never in a module-level `let` or `var`. A module-level variable survives between runs, is shared by every copy of the script, and is not reset when the chart recalculates. Values drift, and the chart and the server stop agreeing. Inventing `let ema = …` at module scope is the most common mistake agents make on indicators and definitions. ## Signature ```ts ctx.accum(id: string, init: T | (() => T), update: (prev: T) => T): T ``` The same on indicators and definitions. `id` names the slot: pass the same string on every bar to read and write the same value. `init` seeds the slot on first use and may be a value or a function called once. `update` receives the previous value, and its return is stored and returned. ## Example The simplest form returns the next value from `update`. On history this is all you need: ```js function onBar(ctx) { const k = 2 / (ctx.params.length + 1); const ema = ctx.accum("ema", null, (prev) => prev == null ? ctx.close : prev + k * (ctx.close - prev) ); ctx.plot("ema", ema); } ``` On a live chart, `onBar` runs again for the forming bar on every tick. Before each re-run the chart rolls back what the previous run wrote to `ctx.accum`, so the form above steps the EMA once per bar, not once per tick. Scripts written before the rollback keep the last closed value and recompute the current one from it, which still works: ```js function onBar(ctx) { const k = 2 / (ctx.params.length + 1); const st = ctx.accum("ema", () => ({ t: null, base: null, cur: null }), (s) => s); if (st.t !== ctx.time) { // first call for this bar st.base = st.cur; // last bar's value becomes the base st.t = ctx.time; } st.cur = st.base == null ? ctx.close : st.base + k * (ctx.close - st.base); ctx.plot("ema", st.cur); } ``` The object form keeps several values in one slot: mutate it, with an `update` that returns it unchanged. For state that only needs closed bars, return early instead: ```js if (ctx.barConfirmed === false) return; // count each bar once const st = ctx.accum("st", () => ({ high: -Infinity, count: 0 }), (s) => s); st.high = Math.max(st.high, ctx.high); st.count += 1; ``` ## Rules - Keep slots to plain data: numbers, strings, booleans, `null`, plain objects and arrays. A function, a `Map`, a class instance or a timeframe handle in a slot fails with `DataCloneError`. - Use a stable, literal `id` per slot. A script can hold up to 1,024 slots; past 256 you get a warning. - `update` runs every time you call `ctx.accum`, including on every tick of the forming bar. The chart rolls back the forming bar's writes before each tick, so appends, counts and running values see each bar once. Guard on `ctx.barConfirmed === false` only for what must wait for the close. - A script that keeps state must declare how far back that state remembers, with a top-level `warmup(...)` call after its inputs, such as `warmup((w) => w.ema(length))` or `warmup((w) => w.day())` for state that resets each day. Without it lint fails with `window/warmup-required`. See [Warmup and memory](https://docs.chartnaut.com/scripting/warmup-and-memory). - State that never decays or resets, such as a running total or a latched flag, needs `warmup((w) => w.forever())`. A count fails lint with `state/never-forgets`. - Inside a timeframe handler, `ctx.accum(id, init, update?)` writes to that handle's `state`, and `update` is optional. See [Timeframe handles and runOn](https://docs.chartnaut.com/scripting/mtf-and-runon). ## Related state | Need | Use | |---|---| | At most one event per session, zone or key | `oncePer` on `events.declare`, never a dedupe map in `ctx.accum`. See [Emit and labels](https://docs.chartnaut.com/scripting/emit-and-labels) | | A scratch object for one run, definitions only | `ctx.store`, cleared between runs | | Values across events in a study | `ctx.collect`. Studies have no `ctx.accum`. See [Collect and publish](https://docs.chartnaut.com/scripting/collect-and-publish) | | A `mode: "once"` indicator | `ctx.accum` in `onBar`, as in any indicator. In `onRunEnd`, read window totals from `ctx.outputs`: state there is only the last piece computed | --- # Settings inputs and dialog URL: https://docs.chartnaut.com/scripting/inputs-dialog-layout/ Updated: 2026-11-22T22:28:36Z Settings a trader can change without editing code, such as a length, a colour or a higher timeframe, are declared at the top of the script with input.*, arranged with dialog and... Settings a trader can change without editing code, such as a length, a colour or a higher timeframe, are declared at the top of the script with `input.*`, arranged with `dialog` and `layout`, and read in `onBar` as `ctx.params.`. Indicators and definitions share the whole surface. ## The surface | API | Purpose | |---|---| | `dialog({ title, … })` | The settings window: title, description, size, reset-to-defaults, enabled checkbox | | `input.number` / `boolean` / `text` / `select` / `color` / `timeframe` | Single fields | | `input.multiSelect` / `lineStyle` / `lineWidth` / `range` / `array` | Richer fields | | `layout(tab(section(group(…))))` | Where each field sits in the dialog | | `when(handle)` | Show a field, tab, section or group only when a condition holds | `pane(...)` is not a setting. It routes outputs into a subpane: see [Panes & scales](https://docs.chartnaut.com/scripting/panes-and-scales). ## Inputs become ctx.params Every input needs an `id` and a `label`. In `onBar`, read `ctx.params.`. The handle `input.*` returns is for wiring only (`layout`, `when`, `colorFrom`, `timeframe(handle)`, `warmup`), never for reading the value. ```js dialog({ title: "EMA" }); const length = input.number({ id: "length", label: "Length", default: 20, min: 1 }); const color = input.color({ id: "color", label: "Color", default: "#2196f3" }); const htf = input.timeframe({ id: "htf", label: "Higher timeframe", default: "1h" }); layout( tab({ id: "main", title: "Main" }, section({ id: "params", title: "Parameters" }, length, color, htf)) ); function onBar(ctx) { const len = ctx.params.length; const tf = ctx.params.htf; // "1h" } ``` ## Field kinds | Kind | `ctx.params` value | Notable options | |---|---|---| | `number` | number | `min`, `max`, `step`, `precision`, `unit`, `slider` | | `boolean` | boolean | `variant`: `"checkbox"` / `"switch"` / `"toggle"` | | `text` | string | `placeholder`, `maxLength`, `multiline`, `rows` | | `select` | the chosen `value` | `options: [{ value, label, description? }]`, `layout: "select"` or `"radio"`, `searchable` | | `multiSelect` | array of values | `minSelections`, `maxSelections` | | `color` | hex or rgba string | `allowAlpha`, `presetColors` | | `lineStyle` | `LineStyle.*` | | | `lineWidth` | number | `min`, `max`, `step` | | `range` | `[min, max]` tuple | `min`, `max`, `step`, `marks` | | `timeframe` | timeframe string | `options`, `searchable` | | `array` | array of row objects | `itemTemplate`, `defaultItems`, `minItems`, `maxItems` | Every kind also takes `description`, `tooltip`, `visibleWhen`, `disabled` and `required`. Colour, line style and line width inputs are cosmetic by default (`isCosmetic`): changing them restyles the output without counting as a different setting. ```js dialog({ title: "Zones", description: "Configure zone filters" }); const modes = input.multiSelect({ id: "modes", label: "Modes", default: ["fast"], options: [ { value: "fast", label: "Fast" }, { value: "slow", label: "Slow" }, ], }); const band = input.range({ id: "band", label: "Band", default: [20, 80], min: 0, max: 100 }); const rows = input.array({ id: "rows", label: "Rows", defaultItems: [{ enabled: true, n: 1 }], itemTemplate: (input) => { input.boolean({ id: "enabled", label: "On", default: true, isEnableField: true }); input.number({ id: "n", label: "N", default: 1, min: 1 }); }, }); layout( tab({ id: "main", title: "Main" }, section({ id: "p", title: "Params" }, modes, band, rows)) ); ``` Inside `itemTemplate`, ids only need to be unique within the row. Arrays cannot nest. `isEnableField: true` marks a row's on/off switch. On both indicators and definitions, `input.array` gives you a list of rows in `ctx.params.`. Expanding the rows into chart series with `output.bandTemplate` is indicator-only: see [Series types](https://docs.chartnaut.com/scripting/series-outputs). ## Layout `layout(...)` takes `tab(...)` nodes in dialog order. A tab holds `section(...)` nodes. A section holds input handles and `group(...)` nodes, and groups can nest. Tabs and sections take a `title`; a group takes a `label`. Sections accept `columns`, `collapsible` and `defaultCollapsed`; groups accept `border`. ## when: conditional visibility `when(handle)` starts a condition. Chain `equals`, `notEquals`, `gt`, `lt`, `includes` or `notIncludes`, and combine with `and` / `or`. Pass it as `visibleWhen` on an input, tab, section or group. ```js const mode = input.select({ id: "mode", label: "Mode", default: "simple", options: [ { value: "simple", label: "Simple" }, { value: "advanced", label: "Advanced" }, ], }); const depth = input.number({ id: "depth", label: "Depth", default: 3, visibleWhen: when(mode).equals("advanced"), }); ``` Inside `itemTemplate`, refer to a sibling field by id: `when("enabled").equals(true)`. ## Timeframe inputs `input.timeframe` values come from the palette `1m`, `5m`, `15m`, `30m`, `1h`, `2h`, `4h`, `1d`, `1w`, `1mo` (the calendar month). `default` must be one of them, and `options`, when given, must include the default. Case does not matter, except that a capital `M` means months: `1M` is `1mo`. To read the chosen timeframe, pass the handle itself to `timeframe(htf)` at module scope. There is no `ctx.params` at module scope, and a timeframe string built by concatenation is rejected. An `input.select` whose options all look like timeframes gets the warning `tf/use-input-timeframe`, and `timeframe(selectHandle)` does not build. See [Timeframe handles and runOn](https://docs.chartnaut.com/scripting/mtf-and-runon). ## Definitions and meta.params Definitions also accept the older `meta({ params: { id: { type, def, … } } })` form, with types `number`, `string`, `boolean`, `color`, `timeframe`, `multiSelect`, `range` and `array`. The two forms merge. Write new scripts with `input.*`: it gives layout and every field kind above. --- # Declaring indicator dependencies URL: https://docs.chartnaut.com/scripting/indicators-declare/ Updated: 2026-11-22T22:28:36Z A script can build on another indicator, such as ATR or VWAP, by declaring it once at the top of the file and reading its values on ctx.indicators. Indicators, definitions and s... A script can build on another indicator, such as ATR or VWAP, by declaring it once at the top of the file and reading its values on `ctx.indicators`. Indicators, definitions and studies declare dependencies the same way. ## Declare ```js indicators.declare({ slug: "atr", as: "atr14", version: 1, settings: { period: 14 } }); ``` | Field | Role | |---|---| | `slug` | The indicator's slug: a built-in, a scripted indicator or a definition | | `as` | Your local name. You read `ctx.indicators.`. Unique within the script | | `version` | Required. The exact version you read, so an upstream edit never changes your numbers. Built-in indicators always use `version: 1` | | `settings` | Optional. Merged on top of the dependency's default settings, so pass only what you change | Call it at the top level, next to the inputs. A missing version fails lint with `indicators/missing-version`, a version that does not exist with `indicators/version-not-found`, and an unknown slug with `indicators/unknown-slug`. Two declarations with the same `as` fail with `indicators/duplicate-as`, and a script that ends up depending on itself fails with `indicators/cycle`. When the Agent writes a script, it looks up a dependency's real output keys with `resolve_dependency_contract`, and asks you to approve adding one with `request_add_indicator`. Look the contract up the same way before you guess a key. ## Read in an indicator or definition Values are always nested under the dependency's declared output key, even when it has a single output: ```js function onBar(ctx) { const v = ctx.indicators.atr14.atr.value; // ctx.indicators.. if (v == null) return; ctx.plot("atr_copy", v); } ``` There is no `.value` on the alias itself. `ctx.indicators.atr14.value` fails lint with `indicators/container-series-read`, which also names the keys that exist. ### Each output key | Member | Returns | |---|---| | `value` | This bar's value, never carried forward. `undefined` on bars the dependency did not emit | | `at(offset)` | The value `offset` emits back. It counts emits, not bars: on a sparse output, `at(1)` is the previous emitted value, wherever it was | | `last()` | The most recent defined value, carried forward over gaps. Not a sign that the value is fresh | | `lastTime()` | Bar time of that value, unix seconds | | `history(maxBars?)` | Recent values, oldest first, with gaps kept as `undefined` | ### The alias itself | Method | Returns | |---|---| | `lifecycle(query?)` | Formation and close state of the dependency's ranges, hlines and trendlines | | `ranges` / `hlines` / `marks` / `plots` / `trendlines(query?)` | Raw paint rows. Not the authority on whether something closed | | `layer(id, query?)` | Rows of one of the dependency's layers. See [Layers & rows](https://docs.chartnaut.com/scripting/layers-and-rows) | A range is not a numeric series. To ask which zones are alive on this bar, use `lifecycle`: ```js const live = ctx.indicators.fvg.lifecycle({ outputId: "gaps", at: ctx.time }); for (const z of live) { // z.bounds.price1 / price2, z.createdAt, z.meta } ``` A `lifecycle` query takes `outputId`, `kind` (`"range"`, `"hline"`, `"trendline"`), `state` (`"live"`, `"closed"`, `"any"`, default `"any"`), `at`, and the window filters `after`, `before`, `limit` and `window: [secondsBefore, secondsAfter]`. `at` returns instances alive on that bar and ignores `after` / `before`. `state: "live"` means still live at the end of the loaded history, so a zone that closed later does not count on earlier bars: use `at: ctx.time` for "alive on this bar". An `outputId` the dependency never declared returns nothing, silently, which looks exactly like "the pattern never formed". Each instance carries `instanceId`, `state`, `createdAt`, `updatedAt`, `closedAt`, `closeReason` (`"predicate"`, `"event"`, `"replace"`, `"expired"`), `bounds` and `meta`. Inside a [timeframe handler](https://docs.chartnaut.com/scripting/mtf-and-runon), `ctx.indicators` has the same shape, computed on that timeframe's own bars. A dependency that is itself a scripted indicator reads `undefined` there. An indicator with a `bandTemplate` exposes one key per row, such as `upper_2`. Get the real keys from the contract rather than guessing. ## Read in a study A study reads the same nested shape, positioned at the event's time: ```js export function onEvent(ctx) { const atr = ctx.indicators.atr14?.atr?.value; if (atr == null) return; ctx.collect("atr", atr); } ``` Studies also get `valueAt(unixSec)`, `valuesInRange(from, to)` and `historyAt(unixSec, maxBars?)` on each output key, for reading at a time other than the event's, such as the bar where price touched a level. A study declares the definitions whose events it measures with `flows.declare`: see [Declarations](https://docs.chartnaut.com/scripting/declarations). ## Empty values are normal A correct declaration still gives `undefined` during the dependency's warmup, on bars it did not emit, and across data gaps. Guard every read. See [Dependency outputs](https://docs.chartnaut.com/scripting/dependency-outputs). --- # Dependency outputs URL: https://docs.chartnaut.com/scripting/dependency-outputs/ Updated: 2026-11-22T22:28:37Z A correct indicators.declare does not put a number on every bar. The dependency's warmup, bars it chose not to emit, and gaps in the data all read as undefined. Guard every read... A correct `indicators.declare` does not put a number on every bar. The dependency's warmup, bars it chose not to emit, and gaps in the data all read as `undefined`. Guard every read, and treat an empty value as "skip this bar", not as zero. ## Pattern 1. Declare the dependency with `indicators.declare`, and in a study the definitions it measures with `flows.declare`. See [Declaring indicator dependencies](https://docs.chartnaut.com/scripting/indicators-declare). 2. Read through `ctx.indicators..`, `ctx.flows.` or the event payload. 3. Check for `null` / `undefined` before you plot, emit or collect. ```js function onBar(ctx) { const v = ctx.indicators.atr14.atr.value; if (v == null) return; // declared, no value on this bar ctx.plot("atr", v); } ``` Never plot `undefined` or `NaN`: skip the call instead. ## Declared vs had data | What you see | Meaning | Fix | |---|---|---| | Lint error on the declare or the read | The slug, version or output key is wrong | Fix the declaration or the key. The lint message lists the keys that exist | | `undefined` on some bars | Warmup, a sparse output or a data gap | Guard and skip | | `dependency_output_unavailable` | Your script read this output, and it had no finite value anywhere in the calculated window | Check the dependency's settings, its `runOn` against your chart timeframe, and its data source | `dependency_output_unavailable` fires only for an output your script actually read, so an unused output never warns. It names the alias, the slug, the version and the output key. [Dependency unavailable](https://docs.chartnaut.com/scripting/dependency-unavailable) walks through the common causes. ## Sparse outputs Some outputs emit only on certain bars, such as a swing-high marker. On the other bars `value` is `undefined`. Use `last()` for the most recent emitted value and `lastTime()` for when it happened. `at(1)` is the previous emit, not the previous bar. ## Ranges and levels Zones, levels and trendlines are not series. Read them through `lifecycle()` on the alias, which says whether each one is live or closed and why. The raw `ranges()` / `hlines()` rows are paint data: a non-`replace` hline can have several segments at once, and the rows do not tell you which closed. --- # Drawing on the chart URL: https://docs.chartnaut.com/scripting/drawings-and-paint/ Updated: 2026-11-22T22:28:37Z Everything a script draws, whether a line, a marker, a level or a zone, follows one pattern: declare the output at the top of the file, then draw it from onBar with the matching... Everything a script draws, whether a line, a marker, a level or a zone, follows one pattern: declare the output at the top of the file, then draw it from `onBar` with the matching `ctx.*` call and the same id. ## Declare | Script | How you declare | |---|---| | Indicator | `output.line`, `histogram`, `area`, `baseline`, `fill`, `markers`, `priceLine`, `hline`, `range`, `trendline`, `bandTemplate`, `layer` | | Definition | `outputs.declare({ id, kind })` with kind `line`, `histogram`, `area`, `baseline`, `fill`, `mark`, `note`, `priceLine`, `hline`, `range` or `trendline`; `output.layer` for layers | | Study | No declaration. Annotation helpers take their own ids: see the table at the end | The older definition shortcuts `output.line` / `output.mark` / `output.hline` still work. Use `outputs.declare` in new definitions. ## Declare kind to ctx call | Kind | Draw with | |---|---| | `line` | `ctx.plot(id, value, color?)`. `color` overrides this bar onward. `NaN` breaks the line | | `histogram` | `ctx.bar(id, value, color?)`. `color` overrides one bar, for MACD-style red and green | | `area` / `baseline` | `ctx.area(id, value, color?)` / `ctx.baseline(id, value)`. `NaN` breaks the line | | `fill` | `ctx.fill(id, top, bottom, color?)`. `NaN` in either bound breaks the ribbon | | `markers` (indicator) / `mark` (definition) | `ctx.mark(id, { price?, text?, shape?, position?, time? })` | | `markers` (indicator) / `note` (definition) | `ctx.note(id, { price, text })`: text at a price, no glyph | | `markers` (indicator) | `ctx.label(id, { price, text })`: text tethered to a price on this bar | | `priceLine` | `ctx.hline(id, price)` with no `time1`: a chart-wide line. Indicators only | | `hline` | `ctx.hline(id, price, { time1 })`: a level that starts at `time1` | | `range` | `ctx.range(id, { time1, time2, price1, price2 })` | | `trendline` | `ctx.trendline(id, { time1, price1, time2, price2 })` | | `layer` | `handle.upsert(row)` / `patch` / `seal`. See [Layers & rows](https://docs.chartnaut.com/scripting/layers-and-rows) | A bar where you skip the call is bridged: the line joins the values either side. Emit `NaN`, `null` or `undefined` to break it, as Pine's `plot.style_linebr` does. A per-bar colour wins over the colour set in the settings dialog, so pick it from `input.color` settings. See [Series types](https://docs.chartnaut.com/scripting/series-outputs). A call whose id is not declared fails lint with `outputs/unknown-id`, and a call that does not match the declared kind with `outputs/kind-mismatch`. A declared output that is never drawn warns with `outputs/declared-unused`. An `hline` output draws only emissions that carry `time1`. Without it the level is invisible, and a definition fails lint with `outputs/hline-missing-time1`. Use `time1: ctx.time` for "starts at this bar", or the time of the swing, open or breakout the level belongs to. For a chart-wide line on an indicator, declare `output.priceLine` instead. ## Example (definition) ```js outputs.declare({ id: "close_line", kind: "line", name: "Close", color: "#64b5f6" }); outputs.declare({ id: "signal", kind: "mark", name: "Signal", labelMode: "onHover" }); outputs.declare({ id: "zone", kind: "range", name: "Zone" }); export function onBar(ctx) { ctx.plot("close_line", ctx.close); if (ctx.close > ctx.open) { ctx.mark("signal", { price: ctx.high, text: "Up", position: "atPriceTop" }); } ctx.range("zone", { time1: ctx.time, time2: ctx.time, price1: ctx.low, price2: ctx.high, }); } ``` ## Markers `ctx.mark` always takes two arguments, the output id and an object. `ctx.mark` fills in `time` (this bar), `shape` (`"circle"`) and `position` (`"aboveBar"`) when you leave them out. Shapes are `"circle"`, `"square"`, `"arrowUp"`, `"arrowDown"` and `"none"`. Positions `"aboveBar"`, `"belowBar"` and `"inBar"` anchor to the candle and ignore `price`. Positions `"atPriceTop"`, `"atPriceMiddle"` and `"atPriceBottom"` anchor to an exact price and need `price`. Pass `time` to place a marker on an earlier bar, such as a swing you confirmed a few bars later. ## Lifecycle: how levels, zones and trendlines end `hline`, `range` and `trendline` outputs take a `mode` on the declaration: | Mode | Behaviour | |---|---| | `"replace"` (default) | One live drawing per id. Each emit moves or grows it | | `"all"` | Each distinct `time1` is its own drawing, and nothing closes it. A range ends at the `time2` you pass. The same `time1` refreshes in place | | `"invalidateOnCustomFunction"` | Like `"all"`, and each drawing closes on the first later bar where `invalidateWhen` is true | | `"invalidateOnEvent"` | Like `"all"`, and every live drawing closes when one of the `invalidateOnEvent` event ids fires | Under `"all"`, give every emit a fresh `time1`. A literal `time1` collapses every emit onto one drawing. The two invalidating modes also need `expires`: how long a drawing stays live if nothing takes it out. It is a duration, `"30m"`, `"12h"`, `"5d"`, `"4w"`, or `"max"` for no expiry. Time rather than bars, so it means the same on every chart timeframe and on the server. Missing `expires` fails lint with `output/expires-required`; `expires` on a mode that never closes warns with `output/expires-without-mode`. ```js output.hline({ id: "pdh", mode: "invalidateOnCustomFunction", invalidateWhen: "wickAbove", expires: "5d", labelMode: "always", }); ``` On each bar the engine checks events first, then the predicate, then expiry. The bar a drawing is born on never closes it. A drawing that expires closes with `closeReason: "expired"`. ### Backdated drawings and `sweepFrom` `time1` is where a drawing starts on the chart. It can be earlier than the bar that emits it: a swing high you confirm three bars later, or a zone you only know once its last bar closes. Under `"invalidateOnCustomFunction"`, such a drawing is checked against the bars in between as well. On the bar that emits it, Chartnaut runs `invalidateWhen` over every bar after `time1` up to and including that bar, and closes the drawing at the first one where it holds. A swing level price already took out is born closed instead of painting through the break. The `time1` bar itself is never checked. That is wrong when those bars are the ones that formed the drawing. They touch it by construction, so a touch or wick rule holds on the first of them and the drawing closes one bar after `time1`. Declare `sweepFrom: "birth"` and the rule is first checked on the bar after the emitting bar. The drawing still starts at `time1`. ```js output.range({ id: "zone", mode: "invalidateOnCustomFunction", invalidateWhen: "enter", sweepFrom: "birth", expires: "10d", }); ``` | `sweepFrom` | First bar the rule is checked | |---|---| | `"anchor"` (default) | The bar after `time1`, replayed on the emitting bar | | `"birth"` | The bar after the emitting bar | `sweepFrom` works the same on definition `outputs.declare`, with presets and with functions. It has no effect under the other modes, and expiry always counts from the emitting bar. A range with a fixed end, known when you emit it, is mode `"all"` with a `time2`. Under the invalidating modes `time2` is ignored while the range is live: it reaches the newest bar until its rule closes it. A rule that always returns `true` closes every drawing on the first bar it checks and fails lint. `expires` is available on indicator `output.hline`, `output.range` and `output.trendline`. Definition `outputs.declare` does not take it yet. ### Presets | Output | Presets for `invalidateWhen` | |---|---| | `range` | `"enter"`, `"exit"`, `"tradeThrough"`, `"closeInside"`, `"closeBeyond"`, `"closeAbove"`, `"closeBelow"`, `"wickAbove"`, `"wickBelow"` | | `hline` | `"wickAny"`, `"closeOnly"`, `"closeAbove"`, `"closeBelow"`, `"wickAbove"`, `"wickBelow"` | | `trendline` | None. A function only | There is no default predicate. `"invalidateOnCustomFunction"` without `invalidateWhen` fails lint with `outputs/invalidate-needs-policy`, and does nothing at runtime. ### Custom predicates A function on the declaration receives `{ bar, entry, history }`. `bar` is the bar being checked (`time`, `open`, `high`, `low`, `close`). `entry` is the drawing: `top` / `bottom` for a range, `price` for an hline, the endpoints for a trendline, plus `id`, `time1`, `emittedAt`, `ageBars` and your `meta`. `history` is the bars before `bar`, oldest first; on the chart it holds at most the last 200. Return `true` to close. Keep it pure: no side effects, no async. Destructure the argument as `({ bar, entry, history })`: a predicate that reads `ctx.low` is reading the wrong shape and fails lint with `output/invalidate-predicate-shape`, and naming the argument `ctx` warns with `output/invalidate-predicate-ctx-name`. ```js output.range({ id: "zone", mode: "invalidateOnCustomFunction", invalidateWhen: ({ bar, entry }) => entry.meta.dir === "bull" ? bar.low <= entry.bottom : bar.high >= entry.top, expires: "10d", }); // in onBar, when this bar finds a bullish zone { low, high } ctx.range("zone", { time1: ctx.time, time2: ctx.time, price1: zone.low, price2: zone.high, meta: { dir: "bull" }, }); ``` Put the rule on the declaration and pass per-drawing numbers through `meta`. A per-emit `invalidateWhen` accepts a preset name. A function on an emit fails lint with `output/invalidate-per-emit-fn`: the engine cannot re-check it after the stretch of history that created it, on the chart or on the server. `meta` is plain JSON. Scripts that read these drawings from another script use `ctx.indicators..lifecycle()`: see [Declaring indicator dependencies](https://docs.chartnaut.com/scripting/indicators-declare). ## Labels | Option | Values | |---|---| | `labelMode` | `"always"`, `"onHover"`, `"onLastBar"`, `"none"` | | `labelDedupe` | `"none"`, `"byBar"`, `"byPrice"` | | `labelPosition` on `output.hline` | `"right"` (default), `"top"`, `"bottom"` | | Call | Lint | |---|---| | `ctx.mark` | warns `outputs/mark-missing-text` when `labelMode` is `"always"` or `"onHover"` and `text` is missing | | `ctx.range` | warns `outputs/range-missing-label` when `labelMode` is `"always"` and `label` is missing | | `ctx.note` | fails `outputs/note-missing-price` without `price` | | `ctx.trendline` | fails `outputs/trendline-missing-coords` without all four coordinates | ## Study annotations Studies draw with their own helpers, which take times explicitly: | Call | Signature | |---|---| | plot | `ctx.plot(id, time, value)` | | mark | `ctx.mark(time, price, opts)`. Always pass `opts`, `{}` if you have none | | hline | `ctx.hline(price, opts?)` | | range | `ctx.range(id, time1, time2, opts?)` | | note | `ctx.note(time, text)` | ## Empty values Skip the call when a value is not ready. Never draw `NaN` or `undefined`. ```js if (ema == null) return; ctx.plot("ema", ema); ``` Series options, such as a histogram's `base` and fills between two lines, and the indicator-only `bandTemplate` are on [Series types](https://docs.chartnaut.com/scripting/series-outputs). --- # Layers & rows URL: https://docs.chartnaut.com/scripting/layers-and-rows/ Updated: 2026-11-22T22:28:37Z output.layer is the fourth output family, after series, markers and the hline / range / trendline lane. Its output is rows: keyed, schema-typed records written from onBar / onRu... `output.layer` is the fourth output family, after series, markers and the hline / range / trendline lane. Its output is **rows**: keyed, schema-typed records written from `onBar` / `onRunEnd`, stored per layer, and readable by other scripts. Indicators and definitions declare layers with the same shape. This page covers the row model and how rows travel. Drawing them is [Layers](https://docs.chartnaut.com/scripting/layers) and [Painting a layer](https://docs.chartnaut.com/scripting/layer-render). ## The row model A row is what a person would point at: one session, one bar, one detected zone, one thing somebody drew. It is also the unit the host culls, ships across the worker boundary and seals. ```js const zones = output.layer({ id: "zones", key: "start", // the field(s) that identify a row; default "id" row: { start: "number" }, // fields a person may set; persisted for drawn rows derived: { top: "number", bottom: "number" }, // fields hooks compute; never persisted time: { start: "start" }, // which fields bound a row in time (culling) expires: "10d", // how long a live row lives if nothing seals it claims: { rowsPer: "event", seals: true }, // what one row is; checked by the bench }); ``` | Option | Meaning | |---|---| | `id` | Required. Names the layer in the manifest and in `.layer(id)` reads. | | `key` | A `row` field, or an array of them for a composite key. Default `"id"`: you then pass `id` on `upsert`. | | `row` | Required. Fields a person may set through a gesture; a hook that creates a row must supply every one. | | `derived` | Fields hooks compute. `float32array`, `bins` and `grid` are legal only here. | | `time` | `start` (a `row` field) and `end` (any field) bound a row in time. Default start: the key when it holds a time, else `createdAt`. Default end: `closedAt`. | | `expires` | `"5d"`, `"4w"`, `"90m"`, `"12h"` or `"max"`. Required once the layer registers `sealWhen` or `sealOn` (lint `layer/expires-required`). | | `persist` | `{ version }` for drawn rows, default `{ version: 1 }`. Bump it when `row` changes shape; stored rows with another version are dropped on load. `false` keeps drawn rows for the session only. | | `claims` | `{ rowsPer, seals }`. Required on a layer that paints. See [Layers](https://docs.chartnaut.com/scripting/layers). | | `name`, `visibleFrom`, `z`, `pane`, `scale` | Legend name, a boolean input that toggles it, paint order (`"bottom" \\| "normal" \\| "top"`), pane and price scale. | Field types are `"number"`, `"string"`, `"boolean"`, `"object"`, `"array"`, `"float32array"`, `"bins"`, `"grid"`, `{ enum: [...] }`, or the object form `{ type, label, default }`, which labels the field in a drawn row's settings dialog. ### What the host stamps Every stored row carries fields you never write. The names are reserved. | Field | Meaning | |---|---| | `id` | The key as a string for script rows. A `user-…` id for rows a person drew. | | `createdAt` | Bar time of the first write. It never moves. | | `updatedAt` | Bar time of the latest write. | | `closedAt` | Bar time the row was sealed. Absent while the row is live. | | `closeReason` | `"explicit"` (`seal(key)`), `"predicate"` (`sealWhen`), `"event"` (`sealOn`) or `"expired"` (`expires` elapsed). | | `closeDetail` | The event id for `"event"`, `"custom"` for `"predicate"`. | ### Lifecycle 1. The first `upsert` for a key creates the row and stamps `createdAt`. 2. Later `upsert` calls replace the row; `patch` merges into it. Key fields never change through `patch`. A write with identical values is not a change and ships nothing. 3. The row seals once: through `seal(key)`, a `sealWhen` predicate, a `sealOn` event or `expires`. A sealed row keeps painting as finished and rejects writes. In the builder a write to a sealed key throws; on the chart it is ignored with one warning. 4. `remove(key)` deletes a row. Use `seal` for a row that ended and `remove` for a row that was wrong or too old to keep. Hooks cannot remove a row a person drew. The seal sweep runs after `onBar` on every bar, over live rows created strictly before that bar, so the bar that creates a row never seals it. `sealOn` runs first, then `sealWhen`, then `expires`. The Go runtime that runs definitions over history uses the same order. A seal is never undone, and the forming bar re-runs on every tick, so judge a break on a closed bar: `c.history[c.history.length - 1]` is the last closed bar before the one being swept. ### Handle methods | Method | Live in | Notes | |---|---|---| | `upsert(row, opts?)` | `onBar`, `onRunEnd`, gestures | Replace by key; drops `derived` fields the new row omits. `opts.time` is required in `onRunEnd`. | | `patch(key, partial, opts?)` | same | Merge. | | `seal(key, opts?)` / `remove(key)` | same | See the lifecycle above. | | `get(key)` / `last()` / `range(t1, t2)` | everywhere | Indexed. `range` returns rows alive anywhere in `[t1, t2]`. | | `rows()` | everywhere | Scans every row; lint `layer/rows-in-bar-hook` warns inside `onBar`. | | `layout`, `paint`, `paintGL`, `hit`, `autoscale`, `legend`, `gesture`, `sealWhen`, `sealOn` | module scope, once each | Registrations. | Rows are plain data: numbers, strings, booleans, plain objects and arrays, `Float32Array`, and the two containers. A function in a row fails at `upsert` with the field named. A container's wire form is its own enumerable properties, so it survives `structuredClone`, the Go runtime and JSON unchanged, and the worker ships only the bin range that changed. ## Reading rows from other scripts A script that [declares](https://docs.chartnaut.com/scripting/indicators-declare) a layer-producing indicator reads its rows on the alias: ```js indicators.declare({ slug: "initial-balance", as: "ib", version: 1 }); // in onBar const live = ctx.indicators.ib.layer("ib", { state: "live", at: ctx.time }); ``` A [study](https://docs.chartnaut.com/scripting/study-api) reads a definition's rows the same way, at the event time: ```js const boxes = ctx.flows.session.layer("boxes", { at: ctx.event.time }); ``` | Query field | Effect | |---|---| | `state` | `"live"`, `"closed"` or `"any"` (default). | | `at` | Rows alive at that second: `createdAt <= at` and (`closedAt` absent or `closedAt > at`). Ignores `after` / `before`. | | `after` / `before` | Filter by `createdAt`. | | `limit` | Keeps the latest N when `before` is set without `after`, else the first N. | | `window` | `[from, to]`, as on the other visual queries. | Rows come back sorted by `createdAt`, then `id`, with every field typed `unknown`: wrap numbers in `Number(...)`. `Float32Array` fields arrive intact and `bins` / `grid` fields arrive as read-only views with the full read surface (`at(price)`, `argmax()`, `valueArea`, `counts`). The schema is in the producer's manifest under `outputs[id]`; never guess a field name. An app built on a canvas attaches a layer by its output id on a record attach and receives the rows as a `Collection`. Read fields off the row, never through a dotted output key such as `tpo.poc`. The paint half never reaches a canvas. ## In a definition Declare with `output.layer(...)` exactly as an indicator does. `boxes.sealOn("sessionClosed")` seals live rows when the definition emits that event on a later bar. `outputs.declare({ kind: "layer" })` records the schema only and returns no handle, so nothing can write rows; lint warns `outputs/layer-use-output-layer`. Running a definition over history stores its rows beside its events. ## Examples ### Gaps that close when price trades through them Three-bar fair value gaps as event rows, sealed by `sealWhen` when a closed bar closes beyond the far edge. Detection reads only closed bars, so a tick on the forming bar never creates or seals a gap. ```js meta({ shortName: "FVG", kind: "overlay" }); dialog({ title: "Fair value gaps", description: "Three-bar gaps that stay open until a bar closes through them." }); const minTicks = input.number({ id: "minTicks", label: "Minimum gap (ticks)", default: 4, min: 1, step: 1 }); const bullColor = input.color({ id: "bullColor", label: "Bullish gap", default: "#26a69a" }); const bearColor = input.color({ id: "bearColor", label: "Bearish gap", default: "#ef5350" }); warmup((w) => w.forever()); // an open gap can sit for days before a bar closes through it layout(tab({ id: "main", title: "Main" }, section({ id: "s", title: "Settings" }, minTicks, bullColor, bearColor))); const gaps = output.layer({ id: "gaps", key: "start", row: { start: "number" }, derived: { top: "number", bottom: "number", side: { enum: ["bull", "bear"] } }, name: "Fair value gaps", time: { start: "start" }, // no end field: live rows run to the right edge, sealed rows end at closedAt expires: "10d", claims: { rowsPer: "event", seals: true }, }); // Judge the last CLOSED bar before the swept one: a seal is permanent. gaps.sealWhen((row, c) => { const prev = c.history[c.history.length - 1]; if (!prev || row.top === undefined || row.bottom === undefined) return false; return row.side === "bull" ? prev.close < row.bottom : prev.close > row.top; }); /** @param {ScriptedCtx} ctx */ export function onBar(ctx) { const st = ctx.accum("gaps", () => ({ t: /** @type {number[]} */ ([]), h: /** @type {number[]} */ ([]), l: /** @type {number[]} */ ([]), keys: /** @type {number[]} */ ([]), }), (s) => s); const last = st.t.length - 1; if (last >= 0 && st.t[last] === ctx.time) return; // forming bar again: nothing new has closed st.t.push(ctx.time); st.h.push(ctx.high); st.l.push(ctx.low); if (st.t.length > 4) { st.t.shift(); st.h.shift(); st.l.shift(); } if (st.t.length < 4) return; // Entries 0..2 are the three bars before this one, all closed. const gap = ctx.instrument.tickSize * Number(ctx.params.minTicks); const start = st.t[1]; if (gaps.get(start)) return; if (st.l[2] - st.h[0] >= gap) gaps.upsert({ start, top: st.l[2], bottom: st.h[0], side: "bull" }); else if (st.l[0] - st.h[2] >= gap) gaps.upsert({ start, top: st.l[0], bottom: st.h[2], side: "bear" }); else return; st.keys.push(start); if (st.keys.length > 1500) gaps.remove(st.keys.shift()); // stay far under the row caps } gaps.paint((p, rows) => { for (const r of rows) { if (r.top === undefined || r.bottom === undefined) continue; const live = r.closedAt === undefined; const { x0, w } = p.spanX(r.start, live ? "edge" : r.closedAt); const { top, h } = p.spanY(r.top, r.bottom); const color = String(r.side === "bull" ? p.params.bullColor : p.params.bearColor); p.alpha(live ? 0.3 : 0.12, () => p.rect(x0, top, w, Math.max(1, h), color)); } }); gaps.legend((p, rows) => `${rows.filter((r) => r.closedAt === undefined).length} open`); ``` ### A session box per day One row per session, keyed by the session open, written on every bar of the session and sealed explicitly on the first bar of the next one. `high` and `low` only grow, so re-running the forming bar writes the same row. ```js meta({ shortName: "London box", kind: "overlay" }); dialog({ title: "Session box", description: "The London session's range as a box, one per day." }); const boxColor = input.color({ id: "boxColor", label: "Outline", default: "#90a4ae" }); warmup((w) => w.day()); // one session layout(tab({ id: "main", title: "Main" }, section({ id: "s", title: "Style" }, boxColor))); const sessions = output.layer({ id: "sessions", key: "start", row: { start: "number" }, derived: { end: "number", open: "number", high: "number", low: "number", close: "number" }, name: "Session boxes", time: { start: "start", end: "end" }, claims: { rowsPer: "session", seals: true }, }); /** @param {ScriptedCtx} ctx */ export function onBar(ctx) { const s = ctx.session({ period: "daily", open: { hour: 8 }, close: { hour: 16, minute: 30 }, tz: "Europe/London" }); const previous = sessions.last(); if (previous && previous.start !== s.start && previous.closedAt === undefined) sessions.seal(previous.start); if (!s.isOpen) return; const cur = sessions.get(s.start); sessions.upsert({ start: s.start, end: ctx.time, open: cur ? cur.open ?? ctx.open : ctx.open, high: Math.max(cur ? cur.high ?? ctx.high : ctx.high, ctx.high), low: Math.min(cur ? cur.low ?? ctx.low : ctx.low, ctx.low), close: ctx.close, }); } sessions.paint((p, rows) => { const outline = String(p.params.boxColor); for (const r of rows) { if (r.high === undefined || r.low === undefined || r.end === undefined) continue; const { x0, w } = p.spanX(r.start, r.end + p.chart.timeframeSeconds); const { top, h } = p.spanY(r.high, r.low); const up = (r.close ?? 0) >= (r.open ?? 0); p.alpha(0.1, () => p.rect(x0, top, w, h, up ? p.theme.upColor : p.theme.downColor)); p.rect(x0, top, w, h, undefined, outline, 1); const label = `${Math.round((r.high - r.low) / p.instrument.tickSize)} ticks`; const font = p.fit(label, w, p.theme.fontSize + 6); if (font) p.text(label, x0 + w / 2, top - 2, { font, align: "center", baseline: "bottom", color: outline }); } }); ``` ### A row set another script reads The producer writes one initial balance row per session. The reader plots extension levels from the live row and skips the plot while the balance is still forming, which leaves a gap between sessions. ```js // Producer. Save it with the slug "initial-balance". meta({ shortName: "IB", kind: "overlay" }); dialog({ title: "Initial balance" }); const ibMinutes = input.number({ id: "ibMinutes", label: "Initial balance (minutes)", default: 60, min: 5, step: 5 }); const ibColor = input.color({ id: "ibColor", label: "Colour", default: "#ffb300" }); warmup((w) => w.day()); // one session layout(tab({ id: "main", title: "Main" }, section({ id: "s", title: "Settings" }, ibMinutes, ibColor))); const ib = output.layer({ id: "ib", key: "start", row: { start: "number" }, derived: { end: "number", ibEnd: "number", ibHigh: "number", ibLow: "number", complete: "boolean" }, name: "Initial balance", time: { start: "start", end: "end" }, claims: { rowsPer: "session", seals: true }, }); /** @param {ScriptedCtx} ctx */ export function onBar(ctx) { const s = ctx.session({ period: "daily", open: { hour: 8 }, close: { hour: 16, minute: 30 }, tz: "Europe/London" }); const previous = ib.last(); if (previous && previous.start !== s.start && previous.closedAt === undefined) ib.seal(previous.start); if (!s.isOpen) return; const ibEnd = s.start + Number(ctx.params.ibMinutes) * 60; const inIb = ctx.time < ibEnd; const cur = ib.get(s.start); const hi = cur ? cur.ibHigh ?? ctx.high : ctx.high; const lo = cur ? cur.ibLow ?? ctx.low : ctx.low; ib.upsert({ start: s.start, end: ctx.time, ibEnd, ibHigh: inIb ? Math.max(hi, ctx.high) : hi, ibLow: inIb ? Math.min(lo, ctx.low) : lo, complete: !inIb, }); } ib.paint((p, rows) => { const color = String(p.params.ibColor); for (const r of rows) { if (r.ibHigh === undefined || r.ibLow === undefined || r.ibEnd === undefined) continue; const { x0, w } = p.spanX(r.start, r.ibEnd); const { top, h } = p.spanY(r.ibHigh, r.ibLow); p.alpha(0.15, () => p.rect(x0, top, w, h, color)); const span = /** @type {const} */ ([r.start, r.closedAt === undefined ? "edge" : r.closedAt]); p.priceLine(r.ibHigh, { color, label: "IBH", span, axisLabel: r.closedAt === undefined }); p.priceLine(r.ibLow, { color, label: "IBL", span, axisLabel: r.closedAt === undefined }); } }); ``` ```js // Reader: a separate indicator. meta({ shortName: "IB ext", kind: "overlay" }); dialog({ title: "Initial balance extensions" }); const mult = input.number({ id: "mult", label: "Extension (× IB range)", default: 1, min: 0.25, step: 0.25 }); layout(tab({ id: "main", title: "Main" }, section({ id: "s", title: "Settings" }, mult))); indicators.declare({ slug: "initial-balance", as: "ib", version: 1 }); output.line({ id: "extUp", color: "#26a69a" }); output.line({ id: "extDown", color: "#ef5350" }); /** @param {ScriptedCtx} ctx */ export function onBar(ctx) { const live = ctx.indicators.ib.layer("ib", { state: "live", at: ctx.time }); const row = live[live.length - 1]; if (!row || row.complete !== true) return; // no plot: a gap while the balance forms const hi = Number(row.ibHigh); const lo = Number(row.ibLow); const ext = (hi - lo) * Number(ctx.params.mult); ctx.plot("extUp", hi + ext); ctx.plot("extDown", lo - ext); } ``` ## Budget | Cap | Soft | Hard | |---|---|---| | Rows per layer | 5,000 | 20,000 | | Bytes per layer | 4 MiB | 32 MiB | | Persisted drawn rows per layer | | 500 | A hard cap raises a `layer_rows` or `layer_bytes` budget error naming the layer. Coarsen the key (one row per session, not per bar) and `remove` the oldest rows, as the gap example does. ## Lint | Rule | Severity | Fix | |---|---|---| | `layer/no-write-in-renderer` | error | Move `upsert` / `patch` / `seal` / `remove`, and any `ctx` reference, out of `layout` / `paint` / `paintGL` / `hit` / `autoscale` / `legend`. | | `layer/no-write-in-timeframe-handler` | error | Write from the chart `onBar`, not inside a `timeframe(...)` handler. | | `layer/expires-required` | error | Add `expires` to a layer that registers `sealWhen` or `sealOn`. | | `layer/upsert-never-called` | error | Nothing writes rows and the layer has no `gesture`. | | `layer/rows-in-bar-hook` | warn | Use `get` / `last` / `range` in `onBar` and `onRunEnd`. | | `layer/renderer-not-registered` | warn | No `paint` or `paintGL`: a data-only layer. Fine when intended. | | `layer/escape-hatch` | warn | `p.all`, `p.bitmap`, `g.raw` or `g.program` in use. | | `outputs/layer-use-output-layer` | warn | Definitions: `outputs.declare({ kind: "layer" })` gives no handle. | --- # Timeframe handles and runOn URL: https://docs.chartnaut.com/scripting/mtf-and-runon/ Updated: 2026-11-22T22:28:37Z To read another timeframe, such as a daily EMA on a 5-minute chart, declare a timeframe(...) handle at module scope. To limit which chart timeframes a script runs on, set runOn ... To read another timeframe, such as a daily EMA on a 5-minute chart, declare a `timeframe(...)` handle at module scope. To limit which chart timeframes a script runs on, set `runOn` in `meta`. How far back each timeframe reaches is set by `warmup` and `retain`, covered at the end of this page. ## runOn ```js meta({ shortName: "OR", kind: "overlay", runOn: ["1m", "5m"], runOnReason: "The opening range is built from intraday bars", }); ``` `runOn` is an allow-list of chart timeframes. On any other timeframe the script does not run, and Charts shows `runOnReason`. Leave it out to allow every timeframe. Definitions and studies take the same two fields. `runOn` does not load any extra timeframe: that is what handles are for. ## Timeframe handles ```ts timeframe(source, options?): TimeframeHandle handle.onBar((ctx: TimeframeCtx) => void): handle // optional, at most once per handle ``` `source` is a timeframe literal (`"1m"`, `"5m"`, `"15m"`, `"30m"`, `"1h"`, `"2h"`, `"4h"`, `"1d"`, `"1w"`, `"1mo"`), `"chart"` for the chart's own timeframe, or an `input.timeframe` handle. `?:`, `??`, `||` and `&&` over those are accepted. Anything else, such as `ctx.params.htf` or a concatenated string, fails lint with `tf/untyped-source` or `tf/no-ctx-at-module-scope`. ```js meta({ shortName: "D-EMA", kind: "overlay" }); const daily = timeframe("1d"); daily.onBar((ctx) => { const st = ctx.accum("ema", () => ({ e800: NaN })); st.e800 = Number.isFinite(st.e800) ? st.e800 + (2 / 801) * (ctx.close - st.e800) : ctx.close; }); warmup(24000); // about 30x the EMA length, in daily buckets; clamped to your plan's memory function onBar(ctx) { const e = daily.state.ema && daily.state.ema.e800; if (Number.isFinite(e)) ctx.plot("ema800", e); } ``` The handler runs on the timeframe's own bars: once per closed bucket, oldest first, starting with the history loaded before the chart begins, so its state has converged by the first visible bar. What it keeps in `ctx.accum` is the handle's `state`: `ctx.accum("ema", …)` in the handler is `daily.state.ema` in `onBar`. A handler produces no output. `plot`, `emit`, `hline`, `range`, `mark` and layer writes throw inside it (`timeframe/no-output-in-handler`). The chart's `onBar` is the only place that draws or emits, and it reads the handle. ### The handler ctx The handler receives the closed bucket, not a chart bar: | Field | Meaning | |---|---| | `open` / `high` / `low` / `close` / `volume` / `volumeBid` / `volumeAsk` / `time` | The bucket | | `barIndex` | Bucket index within the run; negative for warmup buckets | | `timeframe` | The timeframe this handle resolved to | | `params`, `state`, `accum(id, init, update?)` | Settings and this handle's state | | `bars(n)` | The last `n` closed buckets, the current one last. Bounded by `retain` | | `tf(other)` | A handle listed in `reads`: see below | | `indicators` | Declared dependencies, computed on this timeframe's bars | | `volumePriceLevels`, `history`, `summary`, `log`, `instrument`, `chart` | As in `onBar`. `summary` resolves as of this bucket's end; `chart` is still the chart's timeframe | ## What onBar reads | Read | Meaning | |---|---| | `daily.state` | The handler's state. Shared and mutable: `onBar` may write to it, for example to drop a zone | | `daily.last` | The newest closed bucket. `undefined` before the first close | | `daily.forming` | The bucket containing the current chart bar. Higher timeframes only | | `daily.closedThisBar` | How many buckets closed on this chart bar: 0 or 1 for a higher timeframe, 0 to n for a lower one, 1 for the chart's own on a confirmed bar | | `daily.bars(n)` | The last `n` closed buckets, oldest first. Bounded by `retain` | | `daily.history` | Where this timeframe's history starts, and whether it was cut | | `daily.timeframe` | The resolved timeframe string | Every read looks back only: `last` and `bars(n)` never include the forming bucket. Each bucket has `open`, `high`, `low`, `close`, `volume`, `volumeBid`, `volumeAsk`, `time` (bucket start) and `barIndex`. ## Acting once per close ```js if (daily.closedThisBar && daily.state.signal) { ctx.emit("sig", { dir: daily.state.signal }, { label: "Daily signal" }); } ``` The handler ran exactly once for the bucket that just closed, and `closedThisBar` is non-zero on that chart bar only. Do not remember a bucket time to detect the close yourself. ## When a bucket closes A bucket closes on the chart bar whose end reaches the bucket's end: the daily closes on the 23:55 bar of a 5-minute chart, not on the 00:00 bar after it, once a later bar confirms the 23:55 bar. On a live chart that is a tick after midnight. Everything ending at one instant closes in one step: at Monday 00:00 the 1m bucket, the 4h, the day, the week and the chart bar itself. Within that step every bucket is sealed, then handlers run in declaration order, then `onBar`. 4h buckets start at 00:00, 04:00, 08:00, 12:00, 16:00 and 20:00 UTC. Weeks start Monday 00:00 UTC. ## Chart-timeframe and lower-timeframe handles `timeframe("chart")`, or a literal equal to the chart's timeframe, runs its handler once per confirmed chart bar. `last` is the newest confirmed bar, `closedThisBar` is 1 on a confirmed bar and 0 on the forming one, and `bars(n)` is empty. A lower timeframe, such as `timeframe("1m")` on a 5-minute chart, reads a separate, finer feed. Its handler runs once for each 1m bucket that closed inside the chart bar, oldest first, and `m1.bars(m1.closedThisBar)` is exactly those buckets. A lower timeframe has no forming bucket. Two handles on one timeframe share the data and keep separate state. ## Reading another handle from a handler A handler sees only its own timeframe unless it declares what else it reads: ```js const weekly = timeframe("1w"); weekly.onBar((ctx) => { /* ctx.state.ema, ctx.state.bias */ }); const daily = timeframe("1d", { reads: [weekly] }); daily.onBar((ctx) => { const w = ctx.tf(weekly); // weekly, already advanced through this instant ctx.state.streak = ctx.close > w.state.ema ? (ctx.state.streak || 0) + 1 : 0; }); ``` - `reads` may name only handles declared above. Naming one declared below fails with `tf/reads-forward-reference`, and naming something that is not a handle fails with `tf/reads-not-a-handle`. Two handles can never read each other. - `ctx.tf(other)` returns `{ last, forming, state, closedThisBar }`, advanced through the current instant, live and during the warmup walk alike. - `ctx.tf(x)` for anything not in `reads` is refused with `timeframe/undeclared-read`, and that handler stops for the run. To reach the chart's bars from a handler, declare `const chart = timeframe("chart")` above it and list it in `reads`. - A handle listed in `reads` that its handler never reads warns with `timeframe/reads-unused`. If two handles need each other, split the state by direction: keep the weekly EMA in `weekly`, let `daily` read it, and add `const weekView = timeframe("1w", { reads: [daily] })` below it for the week's view of its days. Anything stateless belongs in `onBar`, where every handle has already advanced. ## Rules - Declare handles and register handlers at module scope, next to the inputs. A handle inside a function fails with `tf/handle-not-module-scope`; a second `onBar` on one handle fails with `tf/duplicate-handler`. - Never build a timeframe string by concatenation. - Guard `undefined`: `last` is undefined until the first close. - `ctx.security`, and `ctx.tf` inside `onBar`, have been removed. Lint `tf/security-removed` names the rewrite. - `meta.window.timeframes` is deprecated. Handles declare what the script reads. - In a `mode: "once"` indicator, handles work exactly as in any indicator, from `onBar`. In `onRunEnd`, `handle.state` and `handle.last` are as of the window's end. ## Studies Studies have no timeframe handles. Measure forward and backward from the event with the candle helpers: see [Results and stats](https://docs.chartnaut.com/scripting/results-and-stats). The timeframe a study runs on is the one its definitions' events were recorded on, so match `runOn` to theirs. ## History depth: warmup and retain Two top-level calls set how much history a script gets. Both go after the inputs, because they can read input handles. | Call | Meaning | Declare it when | |---|---|---| | `warmup(...)` | How far back the script's state remembers: buckets walked before the range, so state that accumulates has converged | The script keeps state: an EMA, a running extreme, a zone list | | `retain(...)` | Buckets readable through `handle.bars(n)` and a handler's `ctx.bars(n)`. Default 64 | The script reads a span rather than accumulating over it | Both count buckets of the timeframe being read, and each timeframe the script reads resolves its own count. A constant is the same count everywhere: `warmup(1000)` means 1,000 5-minute bars for `onBar` and 1,000 daily buckets for a daily handle. A span is the same length of time everywhere: `w.day()` is 288 buckets for a 5m `onBar` and 24 for an hourly handle. A script that keeps state must declare `warmup`, or lint fails with `window/warmup-required`. A script that keeps none declares nothing. A `warmup` on a script that declares handles but registers no handler has nothing to walk, and fails to compile with `window/warmup-inert`. ### Declaring warmup ```js const period = input.number({ id: "period", label: "Period", default: 20, min: 1 }); warmup((w) => w.ema(period)); // follows the setting the reader picks ``` Call it once. The builder `w`: ```js warmup(1000) // a constant count of bars warmup((w) => w.window(period)) // a lookback of `period` bars warmup((w) => w.ema(period)) // EMA convergence: 30x the period warmup((w) => w.wilder(period)) // Wilder smoothing (RSI, ATR, ADX): 50x the period warmup((w) => w.span("1d")) // a length of time: 1,440 bars on 1m, 288 on 5m, 24 on 1h warmup((w) => w.day()) // the same as span("1d") warmup((w) => w.of(period).times(0.5)) // a setting scaled by your own factor warmup((w) => w.range(band, "hi").times(30)) // one end of an input.range warmup((w) => w.maxOf(lengths).times(30)) // the largest value of a numeric multiSelect warmup((w) => w.maxOf(rows, "length").times(30)) // a field across input.array rows warmup((w) => w.sumOf(rows, "length").times(30)) // summed across rows warmup((w) => w.sum(w.ema(slow), w.ema(signal))) // stages that feed each other add up (MACD) warmup((w) => w.max(w.day(), w.wilder(period))) // the larger of two needs warmup((w) => w.when(maType) // branch on a select .is(["SMA", "WMA"]).then(w.window(period)) .is("EMA").then(w.ema(period)) .otherwise(w.wilder(period))) warmup((w) => w.when(useSlow).then(w.ema(slow)).otherwise(w.ema(fast))) // a boolean warmup((w) => w.forever()) // never forgets: as far back as the plan allows ``` Span units are `m`, `h`, `d` and `w`: `"90m"`, `"4h"`, `"3d"`, `"2w"`. Pass input handles, never id strings. A colour, line style or line width input cannot drive warmup. Disabled `input.array` rows still count, so toggling a row does not change the depth. ### How deep | State | Warmup | |---|---| | A lookback of N bars: SMA, Donchian, a rolling percentile | `w.window(period)` | | Exponential: EMA | `w.ema(period)` | | Wilder / RMA: RSI, ATR, ADX | `w.wilder(period)` | | Resets every session or day: a session VWAP, anything gated on `ctx.session` | `w.day()` | | Resets weekly or monthly | The longest gap between resets: `w.span("7d")`, `w.span("31d")` | | Carries the previous session forward | The span that covers it: `w.span("3d")` reaches across a weekend | | Never forgets: a running total, a count, a latched flag | `w.forever()`. A count fails lint with `state/never-forgets` | Warmup covers every piece of state in the script, so one never-forgetting accumulator makes the whole declaration `w.forever()`. `w.forever()` on state that only decays warns with `window/forever-on-decaying`. A plain number and a span are taken as written. An expression that reads a number from a setting resolves to at least 50 bars, because a setting can hold a number nobody chose, such as `0`. The full resolution rules are on [Warmup and memory](https://docs.chartnaut.com/scripting/warmup-and-memory). ### Declaring retain `retain(...)` changes what can be read back, never what is walked. The maximum of the last 250 daily highs needs `retain({ "1d": 250 })` and no warmup, because nothing accumulates. ```js meta({ shortName: "ATH-250", kind: "overlay" }); const daily = timeframe("1d"); retain({ "1d": 250 }); function onBar(ctx) { const highs = daily.bars(250).map((b) => b.high); if (highs.length > 0) ctx.plot("hi250", Math.max(...highs)); } ``` The forms: ```js retain(64) // every timeframe retain({ "1d": 250, "1h": 500 }) // per timeframe retain((r) => r.span("20d")) // 20 days of whichever timeframe is read retain((r) => r.max(r.of(lookback), 64)) // follows a setting retain((r) => r.forever()) // as far back as the plan allows ``` `r` has the shared terms: `r.of`, `r.range`, `r.sum`, `r.max`, `r.maxOf`, `r.sumOf`, `r.when`, `r.span`, `r.day` and `r.forever`. A span resolves per timeframe, so `r.span("20d")` keeps 20 daily buckets on a daily handle and 480 on an hourly one. ### The memory cap Both depths are capped per timeframe at your plan's indicator memory: Free 2,500 and Pro 5,000 buckets. `w.forever()` and `r.forever()` resolve to that number. Over-declaring is clamped and warns with `window/clamped-to-cap`, never an error. See [Budgets and limits](https://docs.chartnaut.com/scripting/budgets) and [Indicator memory](https://docs.chartnaut.com/account/indicator-memory). ### Say what you can support `ctx.history`, `handle.history` and a handler's `ctx.history` report where history actually starts: ```ts { from: number; buckets: number; truncated: boolean; reason?: "cap" | "plan" | "instrument" | "floor" } ``` A script that labels a value "all-time high" while `truncated` is true is wrong in a way nobody checks. Read it before stating an extreme. To find an extreme, a total or a period's open over a long span, use `ctx.summary` instead of a bigger warmup: see [Summaries and long windows](https://docs.chartnaut.com/scripting/summary-and-long-windows). Why the numbers match on every chart and on the server, and how the warmup walk is anchored, is on [Warmup and memory](https://docs.chartnaut.com/scripting/warmup-and-memory) and [Seams and anchors](https://docs.chartnaut.com/scripting/seams-and-anchors). --- # Summaries and long windows URL: https://docs.chartnaut.com/scripting/summary-and-long-windows/ Updated: 2026-11-22T22:28:37Z ctx.summary answers "what was the highest high, lowest low, first open, last close or total volume over this span" without loading the span's bars. Use it for all-time highs, 52... `ctx.summary` answers "what was the highest high, lowest low, first open, last close or total volume over this span" without loading the span's bars. Use it for all-time highs, 52-week ranges and last month's levels. A script asks history two kinds of question: - A fold walks bars in order: an EMA, a zone list, a swing structure. It needs the bars, so its depth is a `warmup` count, capped by your plan's memory. See [Timeframe handles and runOn](https://docs.chartnaut.com/scripting/mtf-and-runon). - A reduce wants one answer over a span. `ctx.summary` answers it from native history, and the answer is the same size whether the span is a week or a decade. Raising `warmup` to find a maximum is the mistake this page exists to prevent. Two years of 5-minute bars is about 200,000 rows, far past any plan's memory, to produce one number. ## ctx.summary(timeframe, window) ```js const all = ctx.summary("1d", { since: "all" }); // everything available const yr = ctx.summary("1h", { since: "52w" }); // rolling year const mtd = ctx.summary("4h", { since: "month" }); // month to date const lastM = ctx.summary("1d", { period: "month", back: 1 }); // last month, complete const fromD = ctx.summary("5m", { since: "2026-01-01" }); // from a date ``` | Window | Meaning | |---|---| | `{ since: "all" }` | Everything your plan and the instrument allow | | `{ since: "30d" }` | A duration back: `m`, `h`, `d` or `w` | | `{ since: "2026-01-01" }` | From that UTC midnight | | `{ since: "month" }` | The current period to date. Also `"day"`, `"week"`, `"quarter"`, `"year"` | | `{ period, back }` | A whole previous period. `back: 1` is the last complete one | Calendar arithmetic is UTC and weeks start Monday. A duration of a day or more starts at the UTC midnight on or before the start it names; `from` in the result reports the real start. Shorter durations are exact. Both arguments must be known before the script runs: a timeframe literal or an `input.timeframe`-backed `ctx.params.`, and an object literal window. Lint enforces it with `summary/missing-window`, `summary/untyped-window` and `summary/invalid-window`. `timeframe` may be the chart's own or any higher one. A lower timeframe reads `undefined` and records an error. A summary needs no `warmup(...)` or `retain(...)`. The runtime sees each `ctx.summary` call and loads what it needs. ## What it returns ```ts { maxHigh, minLow, firstOpen, lastClose, sumVolume, from, to, truncated, reason? } | undefined ``` Only quantities that come out the same however the span is split: the maximum of a week is the maximum of its days. That is why there is no bar count and no price-times-volume sum. An anchored VWAP over a long span is not a summary question. `to` is the end of the last closed bucket of `timeframe` at or before the current bar, so a summary never includes the forming bucket or the current bar. Add them yourself for "including right now": ```js const all = ctx.summary("1d", { since: "all" }); const ath = Math.max(all?.maxHigh ?? -Infinity, ctx.high); ctx.hline("ath", ath); if (all?.truncated) ctx.log.warn(`high since ${all.from}`); // not an all-time high ``` It is `undefined` before the first bucket of `timeframe` has closed, and on a lower-timeframe read. Guard for it. ## Truncation `truncated` is true when history could not reach the window's start. `reason` says why: | reason | Means | |---|---| | `plan` | Your plan's history window stops there | | `instrument` | The instrument's first available bar | | `floor` | The platform's data floor, 2 February 2015 | When the history on your device does not reach far enough back, Chartnaut asks the server for the older part once. Until the answer arrives the value is defined but `truncated`, and the indicator shows as waiting; when it lands, the script runs again. Offline, the local answer stands, marked truncated. Read `truncated` either way before you call a number "all-time". ## Where the answer comes from The span's body is served from whole UTC days of daily history, and only the ragged ends from bars of `timeframe`. So a 52-week window at 5m costs a few hundred rows, not 75,000, and the maximum is the same number. A window whose start moves every bar, such as a rolling `since: "30d"` replayed over history, is answered from the history already loaded for past bars; only the current window is asked of the server. Inside a [timeframe handler](https://docs.chartnaut.com/scripting/mtf-and-runon), `ctx.summary` resolves as of the end of the bucket being handled. ## Recipes ```js // 52-week position, any chart timeframe const yr = ctx.summary("1d", { since: "52w" }); if (yr) ctx.plot("pos52w", (ctx.close - yr.minLow) / (yr.maxHigh - yr.minLow)); // Last month's range as levels const m = ctx.summary("1d", { period: "month", back: 1 }); if (m) { ctx.hline("mHigh", m.maxHigh); ctx.hline("mLow", m.minLow); } // Drawdown from this year's high const y = ctx.summary("1d", { since: "year" }); if (y) ctx.plot("ddFromYtdHigh", (ctx.close - y.maxHigh) / y.maxHigh); ``` `ctx.hline(id, price)` here draws a chart-wide line, so declare those ids with `output.priceLine`. --- # Sessions URL: https://docs.chartnaut.com/scripting/session-api/ Updated: 2026-11-22T22:28:37Z ctx.session tells a script when a session opens and closes, so you key logic off session boundaries instead of clock arithmetic. Indicators and definitions share one API; studie... `ctx.session` tells a script when a session opens and closes, so you key logic off session boundaries instead of clock arithmetic. Indicators and definitions share one API; studies have their own helpers for grouping events by time. ## ctx.session(opts): sessions you define Call it with the session you care about. It returns that session's state on the current bar. ```js export function onBar(ctx) { const s = ctx.session({ period: "daily", open: { hour: 8, minute: 0 }, close: { hour: 16, minute: 30 }, tz: "Europe/London", }); if (s.didOpen) { ctx.emit("london_open", { key: s.key }, { label: "London open", price: ctx.open }); } } ``` | Option | Meaning | |---|---| | `period` | `"daily"`, `"weekly"` or `"monthly"` | | `open` / `close` | `{ hour, minute? }` wall-clock time inside each period. `open` defaults to the period start. Without `close` the session runs for the whole period. A `close` earlier than `open` runs overnight | | `tz` | IANA time zone for `open` and `close`, DST-aware. Default `"UTC"` | | `custom: { startUtc, endUtc }` | Instead of `period`: one explicit span in unix seconds | | Field | Meaning | |---|---| | `key` | The session's start as an ISO timestamp string. Use it in `oncePer` keys and payloads, but do not parse it or compare it with text: use `start` for time | | `start` / `end` | Unix seconds, end exclusive | | `isOpen` | This bar is inside the session | | `didOpen` | True on the first bar inside the session | | `didClose` | True on the first bar at or after the session's end, or on the bar that rolls into the next session | | `prev` | `{ key, start, end }` of the previous session, or `null` before the first one closes | Each distinct set of options is tracked separately, so call `ctx.session` with the same options on every bar. Gate on `didOpen`, `isOpen` and `didClose`. Never count bars to decide when a session ends: a missing bar or a different chart timeframe breaks the count. `didClose` fires on a bar after the session, often the next session's first bar. On a rollover bar, finish the old session first, then reset, then add the current bar: ```js const st = ctx.accum("st", () => ({ hi: -Infinity }), (x) => x); const s = ctx.session({ period: "daily" }); if (s.didOpen && s.prev) { ctx.emit("day_high", { dayKey: s.prev.key, high: st.hi }, { label: "Day high" }); // finish } if (s.didOpen) st.hi = -Infinity; // reset if (s.isOpen) st.hi = Math.max(st.hi, ctx.high); // accumulate ``` A script that resets on a session boundary declares the longest gap between two resets as a length of time: `warmup((w) => w.day())` for a daily session, `warmup((w) => w.span("7d"))` for a weekly one. See [Warmup and memory](https://docs.chartnaut.com/scripting/warmup-and-memory). ## ctx.session.isStart(mode): named boundaries ```js if (ctx.session.isStart("london")) { ctx.mark("ln_open", { price: ctx.open, text: "LN", position: "atPriceMiddle" }); } ``` True on the first bar of a new session of that mode. The times are fixed in UTC and do not move with daylight saving: | Mode | Boundary | |---|---| | `"daily"` | 00:00 UTC | | `"weekly"` | Monday 00:00 UTC | | `"monthly"` | The 1st, 00:00 UTC | | `"london"` | 08:00 UTC | | `"newyork"` | 13:30 UTC | | `"tokyo"` | 00:00 UTC | | `"sydney"` | 22:00 UTC | | `"consistent"` | Never: the whole history is one session | `"newyork"` is 13:30 UTC all year, so it is the New York cash open only while the US is on daylight time. For an exchange session that follows daylight saving, use `ctx.session({ period: "daily", open, close, tz })`. ## Studies: key, boundsOf, bucket and temporal A study has no bars, so its helpers take a time: | Call | Returns | |---|---| | `ctx.session.key(t)` | The UTC day, `"YYYY-MM-DD"`. A string, so no arithmetic on it | | `ctx.session.boundsOf(t)` | `{ start, end, key }` of the UTC day containing `t` | | `ctx.session.bucket(t, mode)` | `"dow"`: `"Mon"` … `"Sun"`; `"hour"`: 0 to 23; `"halfHour"`: 0 to 47; `"day"`: day of the year. All UTC | | `ctx.temporal.containing(t, { period, tz? })` | `{ start, end, key }` of the `"day"`, `"week"`, `"month"` or `"year"` containing `t`, in `tz` (default UTC) | | `ctx.temporal.custom({ startUtc, endUtc })` | An explicit span | | `ctx.temporal.forwardFrom(t, endUtc)` | `{ start, end }` from `t` to `endUtc` | Use these in [`scope(ctx)`](https://docs.chartnaut.com/scripting/study-scope) to group events by session, and in `indexedBy` for tables and pins split that way. See [Study API](https://docs.chartnaut.com/scripting/study-api). ## Common mistakes - Treating `"newyork"` as the exchange's regular hours all year. - Flooring `ctx.time` by 86,400 to find the day instead of calling `ctx.session`. - Emitting once per session without `oncePer` on the event: see [Emit and labels](https://docs.chartnaut.com/scripting/emit-and-labels). - Running session logic on weekly charts. Limit it with `runOn`. --- # Reference data URL: https://docs.chartnaut.com/scripting/datasets/ Updated: 2026-11-22T22:28:38Z dataset(...) gives a script reference data that is not market prices: the economic calendar, daily rates and yields, options levels and the options chain. You declare a handle o... `dataset(...)` gives a script reference data that is not market prices: the [economic calendar](https://docs.chartnaut.com/scripting/economic-calendar), [daily rates and yields](https://docs.chartnaut.com/scripting/rates-and-yields), [options levels](https://docs.chartnaut.com/scripting/options-levels) and the [options chain](https://docs.chartnaut.com/scripting/options-contracts). You declare a handle once at module scope and read it on every bar. Indicators, definitions and studies all use it. ```js const cal = dataset("econ.calendar", { where: { country: { fromInstrument: true }, localImportance: { gte: 3 } }, lookahead: "1d", }); export function onBar(ctx) { // Stand aside from 15 minutes before to 30 minutes after an important release that is still happening. if (cal.within({ before: "15m", after: "30m" }).some((r) => r.state === "scheduled")) return; // ... } ``` ## Every read is as known at that bar A read is made at the end of the bar being computed. Inside a [timeframe handler](https://docs.chartnaut.com/scripting/mtf-and-runon) it is the end of the bucket being handled. On a bar that has not closed yet (a live chart's forming bar, or a run fetched up to now) it is now. The handle answers with what was known at that moment: - A release is visible once it was listed, which is never more than 7 days before its time. - Its forecast is visible once published, and its previous figure once printed. - A postponement or cancellation takes effect from when it was known. - A rate or yield is visible from when it was published. - A day's options levels and contracts are visible from the next trading day, at about 09:50 New York time. A backtest sees exactly what a live chart saw at the same moment, so a filter you test on history behaves the same way live. Where history cannot say when something became known, the platform uses the latest safe time, so a backtest may know less than a live chart, never more. ## Declaring a handle `dataset(name, options)` must be called at module scope with literal arguments. | Option | Meaning | |---|---| | `where` | Which rows. Required. Keys are the dataset's filterable fields | | `lookback` | How far back reads reach, e.g. `"1d"`. Default `"7d"`; `"1d"` for options contracts | | `lookahead` | How far ahead reads reach. The calendar allows up to `"7d"`, its listing horizon. Rates and options data have none: a value exists once published | A `where` value is one of these: - a literal, meaning equals: `{ country: "US" }`; - an array, meaning any of: `{ code: ["US.NFP", "US.CPI.YOY"] }`; - one operator: `{ importance: { gte: 2 } }`, `{ code: { in: [...] } }`, or `{ country: { fromInstrument: true } }` for the economies that move the chart's instrument; - a range, on a field that takes both `gte` and `lte`: `{ dte: { gte: 1, lte: 7 } }`, both ends included. Values are checked when the handle is declared: - countries are two-letter economy codes (`US`, `EU` for the euro area, `UK`, `JP`); case does not matter, and `GB`, `USA` and `EZ` are read as `UK`, `US` and `EU`; - `importance` and `localImportance` are 1, 2 or 3, or `low`, `medium` or `high`; - categories and rate families are their listed names; - codes look like `US.NFP` or `GBOND.US10Y`. Anything else is refused, and so is a code or economy the data does not have: a filter never silently matches nothing. Settings cannot appear in `where`. To filter by a setting, read everything the setting can reach and filter the rows in the script: ```js const cal = dataset("econ.calendar", { where: { country: { fromInstrument: true } } }); export function onBar(ctx) { const soon = cal.within({ after: "1h" }).filter((r) => r.localImportance >= ctx.params.minImportance); } ``` Plans set how many handles one script may declare: Free 2, Pro 4. Which plan reads which dataset is on [Datasets by plan](https://docs.chartnaut.com/account/datasets-by-plan). An indicator that reads a dataset can be used as a dependency like any other: it reads the same data wherever it runs. ## Reading | Read | Returns | |---|---| | `h.last` | The newest row whose time has passed | | `h.next` | The earliest row still ahead (always `undefined` without a lookahead) | | `h.value` | The main value of `last` (rates: the rate); `undefined` for the calendar | | `h.within({ before, after })` | Rows whose time is in `[now - before, now + after]`, oldest first | | `h.between(from, to)` | Rows whose time is in `[from, to]` (unix seconds) | | `h.history(n)` | The last `n` rows whose time has passed, oldest first | | `h.updatesThisBar` | What changed since the previous bar: `{ key, kinds, row }`. On the first bar after a gap (a weekend, a session break) it includes what changed while no bar was open | | `h.asOf(t)` | The same reads as known at an earlier instant `t` | | `h.valueAt(t)` | `asOf(t).value` | | `h.coverage` | `{ from, to, truncated, dataFrom?, gaps? }`: the span reads cover right now. See [Empty or not stored](#empty-or-not-stored) | `last`, `next`, `value` and `history` skip rows that are withdrawn, cancelled or rescheduled. A replacement counts once it is listed. `within`, `between` and `updatesThisBar` return every row, so check `row.state === "scheduled"` before treating a row as a release that is happening. Rows are frozen and hold only their dataset's fields. Reading any other name (`row.actual`, `row.forecast`, `row.time`) throws; an optional field without a value (`estimate`, `previous`, `rescheduledTo`) is `undefined`. A list field, such as the [options gamma profile](https://docs.chartnaut.com/scripting/options-levels#reading-the-profile), is frozen too: `sort`, `reverse`, `splice` and `push` throw, so copy it first with `list.toSorted()` or `[...list].sort()`. Times are unix seconds, like `ctx.time`. A millisecond timestamp, a `Date` or a date string is refused. `within` takes `{ before, after }` and nothing else, `history(n)` takes a whole number, and `between(from, to)` takes two times in order. `within` spans may not exceed the handle's `lookback` and `lookahead`: asking for more throws, so declare what you read. `asOf(t)` may look back but never past the bar being computed. ## Empty or not stored An empty read has two meanings: nothing happened, or nothing was stored. `h.coverage.gaps` tells them apart. It lists the spans `{ from, to }` (unix seconds, `to` exclusive) of the read's window in which the stored data holds nothing at all, of any code or country, clipped to the window and oldest first. The key is absent when the window has no gap, so `if (c.gaps)` is the test. Nothing is filled in: the rows are what was stored, and the script decides what an empty window means. Only the economic calendar states gaps. It publishes every weekday across 100+ economies, so three or more empty weekdays in a row are a hole in the data rather than a holiday. Today and later are never a gap (they are not listed yet), and other datasets have no `gaps` key. `coverage.dataFrom` is the other half: before it a read is empty because the data has not begun. ```js const cal = dataset("econ.calendar", { where: { code: "US.NFP" }, lookback: "7d" }); export function onBar(ctx) { const week = cal.within({ before: "7d" }); const gaps = cal.coverage.gaps; if (week.length === 0 && gaps) { // the calendar holds nothing for part of this week: "no NFP" is not an answer here ctx.log.warn(`calendar not stored from ${gaps[0].from} to ${gaps[gaps.length - 1].to}`); return; } } ``` `h.asOf(t).coverage` answers the same at an earlier instant. ## In studies A study has no current bar, so it reads at a time with `h.asOf(t)`. `ctx.event.knownAt` is the end of the bar the event fired on: the moment the definition decided, with what it knew then. Inside `scope(ctx)` read at `knownAt` and never later; `onEvent` may read later times to measure an outcome. See [scope](https://docs.chartnaut.com/scripting/study-scope). A time past now (the latest moment the run's data covers) has not happened yet. `h.asOf(t)` and `h.valueAt(t)` there return `undefined` and the event is marked not ready, the same as a forward candle read past the last bar, so its result is computed on a run after that moment rather than stored from a calendar that can still change. Check for it: `const later = cal.asOf(t); if (!later) return;`. ```js const cal = dataset("econ.calendar", { where: { country: { fromInstrument: true }, localImportance: { gte: 3 } } }); export function scope(ctx) { const n = cal.asOf(ctx.event.knownAt)?.next; const hours = n ? (n.scheduledAt - ctx.event.knownAt) / 3600 : Infinity; return { newsSoon: hours <= 1 ? "within 1h" : "later" }; } ``` --- # Economic calendar URL: https://docs.chartnaut.com/scripting/economic-calendar/ Updated: 2026-11-22T22:28:38Z econ.calendar is one row per scheduled economic release, covering the G10 and more than 100 economies. It carries the schedule, the consensus forecast and the previous figure. T... `econ.calendar` is one row per scheduled economic release, covering the G10 and more than 100 economies. It carries the schedule, the consensus forecast and the previous figure. The released figure is not available to scripts. Read it through a [dataset handle](https://docs.chartnaut.com/scripting/datasets). ```js const cal = dataset("econ.calendar", { where: { code: ["US.NFP", "US.CPI.YOY"] } }); ``` ## Fields | Field | Meaning | |---|---| | `key` | Stable release id | | `code` | Indicator code, e.g. `US.NFP`, `US.CPI.YOY`, `EU.RATE_DECISION` | | `name` | Release name | | `country` | Economy, two letters (`EU` is the euro area) | | `category` | `labour`, `inflation`, `central_bank`, `growth`, `consumer`, `pmi`, `sentiment`, `housing`, `trade`, `energy`, `positioning`, `auction`, `speech` or `other` | | `importance` | How much it moves global markets: 1 low, 2 medium, 3 high | | `localImportance` | How much it matters for its own economy, 1 to 3: every economy's rate decision, headline CPI, GDP and unemployment are 3. Never below `importance` | | `period` | The reference period, e.g. `2025-09`, `2025-Q3`, `2025-09-19` (empty when unknown) | | `scheduledAt` | Release time, unix seconds | | `estimate` | Consensus forecast, once published | | `previous` | The previous period's figure as first printed | | `firstForPeriod` | False for a later stage of the same period, such as a final after a flash | | `state` | `scheduled`, `rescheduled`, `cancelled` or `withdrawn` | | `rescheduledTo` | The new time when `state` is `rescheduled` | | `expectsActual` | False for speeches, minutes and statements | ## Filters | Field | Operators | |---|---| | `code` | equals, any of | | `country` | equals, any of, `{ fromInstrument: true }` | | `category` | equals, any of | | `importance` | equals, any of, `gte`, `lte` | | `localImportance` | equals, any of, `gte`, `lte` | A calendar handle must filter on `code` or `country`. Codes are data: look them up with `find_calendar_codes` (agents and MCP) or `GET /public/v1/datasets/econ.calendar/codes` rather than guessing one. A code or economy the calendar does not have is refused. Use `localImportance` on an instrument outside the major economies. Almost nothing outside the US, the euro area, the UK, Japan, Canada, Australia, New Zealand and Switzerland has `importance` 3, so `importance: { gte: 3 }` on a Taiwanese stock reads US releases only; `localImportance: { gte: 3 }` reads Taiwan's headline releases as well. `{ fromInstrument: true }` resolves the chart's instrument to the economies that move it: - FX pairs give both currencies, and the euro gives the euro area plus Germany, France, Italy and Spain. - An index gives its home economy. - Metals and crypto give the US. - The US is always included. ## When things become visible | Fact | Visible from | |---|---| | A release | When it was listed, and never more than 7 days before its time. Speeches and unscheduled central-bank decisions appear in history only at their own time | | Its forecast | When it was published. History holds only the final forecast, shown from one day before the release | | Its previous figure | When the previous period's figure was first printed | | A time change | When it was seen | | A withdrawal, postponement or cancellation | When it was seen live; in history, at the original time (the latest safe time) | `previous` is always the prior period's first print, not a later revision, so it matches what the market knew before the release. Where the stored calendar holds nothing at all for three or more weekdays in a row, a read is empty because nothing was stored, not because nothing was scheduled. `cal.coverage.gaps` lists those spans within the read's window; see [Empty or not stored](https://docs.chartnaut.com/scripting/datasets#empty-or-not-stored). ## Patterns Stand aside around news: ```js if (cal.within({ before: "15m", after: "30m" }).some((r) => r.state === "scheduled")) return; ``` Act shortly before a high-importance release: ```js const n = cal.next; if (n && n.localImportance === 3 && n.scheduledAt - ctx.time <= 3600) { ctx.emit("pre_release", { code: n.code, forecast: n.estimate ?? null }, { label: n.name }); } ``` React to a change in the schedule: ```js for (const u of cal.updatesThisBar) { if (u.kinds.includes("rescheduled")) ctx.log.info(`${u.row.name} moved to ${u.row.rescheduledTo}`); } ``` The built-in **Economic Calendar** indicator draws these releases along the bottom of the chart, including upcoming ones to the right of the last bar. Its importance setting filters on `localImportance`. --- # Rates and yields URL: https://docs.chartnaut.com/scripting/rates-and-yields/ Updated: 2026-11-22T22:28:38Z rates.daily is one row per series per day. The series are government bond yields, US Treasury curves, overnight reference rates (SOFR, ESTR, SONIA, EFFR) and central-bank policy... `rates.daily` is one row per series per day. The series are government bond yields, US Treasury curves, overnight reference rates (SOFR, ESTR, SONIA, EFFR) and central-bank policy rates. It is available on every plan, Free included. Read it through a [dataset handle](https://docs.chartnaut.com/scripting/datasets). ```js const us10 = dataset("rates.daily", { where: { code: "GBOND.US10Y" } }); const de10 = dataset("rates.daily", { where: { code: "GBOND.DE10Y" } }); export function onBar(ctx) { if (us10.value !== undefined && de10.value !== undefined) { ctx.plot("spread", us10.value - de10.value); } } ``` ## Fields | Field | Meaning | |---|---| | `key` | `code\|obsDate` | | `code` | Series code, e.g. `GBOND.US10Y`, `UST.PAR.2Y`, `SOFR`, `POLICY.FED_TARGET_UPPER` | | `name` | Series name | | `family` | `gbond`, `ust_par`, `ust_real`, `ust_bill`, `ust_long`, `ref_rate` or `policy` | | `currency` | Currency of the series | | `unit` | `pct` | | `obsDate` | The day the value is for, `YYYY-MM-DD` | | `knownFrom` | When the value was published, unix seconds | | `value` | The rate or yield | Filter on `code`, `family` or `currency` (equals or any of); a rates handle needs one of them. `h.value` is the newest published value, so it always says what was known at the bar. A value published on Monday for the previous Friday appears on Monday, not on Friday. ## When values become visible | Series | Visible from | |---|---| | Bond yields and Treasury curves | The publisher's release time on the observation date | | Overnight reference rates | The next business day's publication (SOFR for Thursday appears on Friday, or on Monday after a holiday) | | Policy rates | The decision's announcement | A correction appears when it was seen. Holiday fillers are not observations, so a market holiday has no row. --- # Options levels URL: https://docs.chartnaut.com/scripting/options-levels/ Updated: 2026-11-22T22:28:38Z Read call wall, put wall, gamma flip, gamma exposure, expected move and the gamma profile with options.eod.levels. On Pro. `options.eod.levels` gives a script the options levels for a chart: call wall, put wall, gamma flip, gamma exposure, expected move and the gamma profile by strike. There is one row per chart, view and trading day, worked out from that day's US options close and the next morning's open interest, and already in the chart's own price units. It is part of **Options Levels**, on Pro. Read it through a [dataset handle](https://docs.chartnaut.com/scripting/datasets). Data Provided by Databento. ```js meta({ shortName: "Walls", kind: "overlay" }); dialog({ title: "Options walls" }); const lv = dataset("options.eod.levels", { where: { instrument: { fromInstrument: true }, view: "combined" }, }); output.line({ id: "callWall", color: "#26a69a", name: "Call wall" }); output.line({ id: "putWall", color: "#ef5350", name: "Put wall" }); output.line({ id: "flip", color: "#ffb300", name: "Gamma flip" }); export function onBar(ctx) { const r = lv.last; if (!r) return; if (r.callWall !== undefined) ctx.plot("callWall", r.callWall); if (r.putWall !== undefined) ctx.plot("putWall", r.putWall); if (r.flip !== undefined) ctx.plot("flip", r.flip); } ``` Each line steps to the new day's level when that day's row takes effect, at about 09:50 New York time. How each level is worked out is on [How options levels are calculated](https://docs.chartnaut.com/guides/how-options-levels-are-calculated). ## Which charts have levels Options levels are rolling out chart by chart: S&P 500 charts first (built from SPX, SPXW and SPY, views `combined`, `index` and `etf`), then NAS100, Gold and Bitcoin. The dataset listing (`GET /public/v1/datasets`, the MCP tool `list_datasets`, the agent's `find_datasets`) gives the current `coverage`: each chart with levels, from when, and its newest `tradeDate`. In a script, `lv.coverage.dataFrom` is when the chart's levels begin. On a chart without options levels yet, a read with `{ fromInstrument: true }` is refused with *this chart has no options data*, naming the charts that have them. ## Declaring the handle A levels handle must filter on both `instrument` and `view`. Rows of different views and charts share a time, so give each one value when you read `last`. To read several views, see [Several views in one handle](#several-views-in-one-handle). | Filter | Values | |---|---| | `instrument` | `{ fromInstrument: true }` for the chart the script runs on, or a chart by name or symbol: `"SP500"` or `"HYPERLIQUID:xyz:SP500"` | | `view` | `"combined"` (index and ETF options together), `"index"` (SPX and SPXW) or `"etf"` (SPY), or several of them as an array | Naming the instrument reads that chart's levels from any chart, still in that chart's price units: SP500 levels on a NAS100 chart are SP500 prices. The default `lookback` of 7 days covers a long weekend, when the newest row can be four days old. ### Several views in one handle A setting cannot go in `where`, so a script that lets the trader pick a view declares every view it can take and picks by `row.view`. Read with `within`, never `last`: with several views, `last` is whichever row came first. ```js const lv = dataset("options.eod.levels", { where: { instrument: { fromInstrument: true }, view: ["combined", "index", "etf"] }, }); export function onBar(ctx) { const rows = lv.within({ before: "7d" }).filter((r) => r.view === ctx.params.view); const r = rows[rows.length - 1]; if (r && r.callWall !== undefined) ctx.plot("callWall", r.callWall); } ``` This uses one of your plan's handles per script (Free 2, Pro 4), where one handle per view would use three. ## Fields Prices are in the chart's units. Gamma exposure is in dollars per 1% move in the underlying. | Field | Meaning | |---|---| | `key` | `instrument\|view\|tradeDate` | | `instrument` | The chart symbol, e.g. `HYPERLIQUID:xyz:SP500` | | `view` | `combined`, `index` or `etf` | | `roots` | The option roots read, e.g. `["SPX", "SPXW", "SPY"]` | | `tradeDate` | The options close the row is built from, `YYYY-MM-DD` | | `knownFrom` | When the row takes effect, unix seconds | | `modelVersion` | The maths version, `eod-v3` | | `schemaVersion` | The row shape, `1` | | `spot` | The chart's price at the 16:00 New York close on `tradeDate` | | `ratio` | Chart price divided by the index price at the close, used to convert every level | | `callWall` | The strike at or above `spot` with the largest call gamma exposure | | `putWall` | The strike at or below `spot` with the largest put gamma exposure | | `absGammaStrike` | The strike with the largest gamma exposure, calls and puts added regardless of sign | | `flip` | The price nearest `spot` where dealers' net gamma turns from negative to positive. Optional | | `netGex` | Dealers' net gamma exposure at `spot` | | `grossGex` | Call and put gamma exposure added regardless of sign | | `expectedMove` | The at-the-money straddle of the front expiry, in chart points | | `putCallOiRatio` | Put open interest divided by call open interest | | `iv30` | 30-day implied volatility in percent, worked out the way the VIX is | | `frontExpiry` | The nearest expiry after `tradeDate`, `YYYY-MM-DD`. Optional | | `frontCallWall`, `frontPutWall`, `frontFlip`, `frontExpectedMove` | The same levels from the front expiry alone. Optional | | `flips` | Every price where net gamma changes sign, ascending | | `strikes` | The profile's strikes in chart prices, ascending: one per index strike (per SPY strike in the `etf` view) | | `callGamma`, `putGamma`, `netGamma` | Gamma exposure at each strike, box and conversion positions left out (as the walls leave them out). `putGamma` is zero or negative, and `netGamma` is their sum | | `callOi`, `putOi` | Open interest at each strike, in contracts, box and conversion positions left out | | `boxCallGamma`, `boxPutGamma`, `boxCallOi`, `boxPutOi` | The box and conversion positions at each strike, zero elsewhere. `callGamma[i] + boxCallGamma[i]` counts every position | | `callWallInclBoxes`, `putWallInclBoxes`, `absGammaStrikeInclBoxes` | The walls with box and conversion positions counted, the way most published levels read. Optional | The profile lists are the same length and line up by index: `callGamma[i]` is the call gamma at `strikes[i]`. On SP500 the strikes are one index strike apart (5 index points, which is 5 × `ratio` on the chart) and reach 20% either side of `spot`. Because they follow the index strikes, they shift slightly from day to day as `ratio` moves: to compare a strike across days, match the nearest strike, never an exact price. Every number apart from `schemaVersion` is optional: a level that cannot be worked out on a day is `undefined`, such as the flip when net gamma never changes sign. Check before you draw or compare one. ## When a row becomes visible A row for trading day D takes effect on the next trading day, when it was computed plus 10 minutes. That is usually about 09:50 New York time. Days filled in from history take effect at 10:00. Until then, `lv.last` is the previous day's row. Backtests and [replay](https://docs.chartnaut.com/guides/replay) switch at the same moment a live chart did, so a level a backtest acts on is a level a trader could have seen. If a night's data is late, the previous row stays in force: check `tradeDate` when freshness matters. Before the first day Chartnaut holds, reads are empty. `lv.coverage.dataFrom` says when the data begins: ```js if (!lv.last && lv.coverage.dataFrom !== undefined && ctx.time < lv.coverage.dataFrom) { // Options levels available from lv.coverage.dataFrom } ``` ## Reading the profile The profile lists are frozen. `sort`, `reverse`, `splice` and `push` throw a `TypeError`, so copy before reordering: `list.toSorted(...)` or `[...list].sort(...)`. Reading, `map`, `filter` and `slice` work as usual. The three strikes with the most gamma, largest first: ```js const r = lv.last; if (r) { const top = r.strikes .map((strike, i) => ({ strike, gex: Math.abs(r.netGamma[i]) })) .toSorted((a, b) => b.gex - a.gex) .slice(0, 3); } ``` ## Patterns Distance to each wall, in points: ```js const r = lv.last; if (r && r.callWall !== undefined && r.putWall !== undefined) { ctx.plot("toCallWall", r.callWall - ctx.close); ctx.plot("toPutWall", ctx.close - r.putWall); } ``` Above or below the flip. Above it dealers are net long gamma, which tends to damp moves; below it they are net short gamma, which tends to extend them: ```js const r = lv.last; const regime = r && r.flip !== undefined ? (ctx.close > r.flip ? "long gamma" : "short gamma") : "unknown"; ``` The expected-move band around the previous close, with `moveUp` and `moveDown` declared as `output.line`: ```js const r = lv.last; if (r && r.spot !== undefined && r.expectedMove !== undefined) { ctx.plot("moveUp", r.spot + r.expectedMove); ctx.plot("moveDown", r.spot - r.expectedMove); } ``` ## In studies A study reads at a time. In `scope(ctx)`, `lv.asOf(ctx.event.knownAt)?.last` is the row in force when the event fired: ```js const lv = dataset("options.eod.levels", { where: { instrument: { fromInstrument: true }, view: "combined" } }); export function scope(ctx) { const r = lv.asOf(ctx.event.knownAt)?.last; if (!r || r.flip === undefined) return null; return { regime: ctx.event.payload.price > r.flip ? "above flip" : "below flip" }; } ``` [Research with options levels](https://docs.chartnaut.com/guides/research-with-options-levels) builds a definition and a study on the walls. Pine indicators cannot read datasets: use TypeScript. The per-contract chain behind these levels is [options.eod.contracts](https://docs.chartnaut.com/scripting/options-contracts), on Pro. --- # Options contracts URL: https://docs.chartnaut.com/scripting/options-contracts/ Updated: 2026-11-22T22:28:38Z Read the end-of-day US options chain, one row per contract, with options.eod.contracts: quotes, open interest, implied volatility and greeks. Pro and up. `options.eod.contracts` is the end-of-day US options chain behind [options levels](https://docs.chartnaut.com/scripting/options-levels): one row per contract per trading day, with its closing quote, open interest, implied volatility and greeks. It is **Raw Option Chains** on the plans page, from the Pro plan. Read it through a [dataset handle](https://docs.chartnaut.com/scripting/datasets). Data Provided by Databento. ```js const oc = dataset("options.eod.contracts", { where: { underlying: { fromInstrument: true }, dte: { lte: 7 }, moneyness: { gte: 0.97, lte: 1.03 }, }, lookback: "4d", }); ``` On the SP500 chart, `{ fromInstrument: true }` reads SPX (with SPXW) and SPY; on a chart without options data it is refused with *this chart has no options data*. This handle holds the contracts expiring within a week and struck within 3% of the forward. ## Underlyings | Chart | `underlying` | `root` | |---|---|---| | S&P 500 charts | `SPX` | `SPX` (monthly, settled at the open), `SPXW` (weekly and daily, settled at the close) | | S&P 500 charts | `SPY` | `SPY` | Which underlyings have chains now, from when and up to which day, is the dataset listing's `coverage` (`GET /public/v1/datasets`, the MCP tool `list_datasets`, the agent's `find_datasets`). The chain follows the same rollout as [options levels](https://docs.chartnaut.com/scripting/options-levels#which-charts-have-levels): SPX and SPY first, then NDX, QQQ, GLD and IBIT. ## Fields Prices and strikes are in the underlying's own units: SPX points and SPY dollars, not the chart's. | Field | Meaning | |---|---| | `key` | `root\|instrumentId\|tradeDate` | | `tradeDate` | The trading day of the close, `YYYY-MM-DD` | | `underlying` | `SPX` or `SPY` | | `root` | `SPX`, `SPXW` or `SPY` | | `symbol` | The contract's OSI symbol, e.g. `SPX 260717C06600000` | | `expiry` | Expiry date, `YYYY-MM-DD` | | `expiresAt` | When it settles, unix seconds: 09:30 New York time for SPX monthlies, 16:00 for the rest | | `settle` | `am` or `pm` | | `putCall` | `C` or `P` | | `strike` | Strike price | | `multiplier` | Contract multiplier, 100 | | `bid`, `ask` | The quote at 16:00 New York time (13:00 on a half day) | | `bid1615`, `ask1615` | The quote at 16:15, for index options that trade after the stock close | | `openInterest` | Open interest published the next morning, in contracts | | `volume` | Contracts traded on the day | | `iv` | Implied volatility as a decimal: 0.18 is 18% | | `delta` | Change in price per 1.00 move in the underlying | | `gamma` | Change in delta per 1.00 move in the underlying | | `vega` | Change in price per 1 point of volatility | | `theta` | Change in price per calendar day | | `forward` | The forward price for the contract's expiry, from put-call parity | | `ivSource` | Where `iv` comes from: `quote` (this contract's own quote), `smile` (interpolated within its expiry), `surface` (its expiry had no usable quotes near the price, so it was filled from the expiries either side). Optional | | `dte` | Calendar days from `tradeDate` to `expiry` | | `moneyness` | `strike` divided by `forward` | | `modelVersion` | The maths version, `eod-v3` | | `knownFrom` | When the row takes effect, unix seconds | Every number from `bid` to `forward`, and `moneyness`, is optional: a contract with no quote has no `bid`, and one whose price cannot be solved has no `iv` or greeks. Check for `undefined` before using one. ## Filters | Field | Operators | |---|---| | `underlying` | equals, any of, `{ fromInstrument: true }` | | `root` | equals, any of | | `expiry` | equals, any of, `gte`, `lte` | | `strike` | equals, `gte`, `lte` | | `putCall` | equals: `C` or `P` (`call` and `put` work too) | | `dte` | `gte`, `lte` | | `moneyness` | `gte`, `lte` | A contracts handle must filter on `underlying` or `root`. A field that takes `gte` and `lte` accepts both at once as a range, ends included: `{ strike: { gte: 6500, lte: 6800 } }`. A range with its ends the wrong way round is refused. ## Narrow every read A full SPX and SPY chain is tens of thousands of contracts a day. A read returns at most 5,000 rows; past that, `coverage.truncated` is true and the rows nearest now are kept. Filter on `dte`, `moneyness`, `expiry` or `strike` so a day fits. The default `lookback` is 1 day and the longest is 10 days. Use 4 days to always reach the newest chain across a weekend: on Monday before about 09:50 New York time the newest chain is Thursday's, published on Friday morning, and a 1-day lookback sees nothing. A run over a longer stretch of history is read 7 days at a time; Chartnaut splits it for you. ## When rows become visible A trading day's rows take effect with that day's [levels](https://docs.chartnaut.com/scripting/options-levels#when-a-row-becomes-visible): on the next trading day, usually about 09:50 New York time, and at 10:00 for days filled in from history. Every row of a day shares one `knownFrom`, so read the day's rows with `within` and keep the newest `tradeDate`. `last` returns one row only. ```js // The newest trading day's contracts this handle can see. function latestChain() { const rows = oc.within({ before: "4d" }); if (rows.length === 0) return []; const day = rows[rows.length - 1].tradeDate; return rows.filter((r) => r.tradeDate === day); } ``` ## Examples Each example below declares `oc` as at the top of this page and uses `latestChain()`. The front expiry's at-the-money straddle on SPX, in SPX points: ```js export function onBar(ctx) { const chain = latestChain().filter((r) => r.underlying === "SPX"); if (chain.length === 0) return; const front = chain.map((r) => r.expiry).toSorted()[0]; const atm = chain .filter((r) => r.expiry === front && r.moneyness !== undefined) .toSorted((a, b) => Math.abs(a.moneyness - 1) - Math.abs(b.moneyness - 1)); const call = atm.find((r) => r.putCall === "C"); const put = atm.find((r) => r.putCall === "P" && call && r.strike === call.strike); if (!call || !put || call.bid === undefined || call.ask === undefined || put.bid === undefined || put.ask === undefined) return; const straddle = (call.bid + call.ask) / 2 + (put.bid + put.ask) / 2; } ``` Your own net gamma exposure, with dealers long calls and short puts, in dollars per 1% move: ```js function netGex(chain) { let total = 0; for (const r of chain) { if (r.gamma === undefined || r.openInterest === undefined || r.forward === undefined) continue; const sign = r.putCall === "C" ? 1 : -1; total += sign * r.gamma * r.openInterest * r.multiplier * r.forward * r.forward * 0.01; } return total; } ``` Using `forward` in place of spot is close for near expiries. Summing in dollars makes SPX and SPY add up directly. The levels' `netGex` covers every expiry, so this narrower handle gives a smaller figure. Calls only, between two dates, from a fixed strike range: ```js const calls = dataset("options.eod.contracts", { where: { root: "SPXW", putCall: "C", expiry: { gte: "2026-10-19", lte: "2026-10-23" }, strike: { gte: 6500, lte: 7000 }, }, lookback: "4d", }); ``` Fixed dates and strikes suit a one-off study. On a chart, `dte` and `moneyness` keep moving with the market. ## Plan `options.eod.contracts` needs Pro. On Free, the editor flags the handle with *options.eod.contracts is available from the Pro plan.* and a run is refused with the same message. Chartnaut can change a dataset's plan, so the current one is in [Datasets by plan](https://docs.chartnaut.com/account/datasets-by-plan). The levels themselves, including the per-strike profile, are in [options.eod.levels](https://docs.chartnaut.com/scripting/options-levels), also on Pro. --- # Budgets and limits URL: https://docs.chartnaut.com/scripting/budgets/ Updated: 2026-11-22T22:28:38Z Chartnaut caps how much work a script can do, so a heavy loop cannot freeze Charts or stall a study run. A soft limit shows a warning and the script keeps running. A hard limit ... Chartnaut caps how much work a script can do, so a heavy loop cannot freeze Charts or stall a study run. A soft limit shows a warning and the script keeps running. A hard limit stops the script with an error naming what it hit, the observed value and the limit. These are processing limits. They are separate from [AI credits](https://docs.chartnaut.com/account/ai-credits-billing) and from your plan's usage limits on [Plans and limits](https://docs.chartnaut.com/account/plans-and-limits). The full list of limits and error codes is on [Limits and errors](https://docs.chartnaut.com/scripting/limits-and-errors). ## Indicators and definitions on the chart | Limit | Soft | Hard | |---|---|---| | One full calculation | 2 s | 30 s | | One `onBar` or handler call | | 5 s | | Warmup walk of timeframe handlers, once per full reset | 2.5 s | 10 s | | Loop iterations in one call | | 350,000 | | Loop iterations per calculation | | 10,000 per bar, between 2 million and 50 million | | `ctx.*` calls in one call | | 500,000 | | Plotted points | 500,000 | 2,000,000 | | Emitted events | 25,000 | 100,000 | | `ctx.accum` slots | 256 | 1,024 | | Live and closed levels, zones and trendlines | 2,500 | 10,000 | | Rows per layer | 5,000 | 20,000 | | Bytes per layer | 4 MB | 32 MB | Every loop is instrumented, so a runaway loop stops at the iteration cap rather than hanging the tab. `while (true)` and `for (;;)` without a visible exit warn at lint with `caps/unbounded-loop`. A `mode: "once"` indicator's `onBar` has the per-bar caps of any indicator. Its `onRunEnd` runs once over the whole window, so that one call gets the per-calculation caps instead of the per-call ones. ## Studies | Limit | Preview in the builder | Full run | |---|---|---| | Wall clock | warn at 2 min, stop at 10 min | warn at 8 min, stop at 10 min | | One `onEvent` call | 15 s | 15 s | | Events processed | warn at 10,000, stop at 50,000 | warn at 50,000, stop at 100,000 | | Annotations | warn at 2,500, stop at 10,000 | warn at 2,500, stop at 10,000 | | Result payload | warn at 500 KB, stop at 2 MB | warn at 10 MB, stop at 100 MB | | Forward bars | 1,000 | 5,000 | An `onEvent` call over 15 seconds is skipped as an event timeout. Ten event timeouts stop the run with `too_many_event_timeouts`. Other stops report `budget_wall_clock`, `budget_total_events`, `budget_annotations`, `budget_payload` or `budget_forward_bars`. ## History depth Your plan caps how many buckets of each timeframe a script can hold. It bounds `warmup(...)`, `retain(...)` and the history loaded behind timeframe handles, and `w.forever()` resolves to it. | Plan | Indicator memory | |---|---| | Free | 2,500 buckets | | Pro | 5,000 buckets | It counts rows, not time, so it lands very differently by timeframe. At 5,000 buckets: | Timeframe | 5,000 buckets is roughly | |---|---| | `1d` | 13 years of 24/7 bars: more than the platform's daily history | | `4h` | 2.3 years | | `1h` | 7 months | | `5m` | 17 days | Your plan's history window can stop a script sooner. Over-declaring is clamped, reported through `history.truncated` with reason `"cap"`, and warned by `window/clamped-to-cap`. It is never an error. For an extreme or a total over a span the cap will not reach, use [`ctx.summary`](https://docs.chartnaut.com/scripting/summary-and-long-windows). More on [Warmup and memory](https://docs.chartnaut.com/scripting/warmup-and-memory) and [Indicator memory](https://docs.chartnaut.com/account/indicator-memory). ## When you hit a limit 1. Read the error or warning in the builder. It names the limit and, for a per-bar limit, the bar. 2. Do less work per bar or per event: fewer series, tighter loops, narrower forward windows. 3. Remove dependencies you do not read. 4. Run the definition over a shorter range while you iterate. [Budget exceeded](https://docs.chartnaut.com/scripting/budget-exceeded) walks through the common cases. --- # Lint and error codes URL: https://docs.chartnaut.com/scripting/lint-and-error-codes/ Updated: 2026-11-22T22:28:38Z Every lint rule id and runtime error code Chartnaut reports for scripts, with its severity and the fix. Look up the id shown in the builder's Problems list or in an agent's tool... Every lint rule id and runtime error code Chartnaut reports for scripts, with its severity and the fix. Look up the id shown in the builder's Problems list or in an agent's tool result, fix the line, and lint again. ## How to read this page - **error** blocks the save, the preview or the run. **warn** is advisory: the script runs, but the result is worse or will surprise someone. - **Where** says which script type the rule checks: **I** indicator, **D** definition, **S** study. Some rules have a different severity per type; the table says so. - The indicator lint runs in the builder and in the agents' `lint_indicator` tool, so a person and an agent see the same findings. A definition is linted by the same rule set on save and by the Definition authoring agent. - A few problems throw without a rule id. The common ones are listed in the last section of this page. ## Sandbox | Id | Severity | Where | Fix | |---|---|---|---| | `caps/forbidden-dsl` | error | D | Remove the blocked call: `document.*`, `window.*`, `eval()`, `new Function()`, `phenomena.find()`, `ICT.*`, `composition.*`, or an inline function inside `dialog({ settingsValidator })` (use `validatorId`). | | `caps/no-async` | error | D, S | Scripts are synchronous. Remove `await`, `async function`, `setTimeout`, `setInterval`, `requestAnimationFrame`, `queueMicrotask` and `new Promise`. | | `caps/no-network` | error | D, S | Remove `fetch`, `XMLHttpRequest`, `WebSocket` and `navigator.sendBeacon`. Read data through declared dependencies. | | `caps/non-deterministic` | error | D, S | Replace `Date.now()`, `new Date()`, `performance.now()` and `crypto.randomUUID` with the bar's own time (`ctx.time`, or the event time in a study). | | `caps/no-imports` | error | D | Replace `require()` with a relative ESM `import` from another file in the same definition. | | `caps/unbounded-loop` | warn | I | `while (true)` or `for (;;)` needs an explicit `break`. Prefer a bounded loop. | ## Files, modules and entry | Id | Severity | Where | Fix | |---|---|---|---| | `bundle/no-files` | error | D, S | Add a file. | | `bundle/no-entry` | error | D | Mark one file as the entry (`role: "main"`) and check its path. | | `bundle/multiple-main` | error | D | Keep exactly one `role: "main"` file. | | `bundle/no-entry-meta` | error | D, S | Put `meta({...})` in the entry file. | | `bundle/duplicate-path` | error | D | Two files share a path. Rename one. | | `bundle/multi-file` | error | S | Studies are one file. Merge helpers into `study.js`. | | `bundle/no-on-event` | error | S | Declare `export function onEvent(ctx, scope)`. Without it the run produces no rows or results. | | `bundle/scope-duplicate` | error | S | The study exports `scope()` more than once. Export it once. | | `bundle/scope-and-scope-event` | error | S | The study exports `scope()` and also calls `ctx.scopeEvent()`. `scope()` returns the event's scope tuple, so remove the `ctx.scopeEvent` call. | | `bundle/scope-in-trade-study` | error | S | Trade studies group by trade and never export `scope()`. Group trades in `onPosition` and `onFinish`. | | `bundle/empty` | error | S | The study bundled to nothing. Check the file has code. | | `meta/entry-only` | error | D | Move `meta()` into the entry file. | | `runtime/onbar-required` | error | D | The entry file must declare `export function onBar(ctx)`. | | `runtime/onbar-entry-only` | error | D | Only the entry file exports `onBar`. Export helpers as plain functions and call them from it. | | `runtime/onbar-multiple` | error | D | More than one file exports `onBar`. Keep the entry's. | | `runtime/no-onbar` | warn | D | No file exports `onBar`, so the preview runs and emits nothing. | | `modules/bare-import` | error | D | Package imports are not supported. Use a relative path such as `./levels.js`. | | `modules/missing-extension` | error | D | Write the extension: `./levels.js`, not `./levels`. | | `modules/cjs-extension` | error | D | `.cjs` files are not supported. Use `.js` or `.mjs`. | | `modules/path-escape` | error | D | The path leaves the definition's folder. Keep imports inside it. | | `modules/unresolved-import` | error | D | The imported file does not exist. Fix the path or add the file. | | `modules/import-cycle` | error | D | Two files import each other. Move the shared code into a third file. | | `modules/parse-error` | error | D | Syntax error in a module. The message names the file and position. | | `modules/unsupported-export` | error | D | Export with `export const` or `export function`. Default exports and live bindings are not supported. | | `modules/top-level-await` | error | D | Remove `await` at module scope. | | `modules/dynamic-import` | error | D | Replace `import()` with a static relative import. | | `modules/unreachable-file` | warn | D | Nothing imports this file from the entry, so it never runs. Import it or delete it. | | `derive/no-meta` | error | D, S | Add a `meta({...})` call. | | `derive/multiple-meta` | error | D, S | Keep one `meta({...})`. Only the first is used. | | `derive/eval` | error | D, S | The script threw while its declarations were read. The message is the thrown error. | | `derive/compile` | error | D, S | The script did not compile. Fix the syntax error in the message. | | `derive/settings-dialog` | error | D, S | The settings declarations are invalid. The message names the input. | | `derive/flows-missing` | error | S | `flows.declare(...)` is in the source but no flow was derived. Usually a syntax error above it. | | `derive/timeframes` | error | D | Saving could not work out the definition's timeframes. Fix the `tf/*` errors first. | | `derive/deps` | error | D | A declared dependency cannot be read by your account. Pick one you own or one that is public. | | `settings/dialog-required` | error | D | The definition declares inputs but no `dialog(...)`, so the inputs reach nothing. Add `dialog({ title })`. | ## Meta, settings and data source | Id | Severity | Where | Fix | |---|---|---|---| | `meta/missing-name` | warn | D | Give `meta({ name })` or `shortName`. | | `meta/kind-mismatch` | error | D | `meta({ kind })` must match the definition's kind. Use `kind: "flow"`. | | `meta/window-is-run-window` | warn | D | `meta({ window })` describes which bars to compute over. That option is `runWindow`; `window` takes `{ on }`. | | `meta/timeframe-deprecated` | warn | D | Replace `window: { timeframe }` with timeframe handles. | | `meta/timeframes-deprecated` | warn | D | Drop `window: { timeframes }`. Timeframes are inferred from `timeframe(...)` handles. | | `meta/timeframes-empty` | error | D | The legacy `timeframes` list is empty. Remove it. | | `meta/timeframes-unknown` | error | D | The legacy `timeframes` list has an unknown timeframe. Remove it. | | `meta/timeframes-not-multiples` | warn | D | A higher timeframe is not a whole multiple of the lowest. Buckets will misalign. | | `meta/run-on-empty` | error on I, warn on D | I, D | `runOn: []` allows nothing. Omit `runOn` or list at least one timeframe. | | `meta/run-on-unknown-tf` | error | I, D | `runOn` lists a timeframe Chartnaut does not know. Use `1m`, `5m`, `15m`, `30m`, `1h`, `2h`, `4h`, `1d`, `1w` or `1mo`. | | `meta/data-source-invalid` | error | I, D | `dataSource.type` must be `"candles"` or `"volume-candles"`; `purgeStrategy` must be `"floor-aware"`, `"max-bars"` or `"session-daily"`. | | `meta/volume-candles-purge-required` | error | I, D | `dataSource: { type: "volume-candles" }` needs `settings: { purgeStrategy: "floor-aware" }`. The string form `dataSource: "volume_candles"` needs no settings. | | `runtime/price-levels-without-volume-datasource` | warn | I, D | `ctx.volumePriceLevels` needs `meta({ dataSource: { type: "volume-candles", ... } })`. Without it the tape is always `[]`. | | `params/unknown-type` | error | D, S | Use a known param type: `number`, `string`, `boolean`, `color`, `timeframe`, `multiSelect`, `range` or `array`. `colour` is spelled `color`. | | `params/color-default-invalid` | error | D, S | The color default is not a valid color. | | `params/color-alpha-disallowed` | error | D, S | The default has alpha but the param does not set `allowAlpha`. | | `params/string-looks-like-color` | warn | D, S | A string param has a color default. Use `type: "color"` to get a picker. | | `outputs/color-from-undeclared` | error | D | `colorFrom` names a setting that `meta.params` does not declare. | | `outputs/color-from-not-color` | error, or warn for a string param | D | `colorFrom` must name a `color` param. | | `settings-validator/unknown-id` | warn | I | `dialog({ settingsValidator: { validatorId } })` names no registered validator. The message lists the known ids. | | `settings-validator/unknown-gate` | warn | I | Use a known gate: `instrument`, `timeframe`, `chartType`, `assetClass`, `priceRange` or `trigger`. | ## Timeframes and summaries | Id | Severity | Where | Fix | |---|---|---|---| | `tf/security-removed` | error | I, D | `ctx.security(...)` and `ctx.tf(...)` in `onBar` were removed. Declare `const h = timeframe("1d")` at module scope and read `h.last`, `h.forming`, `h.bars(n)` or `h.state`. The message carries the rewrite. | | `tf/handle-not-module-scope` | error | I, D | Call `timeframe(...)` and `.onBar(...)` at module scope, next to your inputs, not inside a function. | | `tf/no-ctx-at-module-scope` | error | I, D | Pass the `input.timeframe` handle itself to `timeframe()`, not `ctx.params.`. | | `tf/missing-source` | error | I, D | `timeframe(...)` needs a literal (`"1d"`), `"chart"`, or an `input.timeframe` handle. | | `tf/untyped-source` | error | I, D | The argument is not timeframe-typed (a template string, a free variable). Use a literal, `"chart"` or an `input.timeframe` handle. | | `tf/use-input-timeframe` | warn on I, error on D | I, D | An `input.select` whose options are all timeframes. Use `input.timeframe({ id, label, default, options })`. | | `tf/invalid-input-timeframe` | error | I, D | `input.timeframe(...)` needs an object literal with literal `id` and `default`. | | `tf/unknown-option` | error | I, D | The only option is `reads`: `timeframe(tf, { reads: [handle] })`. | | `tf/reads-not-a-handle` | error | I, D | `reads` must be an array literal of handles declared above this one. | | `tf/reads-forward-reference` | error | I, D | `reads` names a handle declared below. Reorder, or split the state into a third handle. | | `tf/undeclared-read` | error | I, D | Inside a handler, `ctx.tf(x)` must pass a handle object that is listed in that handle's `reads`. | | `tf/duplicate-handler` | error | I, D | One `onBar` per handle. Merge the two handlers. | | `tf/parse-error` | error | I, D | The timeframe analyser could not parse the source. Fix the syntax error first. | | `timeframe/no-output-in-handler` | error | I, D | `ctx.plot`, `emit`, `hline`, `range` or `mark` inside a timeframe handler. Keep the value with `ctx.accum` and paint from the chart `onBar`. Also raised at run time. | | `timeframe/undeclared-read` | error | I, D | Run-time form of `tf/undeclared-read`. | | `timeframe/unknown-option` | error | I, D | Run-time form of `tf/unknown-option`. | | `timeframe/reads-not-a-handle` | error | I, D | Run-time form of `tf/reads-not-a-handle`. | | `timeframe/reads-unused` | warn | I | A handle lists a read its handler never calls. Drop it or read it. | | `flow/unknown-timeframe` | error | D | `timeframe("X")` where X is not a known timeframe or `"chart"`. | | `summary/missing-window` | error | I, D | `ctx.summary(tf)` needs a window, e.g. `{ since: "52w" }`. | | `summary/untyped-window` | error | I, D | Write the window as an object literal, not a variable or spread. The runtime sizes history from it. | | `summary/invalid-window` | error | I, D | Keys are `{ since }` or `{ period, back }`. `since` is `"all"`, a duration, a date or a period name; `back` is a whole number of zero or more. | ## History window and state | Id | Severity | Where | Fix | |---|---|---|---| | `window/warmup-required` | error | I, D | The script keeps state but declares no warmup, so its values would depend on where the run began. Call `warmup(...)` after your inputs: `w.window(length)` for a lookback, `w.ema(length)` or `w.wilder(length)` for smoothing, `w.day()` or `w.span("7d")` for state that resets on a session or calendar boundary, `w.forever()` for state that never forgets (a sum, a count, an all-time high). | | `window/warmup-inert` | error | I, D | A warmup is declared and handles exist, but no handle registers an `onBar` handler, so nothing walks it. | | `window/declare-with-call` | error | D | A `warmup` or `retain` key inside `meta({ window })`. `window` takes `{ on }`. Declare history with the `warmup(...)` or `retain(...)` call the message names, after your inputs. | | `state/never-forgets` | error on I, warn on D | I, D | A running sum, count or high declared with a count means "since the cell began". Declare `warmup((w) => w.forever())`, or reset it on a boundary and declare the span between resets, such as `w.day()`. | | `window/forever-on-decaying` | warn | I, D | `w.forever()` on state that only decays fetches the whole cap for nothing. Declare `w.ema(length)` or `w.wilder(length)`. | | `window/reset-wants-span` | warn | I, D | The script resets on `ctx.session.isStart` but declares a typed count, which is a different stretch of time on every timeframe. Declare `w.day()`, or `w.span("7d")` for a weekly reset. | | `window/decay-under-factor` | warn | I, D | An EMA or Wilder average whose length the lint can read is declared under 30x (EMA) or 50x (Wilder) that length. Declare `w.ema(length)` or `w.wilder(length)`. | | `window/clamped-to-cap` | warn | I, D | The declared warmup or retain exceeds your plan's [indicator memory](https://docs.chartnaut.com/account/indicator-memory) on a timeframe and was clamped. The message gives the effective `warmup` and `retain`. Read a higher timeframe or use `ctx.summary` for a longer span. | The `state/never-forgets` warning on definitions will become an error once the number of existing definitions it would refuse has been measured. ## Events and emits | Id | Severity | Where | Fix | |---|---|---|---| | `events/missing-id` | error | D | Give `events.declare` an `id`. | | `events/missing-intent` | error | D | Give `events.declare` an `intent`, e.g. `"signal"`. | | `events/duplicate-id` | error | D | An event id is declared twice across files. | | `events/bad-payload-type` | error | D | A payload field type must be `string`, `number`, `boolean`, `object`, `array` or `{ enum: [...] }`. | | `events/payload-missing-description` | error | D | Every payload field needs `{ type, description }`. Study agents read the description. | | `events/reserved-payload-key` | error | D | Remove `_displayLabel` or `_displaySubtitle` from the payload and pass `label` and `subtitle` in the `ctx.emit` options. Remove `_firedBarTime`: Chartnaut records the bar each event fired on under that key. | | `events/unknown-paint` | warn | D | Use `none`, `pin`, `highlight_event_bar`, `highlight_price` or `highlight_event_bar_and_price`. | | `events/hidden-paint-explicit` | warn | D | `paint: "none"` hides every emit on the chart. Use `"pin"` unless you want data-only events. | | `events/paint-needs-price` | warn | D | Price paints need a numeric `payload.price` or `ctx.emit(..., { price })`. | | `events/emit-missing-label` | warn | D | Pass a non-empty `label` in the `ctx.emit` options. At run time an emit without a label is dropped. | | `marker/duplicate-paint` | warn | D | The same event is painted by `ctx.emit` and `ctx.mark`. Keep one channel. | | `snapshot/schema-mismatch` | error | D | A snapshot schema field has an invalid type. | | `snapshots/duplicate-id` | error | D | A snapshot id is declared twice. | ## Outputs and lifecycle Definitions use `outputs.declare` and the `outputs/*` rules. Indicators use `output.*` and the `output/*` rules. | Id | Severity | Where | Fix | |---|---|---|---| | `outputs/unknown-id` | error | D | `ctx.("id")` names an output that `outputs.declare` does not declare. | | `outputs/kind-mismatch` | error | D | The paint verb does not match the declared kind, e.g. `ctx.hline` on a `line` output. | | `outputs/declared-unused` | warn | D | An output is declared but never painted. | | `outputs/hline-missing-time1` | error | D | `ctx.hline(id, price, { time1 })` needs an anchor time: `time1: ctx.time`, or the event's anchor time. | | `outputs/invalidate-needs-time1` | error | D | Invalidating hlines need `time1` on every emission. | | `outputs/all-needs-distinct-time1` | warn | D | `mode: "all"` with a literal `time1` collapses every emission onto one anchor. Use a per-bar time. | | `outputs/invalid-mode` | error | D | `mode` applies to `hline`, `range` and `trendline` only, and must be one that kind allows. | | `outputs/missing-mode` | warn | D | Set `mode` explicitly on `hline`, `range` and `trendline`. | | `outputs/invalidate-needs-policy` | error | D | `mode: "invalidateOnCustomFunction"` needs `invalidateWhen`. There is no default. | | `outputs/invalidate-without-mode` | warn | D | `invalidateWhen` is ignored unless `mode` is `"invalidateOnCustomFunction"`. | | `outputs/unknown-invalidate-preset` | warn | D | The preset name is not known for this kind. Use a listed preset or a predicate function. | | `outputs/trendline-no-presets` | error | D | Trendlines take a predicate function, never a preset name. | | `outputs/event-needs-binding` | error | D | `mode: "invalidateOnEvent"` needs `invalidateOnEvent: ""`. | | `outputs/event-without-mode` | warn | D | `invalidateOnEvent` is ignored unless `mode` is `"invalidateOnEvent"`. | | `outputs/unknown-event-binding` | error | D | `invalidateOnEvent` names an event that `events.declare` does not declare. | | `outputs/label-mode-invalid` | error | D | `labelMode` is `always`, `onHover`, `onLastBar` or `none`. | | `outputs/zindex-not-finite` | error | D | `zIndex` must be a finite number. | | `outputs/note-missing-price` | error | D | `ctx.note` needs a numeric `price`. | | `outputs/mark-missing-text` | warn | D | Pass `text` to `ctx.mark` when `labelMode` is `always` or `onHover`. | | `outputs/range-missing-label` | warn | D | Pass `label` to `ctx.range` when `labelMode` is `always`. | | `outputs/trendline-missing-coords` | error | D | `ctx.trendline` needs `time1`, `price1`, `time2` and `price2`. | | `output/range-invalidate-needs-policy` | error | I | Same as `outputs/invalidate-needs-policy`, for `output.range`. | | `output/range-invalidate-without-mode` | warn | I | Same as `outputs/invalidate-without-mode`, for `output.range`. | | `output/range-unknown-preset` | warn | I | Unknown `invalidateWhen` preset on `output.range`. | | `output/hline-invalidate-needs-policy` | error | I | Same, for `output.hline`. | | `output/hline-invalidate-without-mode` | warn | I | Same, for `output.hline`. | | `output/hline-unknown-preset` | warn | I | Unknown `invalidateWhen` preset on `output.hline`. | | `output/hline-event-without-mode` | error | I | `invalidateOnEvent` on `output.hline` is ignored unless `mode` is `"invalidateOnEvent"`. | | `output/trendline-invalidate-needs-policy` | error | I | `output.trendline` with `invalidateOnCustomFunction` needs a predicate. | | `output/trendline-invalidate-without-mode` | error | I | `invalidateWhen` on `output.trendline` is ignored without the mode. | | `output/trendline-preset-unsupported` | error | I | Trendlines have no presets. Pass an inline predicate. | | `output/trendline-event-without-mode` | error | I | `invalidateOnEvent` on `output.trendline` is ignored without the mode. | | `output/expires-required` | error | I | An invalidating output needs `expires`, e.g. `expires: "5d"`, or `"max"` for no expiry. | | `output/expires-without-mode` | warn | I | `expires` has no effect unless `mode` is `"invalidateOnCustomFunction"` or `"invalidateOnEvent"`. | | `output/invalidate-per-emit-fn` | error | I | `invalidateWhen: fn` on a `ctx.hline`, `ctx.range` or `ctx.trendline` emission cannot be re-checked past the cell that emitted it. Declare the rule on the output and pass per-level numbers through `meta`. | | `output/invalidate-predicate-shape` | error | I, D | The predicate reads the wrong shape. It receives `{ bar, entry, history }`, e.g. `({ bar, entry }) => bar.low <= entry.top && bar.high >= entry.bottom`. | | `output/invalidate-predicate-ctx-name` | warn | I, D | Rename the predicate argument from `ctx`. Destructure `({ bar, entry, history })`. | | `output/invalidate-predicate-always-true` | error | I, D | The predicate always returns `true`, so every drawing closes on the first bar it is checked. For a fixed end use mode `"all"` with `time2`; to close on price, compare `bar` with `entry`. | | `output/invalidate-predicate-never-true` | warn | I, D | The predicate always returns `false`, so nothing closes. That is mode `"all"`. | | `output/invalidate-predicate-ignores-price` | warn | I, D | The predicate reads no price: no `bar.open/high/low/close`, no `entry.top/bottom/price`, no `history`. It closes each drawing on the first bar its condition allows, whatever price does. | | `output/sweep-from-invalid` | error | I, D | `sweepFrom` must be `"anchor"` or `"birth"`. | | `output/sweep-from-without-mode` | warn | I, D | `sweepFrom` has no effect unless `mode` is `"invalidateOnCustomFunction"`. | On indicators, only the rules the builder classes as advisory are warnings. The trendline and `hline-event-without-mode` rules are not on that list, so they block. ## Layers | Id | Severity | Where | Fix | |---|---|---|---| | `layer/no-write-in-renderer` | error | I, D | No `upsert`, `patch`, `seal`, `remove` or `ctx` inside `layout`, `paint`, `paintGL`, `hit`, `autoscale` or `legend`. Write rows from `onBar`, `onRunEnd` or a gesture. | | `layer/no-write-in-timeframe-handler` | error | I, D | Write layer rows from the chart `onBar`, not inside a `timeframe(...)` handler. | | `layer/upsert-never-called` | error | I, D | Nothing writes to the layer. Call `upsert()` or `patch()` from `onBar` or `onRunEnd`, or add a gesture. | | `layer/expires-required` | error | I | A layer that seals rows (`sealWhen` or `sealOn`) needs `expires`. | | `layer/rows-in-bar-hook` | warn | I, D | `.rows()` in `onBar` scans every row on every bar. Use `get(key)`, `last()` or `range(t1, t2)`. | | `layer/renderer-not-registered` | warn | I, D | The layer has neither `paint` nor `paintGL`, so nothing draws. Fine for a data-only layer. | | `layer/escape-hatch` | warn | I, D | `p.all()`, `p.bitmap`, `g.raw` or `g.program` bypasses culling. Budget it. | | `outputs/layer-use-output-layer` | warn | I, D | `outputs.declare({ kind: "layer" })` returns no handle. Use `const rows = output.layer({ id, row, derived })`. | ## Dependencies | Id | Severity | Where | Fix | |---|---|---|---| | `indicators/missing-slug` | error | D | `indicators.declare` needs `slug`. | | `indicators/missing-as` | error | D | `indicators.declare` needs `as`, the local alias. | | `indicators/duplicate-as` | error | D | Each `as` must be unique. | | `indicators/legacy-shape` | error | D | Replace `{ id, symbol, args }` with `{ slug, as, version, settings }` and read `ctx.indicators.`. | | `indicators/missing-version` | error | I, D, S | Pin `version` (a positive integer; natives use `1`). | | `indicators/unknown-slug` | error | D | No native, scripted indicator or definition has this slug. | | `indicators/version-not-found` | error | D | The pinned version does not exist. The message lists the ones that do. | | `indicators/cycle` | error | D | The dependency graph loops back to this script. | | `indicators/container-series-read` | error | D | Read series by output key: `ctx.indicators...value`, never `ctx.indicators..value`. The message lists the keys. | | `flows/missing-version` | error | S | Pin `version` on `flows.declare`. | | `study/indicator-missing-version` | warn | S | Server form of the same check: an unpinned indicator floats to the latest version. | | `study/flow-missing-version` | warn | S | Server form: an unpinned definition floats to the latest version. | | `imports/missing-flow-id` | error | D | `imports.use` needs `flowId`. | | `imports/missing-alias` | error | D | `imports.use` needs `alias`. | | `imports/duplicate-alias` | error | D | Each import alias must be unique. | | `flow/upstream-lifecycle-reimplementation` | error | D | The definition rebuilds zone invalidation that its dependency already has. Read `ctx.indicators..lifecycle()` instead. | | `indicator/native-version-mismatch` | error at run time | D, S | A built-in indicator was pinned to a version other than `1`. | ## Sessions and ctx use | Id | Severity | Where | Fix | |---|---|---|---| | `flow/session-legacy-api` | error | D | `ctx.session.window`, `boundsOf` and `isStart` are not available. Use `ctx.session({ period, open?, close?, tz? })` and `s.didOpen`, `s.didClose`, `s.isOpen`, `s.prev`. | | `flow/session-bar-count-gate` | error | D | `ctx.session` takes no `length` or `tf`. Sessions end by clock: gate on `s.didClose`. | | `flow/session-bucket-param` | warn | D | A param looks like a bar-count session knob. Use `ctx.session` instead. | | `flow/hand-rolled-session-counter` | warn | D | `Math.floor(t / 86400)` day rollover. Use `ctx.session`. | | `flow/ctx-fn-as-value` | error | D | `ctx.accum`, `ctx.plot` and the other ctx functions must be called, not stored. A stored function cannot cross to the chart. | ## Workload | Id | Severity | Where | Fix | |---|---|---|---| | `workload/fine-price-step` | warn | I | A loop steps price by `0.01` or finer. On BTC that is tens of thousands of iterations per bar. Use the instrument tick size or a row-size setting. | | `workload/price-step-soft`, `workload/price-step-hard` | warn in the dry run | I, D | The projected rows per bar are high (soft) or excessive (hard). Coarsen the row size. | | `workload/tpo-zone-size-soft`, `workload/tpo-zone-size-hard` | warn in the dry run | I, D | The TPO zone spans too many ticks. Check the tick size. | ## Studies | Id | Severity | Fix | |---|---|---| | `study/no-emit` | error | `ctx.emit` is definition-only. Use `ctx.collect` and `ctx.publish`. | | `study/no-snapshot` | error | `ctx.snapshot` is not available in studies. | | `study/no-accum` | error | `ctx.accum` is not available. Use `ctx.collected(...)` in `onEvent` for earlier events. | | `study/no-timeframe-handles` | error | `timeframe(...)` is not available. Read declared definitions and indicators. | | `study/no-priceLevels` | error | The volume-at-price tape is not available. Read upstream events, visuals or `lifecycle()`. | | `study/no-events-declare`, `study/no-snapshots-declare`, `study/no-output`, `study/no-outputs-declare`, `study/no-imports` | error | Definition-only DSL. Studies use `flows.declare`, `results.declare` and `ctx.publish`. | | `study/forward-bad-opts` | error | `ctx.candles.forward()` takes `minutes`, `bars`, `untilTime`, `stopAt`, `targetAt`, `firstHit` and `atBar`. | | `study/window-as-object` | error | `ctx.candles.window()` returns a flat array. Iterate it; there is no `.bars` or `.candles`. | | `study/window-absolute-time` | warn | `before` and `after` are seconds relative to the event time, not timestamps. | | `study/session-boundsof-arity` | error | `ctx.session.boundsOf(t)` gives the UTC day only. Use `ctx.temporal.containing(t, { period })`. | | `study/session-key-not-numeric` | error | `ctx.session.key(t)` is a `YYYY-MM-DD` string. Use `ctx.temporal.containing(t, { period: "day" }).start` for day arithmetic. | | `study/ctx-out-of-scope` | error | `ctx` used in a helper that does not receive it, or at module scope. Pass `ctx` as a parameter. | | `study/event-flow-branch-mismatch` | error | `ctx.event.flow` is compared to a name that is not a `flows.declare({ as })` alias. | | `study/payload-key-undeclared` | error | `ctx.event.payload.` is not in any declared definition's payload. | | `study/payload-shape-mismatch` | warn | A published payload is missing keys its result kind needs. | | `study/unsafe-multi-output-indicator-access` | error, or warn for an unguarded read | Read `ctx.indicators..?.valueAt(t)` and guard with `Number.isFinite`. | | `study/ranges-not-lifecycle` | error | Do not treat `ranges()` fields such as `closedAt` as lifecycle. Use `.lifecycle()`. | | `study/lifecycle-source-missing` | error | Survival or invalidation measurements need `.lifecycle()` or a secondary event join `events({ after, filter })`. | | `study/publish-only-in-onFinish` | error | Call `ctx.publish` only in `onFinish`. | | `study/collect-not-in-onFinish` | error | `ctx.collect` writes are not allowed in `onFinish`. Read with `ctx.collected()`. | | `study/no-event-cursor-in-onFinish` | error | Event-cursor APIs have no clock in `onFinish` and return empty. Measure in `onEvent` and collect the result. | | `study/publish-without-declare` | error | Add `results.declare({ id, kind, title })` for the published id. | | `study/declare-without-publish` | warn | A declared result is never published. | | `study/result-missing-description` | warn | Add a `description` to the result. Forward Insight popovers show it. | | `study/missing-answer-prose` | warn | Add a `kind: "prose"` result published with `role: "answer"`. | | `study/readout-missing` | warn | Heavy chart results need a compact `readout__*` metric. | | `study/publish-looks-indexed` | warn | Rows carry a dimension but the result has no `indexedBy`. | | `study/publish-missing-index-column` | error | Rows (or `popover_layout` cells) must include every `indexedBy` column. | | `study/publish-missing-declared-column` | warn | A declared column is not set on published rows. | | `study/dimension-declare-fields` | error | `dimensions.declare` needs `id`, `title` and `description`. | | `study/dimension-invalid-role` | error | `role` is `"scope"` or `"report"`. | | `study/dimension-id-unique` | error | A dimension id is declared twice. | | `study/scope-required` | error, or warn on a hand edit of a study that groups with `ctx.scopeEvent` | Export `scope(ctx)`: it returns each event's scope tuple from what was known when the event fired, or `null` to leave the event out. It is an error when the study groups nothing, for a new study, and for every agent edit. | | `study/scope-return-keys` | error | `scope()` returns a key that is not a declared dimension, or does not return every scope dimension on every path. A tuple built at run time is checked when the study runs. | | `study/scope-report-dimension` | error | `scope()` returns a `role: "report"` dimension. Measure the outcome in `onEvent`, collect it and publish it through `indexedBy`. | | `study/scope-no-return` | error | `scope()` never returns, or has a bare `return;`. Return the tuple, or `null` to leave the event out. | | `study/scope-forward-read` | error for `ctx.candles.forward`, warn for `events({ after })` | `scope()` sees only what was known when the event fired. Read forward bars and later events in `onEvent`. | | `study/scope-side-effect` | error | `scope()` calls something that is not available there: `ctx.collect`, `ctx.collected`, `ctx.state`, `ctx.rand`, `ctx.cluster`, `ctx.scopeEvent`, `ctx.publish`, `ctx.popoverLayout`, `ctx.plot`, `ctx.range`, `ctx.mark`, `ctx.hline`, `ctx.note`, `ctx.groupByScope`, `ctx.emit` or `ctx.snapshot`. Measure and record in `onEvent`; use `ctx.previous()` for earlier events. | | `study/scope-reads-module-state` | error | `scope()` reads a module variable that other events change. The chart groups one event on its own and would not see it. Derive the group from the event, its past data or `ctx.previous()`. | | `study/record-only-in-onEvent` | error | A study without `scope()` calls `ctx.scopeEvent` outside `onEvent`. Move the grouping into `scope(ctx)`. | | `study/record-multiple` | warn | A study without `scope()` calls `ctx.scopeEvent` more than once in `onEvent`. Export `scope(ctx)` returning one tuple. | | `study/record-unknown-dimension` | error | A study without `scope()` passes an undeclared dimension to `ctx.scopeEvent`. | | `study/record-report-dimension` | error | A study without `scope()` passes a `role: "report"` dimension to `ctx.scopeEvent`. It belongs in `indexedBy`. | | `study/record-missing-declared-dimension` | error | A study without `scope()` collects rows but its `ctx.scopeEvent` never sets a declared scope dimension. | | `study/record-non-canonical-dimension-value` | error | A scope value is not one of the dimension's declared `values`. Display labels go in blocks. | | `study/record-without-publish` | warn | A scope dimension is in no result's `indexedBy`. | | `study/report-dimension-unused` | warn | A report dimension is in no result's `indexedBy`. | | `study/joint-cell-required` | warn | The scope tuple holds two or more scope dimensions, so publish one result indexed by all of them. | | `study/bucket-record-without-bucketed-publish` | warn | A study without `scope()` calls `ctx.scopeEvent({ bucket })` with no bucketed result. Declare dimensions and return them from `scope()`. | | `study/bucketed-publish-without-bucket-record` | warn | Bucketed results need declared dimensions returned from `scope()` for Forward Insights to match. | | `study/dry-run` | error | The Study authoring agent's proposal failed a real run on a preset market. The faults are listed. | ## Run-time errors ### Indicator and definition budgets A script that goes over a budget stops with ` exceeded: / ` and a remedy. Soft limits warn once; hard limits stop the run. | Kind | Limit | Fix | |---|---|---| | `run_wall_clock` | warn at 2 s, stop at 30 s per calculation | Use less history or do less per bar. | | `handler_wall_clock` | 5 s in one handler call | Avoid loops over every price tick on every bar. | | `loop_iterations` | 350,000 per handler; per run it scales with bars, from 2 million to 50 million | Process each higher-timeframe bucket once; use the tick size. | | `ctx_calls` | 500,000 per handler | Fewer `ctx.plot`, `emit`, `range` and `accum` calls per bar. | | `indicator_points` | warn at 500,000, stop at 2,000,000 | Emit on transitions only, or use less history. | | `emitted_events` | warn at 25,000, stop at 100,000 | Tighten emit conditions or declare `oncePer`. | | `accum_slots` | warn at 256, stop at 1,024 | Reuse fewer `ctx.accum` ids. | | `lifecycle_instances` | warn at 2,500, stop at 10,000 | Emit fewer persistent ranges, or use `mode: "replace"`. | | `collected_rows` | 100,000 per key, 500,000 total | Aggregate before collecting. | | `payload_size` | | Publish smaller payloads. | | `layer_rows` | warn at 5,000, stop at 20,000 rows per layer | Seal and remove old rows, or key one row per session. | | `layer_bytes` | warn at 4 MB, stop at 32 MB per layer | Coarsen `bins` or `grid` steps, or remove old rows. | | `warmup_replay` | warn at 2.5 s, stop at 10 s | Lower the warmup, or keep running sums in handlers instead of arrays. | Layers also stop with `frame hooks are read-only` when a renderer writes, and pause with `paint exceeded the 4 ms frame budget` when painting stays slow for three frames. ### Emits dropped at run time A definition's run counts every emit it drops. These are the reasons: | Reason | Cause | Fix | |---|---|---| | `missing_label` | `ctx.emit` without `label`. | Pass `{ label }`. | | `unknown_event_id` | The id has no `events.declare`. | Declare it. | | `dedupe_oncePer` | The event's `oncePer` keys matched an earlier emit. | Expected. Widen the keys if you wanted repeats. | | `warmup` | The bar was in the warmup. Warmup bars compute state but record no events. | Expected. | ### Dependency output | Code | Cause | Fix | |---|---|---| | `dependency_output_unavailable` | A declared dependency produced no value for the output you read. | See [Dependency unavailable](https://docs.chartnaut.com/scripting/dependency-unavailable). | ### Study run errors A failed study run reports one of these kinds with a request ID for support. | Kind | Meaning | Fix | |---|---|---| | `compile_error` | The study did not compile. | Fix the error in the message. | | `runtime_error` | The study threw. | Fix the line in the message. | | `script_execution_timeout` | One event took longer than 15 s, or `onFinish` or startup took too long. | Do less per event. | | `too_many_event_timeouts` | 10 or more events timed out in one run. | Do less per event. | | `too_many_event_errors` | Events kept throwing. | Fix the first reported error. | | `budget_wall_clock` | The run passed 10 minutes. | Use a shorter range or fewer dependencies. | | `memory_limit` | The run ran out of memory. | Use a shorter range. | | `budget_call_stack` | Recursion deeper than 1,024 calls. | Remove the recursion. | | `budget_total_events` | More than 100,000 events. | Use a shorter range or a more selective definition. | | `budget_emitted_events` | The definition produced too many events. | Tighten its conditions. | | `budget_indicator_points` | An indicator produced too many points. | Use a shorter range or fewer outputs. | | `budget_collected_rows` | Too many collected rows. | Collect fewer values. | | `budget_annotations` | More than 10,000 chart annotations. | Annotate less often. | | `budget_payload` | Results too large. | Publish fewer or smaller results. | | `budget_forward_bars` | A forward scan of more than 5,000 bars. | Shorten the forward window. | | `budget_kmeans_iterations`, `budget_bootstrap_samples`, `budget_pca_features` | Statistics helper limits: 200 iterations, 100,000 samples, 128 features. | Reduce the size. | | `data_query_timeout` | Market data did not load in time. | Try again. | | `dependency_failed` | A definition run the study waited on did not finish. | Retry the definition run. | | `unsupported_data_type` | The instrument cannot serve data the study needs, such as the volume tape on an FX CFD. | Pick another instrument. | | `security_policy_violation` | The script generates code at run time. | Remove `eval` or `Function`. | | `capacity_unavailable` | Study execution is busy. | Try again shortly. | | `cancelled` | The run was cancelled. | | | `internal` | Something failed on Chartnaut's side. | Contact [support](https://docs.chartnaut.com/account/support) with the request ID. | ### Scope errors A problem with one event's `scope()` call leaves that event out of the study and the run continues. The run lists each error. | Message | Fix | |---|---| | `scope() returned undefined: return the event's scope tuple, or null to leave the event out of the study` | Return on every path. | | `scope() returned : return an object of scope dimensions, or null` | Return an object. | | `scope() returned "", which is not a declared dimension` | Declare it, or drop it from the tuple. | | `scope() returned "", a report dimension (role: "report")` | Measure it in `onEvent` and publish it through `indexedBy`. | | `scope() did not return "": every scope dimension needs a value for every event in the study` | Set every scope dimension in every tuple. | | `scope() returned "": ` | The value is outside the dimension's declared `values`. Use a canonical value. | | `scope threw: ` | Fix the line in the error. | | `ctx.candles.window({ after }) reads