Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.darvas.app/llms.txt

Use this file to discover all available pages before exploring further.

Opening the editor

Navigate to /terminal, then click Add indicator in the chart toolbar and select Custom from the dropdown. The script editor opens in a side panel on the right.
1

Find the editor

Go to /terminal. Click the indicator button in the chart toolbar and choose Custom indicator. The editor panel slides in from the right.
2

Write your script

The editor is a full CodeMirror 6 instance with JavaScript syntax highlighting, bracket matching, and automatic indentation. Autocomplete fires on . (dot access) and Ctrl+Space. Hover any built-in name to see its signature.
3

Adjust input parameters

The Inputs panel below the editor renders one form control per input.* call in your script. Change values there - no need to edit the code for common tuning like length or color.
4

Preview on chart

Click Add to chart to evaluate the current script against all visible bars and render the output as a draft overlay. This does not save the indicator - it is a live preview only.
5

Save for reuse

Click Save indicator to persist the script under a name. Saved indicators appear in your indicator library and can be added to any pair/timeframe.
6

Inspect console output

The Console panel at the bottom of the editor shows any console.log / console.warn output and runtime errors. Output is capped at 100 lines x 200 characters per line.

CodeMirror features

FeatureHow to use
AutocompleteType . after a namespace (ta., math., ctx.) or press Ctrl+Space
Syntax errorsRed squiggles + error message in the Console panel on evaluation
Error markersThe offending line gets a red gutter marker; click to see the full message
Multi-cursorAlt+Click to add cursors; Ctrl+D to select the next occurrence
Comment toggleCtrl+/ to comment/uncomment the selected lines

Inputs panel

Every input.* call at the top level registers a parameter that the Inputs panel renders as a form control:
Input typeControl
input.int / input.floatNumber spinner with optional min/max/step
input.boolCheckbox
input.string with optionsDropdown select
input.string without optionsText field
input.colorColor picker
input.sourceOHLCV source dropdown (open, high, low, close, hl2, hlc3, ohlc4)
input.* calls inside onBar throw a RuntimeError. All parameter declarations must be at the top level of your script.

Draft vs persisted

  • Add to chart - evaluates the current editor contents as a temporary draft. The draft is stored in browser localStorage keyed by the pair (e.g. BTC-USDT-SWAP). Only one draft per pair is stored at a time; adding a new draft for the same pair replaces the old one.
  • Save indicator - persists the script server-side under a name. Saved indicators survive page reloads, work across devices, and can be added to multiple pairs simultaneously.
Browser draft persistence is limited to one indicator per pair. If you switch pairs before saving, your unsaved draft will be overwritten when you come back to the original pair and run a new evaluation.

Script lifecycle

Understand what runs once vs. once per bar.

Inputs

Full reference for all input types and options.

Quickstart

Write your first indicator in 5 minutes.

Console and limits

Log caps and runtime budgets.