Bentrix Docs
HomePricingDashboard

Java: indicators and scripts

Every method of client.indicator in the Java SDK.

ideBoard#

Read or arrange the Assay IDE's board · tool ide_board

scope: labplan: freesince 3.14.0

The board of the script in front: where each statement's cluster stands, laid out by hand, kept beside the script in the indicators folder and never in its text. Read answers it; place moves one statement's cluster; tidy lays them all again in the text's order; forget deletes the arrangement. A view act, as a person's drag of a cluster's body is: no byte of the script changes. The script must be saved into the indicators folder.

Declaration

client.indicator
public Object ideBoard(IdeBoardArgs args)

Parameters

NameTypeWhat it is
actionStringrequiredread answers the arrangement; place puts statement index (from 0, in the text's order) at x, y; tidy lays every statement again in the text's order; forget deletes the arrangement.
indexlongoptional
xdoubleoptional
ydoubleoptional

Returns

Object — the tool’s answer as maps and lists.

What it answers

What the tool's description says.

Example

client.indicator.ideBoard(new Bentrix.IndicatorApi.IdeBoardArgs("…"))

ideEdit#

Set the text in the Assay IDE · tool ide_edit

scope: labplan: freesince 1.16.0

Sets the whole text of the tab in front of the Assay IDE, as typing does: checked at once, one entry the person's Ctrl+Z takes back, nothing saved (indicator_install saves). Answers the IDE as ide_state does, with the new findings.

Declaration

client.indicator
public Object ideEdit(IdeEditArgs args)

Parameters

NameTypeWhat it is
sourceStringrequiredThe whole new text of the tab in front.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the IDE as ide_state does, with the new findings.

Example

client.indicator.ideEdit(new Bentrix.IndicatorApi.IdeEditArgs("…"))

ideGraph#

Read the Assay IDE's graph · tool ide_graph

scope: readplan: freesince 3.14.0

Answers the sheet of the tab in front of the Assay IDE: a row per statement with its own line number and the kind of thing it is, and inside each row the nodes it draws, each with its kind, its label and the lines its text stands on. The same sheet the window draws, read the same way a person reads it. Writes nothing.

Declaration

client.indicator
public Object ideGraph()

It takes no arguments.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the sheet of the tab in front of the Assay IDE: a row per statement with its own line number and the kind of thing it is, and inside each row the nodes it draws, each with its kind, its label and the lines its text stands on.

Example

client.indicator.ideGraph()

ideGraphEdit#

Make a gesture on the Assay IDE's graph · tool ide_graph_edit

scope: labplan: freesince 3.14.0

Makes one gesture on the sheet of the tab in front, exactly as a person's press or drag makes it: written into the text by the same function, one entry the person's Ctrl+Z takes back, checked as typing is, nothing saved. A gesture the sheet refuses is answered with its sentence and changes nothing. Answers the IDE as ide_state does.

Declaration

client.indicator
public Object ideGraphEdit(IdeGraphEditArgs args)

Parameters

NameTypeWhat it is
gestureObjectrequiredOne gesture of the sheet, as ide_graph's rows and nodes name the text: {"SetLiteral": {"at": span, "value": "20"}}, {"Wire": {"from": span, "to": span, "cast": null}}, {"AddRow": {"after": span, "text": "…"}}, {"MoveRow": …}, {"DeleteRow": …}, {"WrapIn": {"first": span, "last": span, "with": "If"}}, {"Extract": …} and the rest; a span is {"start": {"line": l, "col": c}, "end": {…}} exactly as ide_graph answers it.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the IDE as ide_state does.

Example

client.indicator.ideGraphEdit(new Bentrix.IndicatorApi.IdeGraphEditArgs("…"))

ideOpen#

Open a script in the Assay IDE · tool ide_open

scope: labplan: freesince 1.16.0

Opens the Assay IDE on a script of the indicators folder by its file name, brought to the front if a tab holds it already, or on a new script's text in a new tab, not saved. Answers the IDE as ide_state does.

Declaration

client.indicator
public Object ideOpen(IdeOpenArgs args)

Parameters

NameTypeWhat it is
fileStringoptionalA script of the indicators folder by its file name (mean.assay), brought to the front if a tab holds it already. Give this or source.
sourceStringoptionalOr a new script's whole text, in a new tab, not saved.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the IDE as ide_state does.

Example

client.indicator.ideOpen(new Bentrix.IndicatorApi.IdeOpenArgs())

ideState#

Read the Assay IDE · tool ide_state

scope: readplan: freesince 1.16.0

Answers whether the Assay IDE is open, its tabs (each tab's number, name, whether it is unsaved and whether it is in front, and the tab shown beside it in a split), and the tab in front: its name, file, text, findings and stops with their conditions. Writes nothing.

Declaration

client.indicator
public Object ideState()

It takes no arguments.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers whether the Assay IDE is open, its tabs (each tab's number, name, whether it is unsaved and whether it is in front, and the tab shown beside it in a split), and the tab in front: its name, file, text, findings and stops with their conditions.

Example

client.indicator.ideState()

ideStop#

Put or take a stop in the Assay IDE · tool ide_stop

scope: labplan: freesince 1.16.0

Puts a stop on a line of the script in front of the Assay IDE, with the condition it stops on, or takes it away, as F9 and the stop's condition field do. A run and inspect then says where it fires. Answers the IDE as ide_state does.

Declaration

client.indicator
public Object ideStop(IdeStopArgs args)

Parameters

NameTypeWhat it is
linelongrequiredThe line of the script in front, from 1.
onbooleanrequiredTrue puts a stop there (or changes its condition), false takes it away.
conditionStringoptionalThe condition it stops on, an expression of the script (n % 2 == 1); empty or absent: whenever the line runs.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the IDE as ide_state does.

Example

client.indicator.ideStop(new Bentrix.IndicatorApi.IdeStopArgs(1L, true))

install#

Install a study script · tool indicator_install

scope: adminplan: plussince 1.2.0

Writes a study script into the person's indicators folder: a Python study, or an Assay script when the file name ends.assay. A file already there is written over only with replace, and then waits for the person's tick like a new one. It is not run - not even read for its declaration - until the person ticks it in Settings › Indicators. Answers the file and its state.

Declaration

client.indicator
public Object install(InstallArgs args)

Parameters

NameTypeWhat it is
fileNameStringrequiredThe script's file name in the indicators folder: [a-z0-9_]{1,32}, with or without.py; with.assay for an Assay script.
sourceStringrequiredThe script's whole text: one @study, as bentrix.study declares it; or an Assay script, which script_check checks first.
replacebooleanoptionalTrue writes over the script already in the folder under this name (the Assay editor's Save); the file is then the agent's and waits for the person's tick again. Omitted or false, a file already there is never written over.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the file and its state.

Example

client.indicator.install(new Bentrix.IndicatorApi.InstallArgs("docs_sma.assay", "//@version=6\nindicator(\"Docs SMA\", overlay=true)\nplot(ta.sma(close, 20))\n"))

read#

Read a study script's text · tool indicator_read

scope: readplan: freesince 1.10.0

Answers the text of one script in the person's indicators folder - an Assay script or a Python study - with its state as indicators_state lists it: what the Assay editor opens. Only a file of that folder is read; a script from elsewhere is handed to script_check and indicator_install as text.

Declaration

client.indicator
public Object read(ReadArgs args)

Parameters

NameTypeWhat it is
fileStringrequiredThe script's file name in the indicators folder, with its extension: my_rsi.assay or my_sma.py.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the text of one script in the person's indicators folder - an Assay script or a Python study - with its state as indicators_state lists it: what the Assay editor opens.

Example

client.indicator.read(new Bentrix.IndicatorApi.ReadArgs("…"))

rescan#

Read the indicators folder again · tool indicator_rescan

scope: labplan: plussince 1.2.0

Reads the person's indicators folder again, as Settings › Indicators' Rescan does: each script that may run describes itself, and indicators_state reads the outcome once it lands.

Declaration

client.indicator
public Object rescan()

It takes no arguments.

Returns

Object — the tool’s answer as maps and lists.

What it answers

What the tool's description says.

Example

client.indicator.rescan()

scriptCheck#

Check an Assay script · tool script_check

scope: readplan: freesince 1.5.0

Compiles an Assay script under Settings › Assay's settings and derives the custom study it would be, writing nothing; budgets says the steps a bar, bars back, array elements, string characters and nesting it runs under, and what a trial run over 500 synthetic bars used of them (whether it ran, its fault, the most steps a bar took and its share of the budget). Answers every finding with its line and column (kind: error, refused, later, reads the future), the notes on calls that run as no-ops, and either the study's custom_study_spec or the reasons it cannot be one, each at its place; and the compatibility report: how many built-ins it names and every place that does not simply run (each finding, and each built-in that diverges, with what it computes differently), as the Assay editor exports it.

Declaration

client.indicator
public Object scriptCheck(ScriptCheckArgs args)

Parameters

NameTypeWhat it is
sourceStringrequiredThe script's whole text; it begins //@version=5 or //@version=6.
nameStringoptionalThe file's stem the study's id is made from; omitted, the id is script_<8 hex> of the text.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Recorded from a running Bentrix 0.1.382 on a laboratory of generated markets (long lists cut to their first rows):

{
  "budgets": {
    "limits": {
      "max_array": 100000,
      "max_bars_back": 5000,
      "max_nesting": 60,
      "max_string": 4096,
      "steps_per_bar": 2000000
    },
    "trial": {
      "bars": 500,
      "fault": null,
      "peak_steps_per_bar": 19,
      "ran": true,
      "share_of_budget": 0.0
    }
  },
  "compatibility": {
    "builtins": 3,
    "rows": [],
    "runs": true
  },
  "compiles": true,
  "diagnostics": [],
  "notes": [],
  "refusals": [],
  "spec": {
    "about": "",
    "family": "oscillator",
    "id": "script_093b8749",
    "lines": [
      {
        "name": "plot_0",
        "plot": "line"
      }
    ],
    "lookback": 1,
    "scale": "auto",
    "schema_version": 1,
    "title": "t"
  },
  "version": {
    "declared": 6,
    "served": 6
  }
}

Example

client.indicator.scriptCheck(new Bentrix.IndicatorApi.ScriptCheckArgs("//@version=6\nindicator(\"t\")\nplot(ta.sma(close, 20))\n"))

scriptComplete#

Complete an Assay script at a place · tool script_complete

scope: readplan: freesince 1.15.0

Answers what may be typed at line and col of an Assay script, best first, in the text's own version (a version-4 text is offered version 4's names, each with what it is read as): each item's label, kind, signature or type, note, the text it inserts, whether it runs here, and whether it is Assay's own; and the span the items replace. Writes nothing.

Declaration

client.indicator
public Object scriptComplete(ScriptCompleteArgs args)

Parameters

NameTypeWhat it is
sourceStringrequiredThe script's whole text, in any version 1 to 6 or with no version line.
linelongrequiredThe line, from 1.
collongrequiredThe column, from 1, in characters.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers what may be typed at line and col of an Assay script, best first, in the text's own version (a version-4 text is offered version 4's names, each with what it is read as): each item's label, kind, signature or type, note, the text it inserts, whether it runs here, and whether it is Assay's own; and the span the items replace.

Example

client.indicator.scriptComplete(new Bentrix.IndicatorApi.ScriptCompleteArgs("…", 1L, 1L))

scriptConvert#

Convert an Assay script to a newer version · tool script_convert

scope: readplan: freesince 1.15.0

Answers an older script (version 1 to 4, or no version line) written in version 5 or 6 - the text and the edits that make it, one a changed run of lines - as the IDE's Convert command shows it in a diff: the version pass's own reading written onto the source, every comment and the layout kept, computing what the original computes. Refused by name where an edit in place cannot say it (a script declaring its own ta, a strategy's when inside an expression) and for a conversion down. Writes nothing; the agent applies the edits or not.

Declaration

client.indicator
public Object scriptConvert(ScriptConvertArgs args)

Parameters

NameTypeWhat it is
sourceStringrequiredThe script's whole text, version 1 to 4 or with no version line.
tolongrequiredThe version it is written in: 5 or 6.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers an older script (version 1 to 4, or no version line) written in version 5 or 6 - the text and the edits that make it, one a changed run of lines - as the IDE's Convert command shows it in a diff: the version pass's own reading written onto the source, every comment and the layout kept, computing what the original computes.

Example

client.indicator.scriptConvert(new Bentrix.IndicatorApi.ScriptConvertArgs("…", 1L))

scriptDefinition#

Where an Assay script declares a name · tool script_definition

scope: readplan: freesince 1.15.0

Answers the span where the script declares the name at line and col; null for a built-in or no name. Writes nothing.

Declaration

client.indicator
public Object scriptDefinition(ScriptDefinitionArgs args)

Parameters

NameTypeWhat it is
sourceStringrequiredThe script's whole text, in any version 1 to 6 or with no version line.
linelongrequiredThe line, from 1.
collongrequiredThe column, from 1, in characters.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the span where the script declares the name at line and col; null for a built-in or no name.

Example

client.indicator.scriptDefinition(new Bentrix.IndicatorApi.ScriptDefinitionArgs("…", 1L, 1L))

scriptFolds#

Where an Assay script folds · tool script_folds

scope: readplan: freesince 1.15.0

Answers each run of lines that folds: the line that stays shown and the last line it hides. Writes nothing.

Declaration

client.indicator
public Object scriptFolds(ScriptFoldsArgs args)

Parameters

NameTypeWhat it is
sourceStringrequiredThe script's whole text, in any version 1 to 6 or with no version line.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers each run of lines that folds: the line that stays shown and the last line it hides.

Example

client.indicator.scriptFolds(new Bentrix.IndicatorApi.ScriptFoldsArgs("…"))

scriptFormat#

Format an Assay script · tool script_format

scope: readplan: freesince 1.15.0

Answers the script's text formatted as the IDE's Format makes it, and the edits that make it: whitespace moved and nothing else - no name rewritten, the version line unchanged. Writes nothing.

Declaration

client.indicator
public Object scriptFormat(ScriptFormatArgs args)

Parameters

NameTypeWhat it is
sourceStringrequiredThe script's whole text, in any version 1 to 6 or with no version line.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the script's text formatted as the IDE's Format makes it, and the edits that make it: whitespace moved and nothing else - no name rewritten, the version line unchanged.

Example

client.indicator.scriptFormat(new Bentrix.IndicatorApi.ScriptFormatArgs("…"))

scriptHistoryList#

An Assay script's kept versions · tool script_history_list

scope: readplan: freesince 1.15.0

Answers the versions the IDE kept of one script of the indicators folder, newest first: each one's id, when (UTC), what took it (save, run, format, convert, restore), the lines it added and removed against the one before, and its label. Writes nothing.

Declaration

client.indicator
public Object scriptHistoryList(ScriptHistoryListArgs args)

Parameters

NameTypeWhat it is
fileStringrequiredA script of the indicators folder, by its file name (rsi_divergence.assay) or its stem.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the versions the IDE kept of one script of the indicators folder, newest first: each one's id, when (UTC), what took it (save, run, format, convert, restore), the lines it added and removed against the one before, and its label.

Example

client.indicator.scriptHistoryList(new Bentrix.IndicatorApi.ScriptHistoryListArgs("…"))

scriptHistoryRead#

Read one kept version of an Assay script · tool script_history_read

scope: readplan: freesince 1.15.0

Answers the text of one version the IDE kept of a script, exactly as it stood. Writes nothing; an agent that wants it back installs it with indicator_install.

Declaration

client.indicator
public Object scriptHistoryRead(ScriptHistoryReadArgs args)

Parameters

NameTypeWhat it is
fileStringrequiredA script of the indicators folder, by its file name or its stem.
idStringrequiredA version's id, as script_history_list answers it.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the text of one version the IDE kept of a script, exactly as it stood.

Example

client.indicator.scriptHistoryRead(new Bentrix.IndicatorApi.ScriptHistoryReadArgs("…", "…"))

scriptHover#

What a name in an Assay script is · tool script_hover

scope: readplan: freesince 1.15.0

Answers what the name at line and col of an Assay script is: its span, its title (a built-in's signature, or how the script declares it), its note, whether it runs here, what a version 1-4 name is read as, and whether it is Assay's own; null where no name stands there. Writes nothing.

Declaration

client.indicator
public Object scriptHover(ScriptHoverArgs args)

Parameters

NameTypeWhat it is
sourceStringrequiredThe script's whole text, in any version 1 to 6 or with no version line.
linelongrequiredThe line, from 1.
collongrequiredThe column, from 1, in characters.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers what the name at line and col of an Assay script is: its span, its title (a built-in's signature, or how the script declares it), its note, whether it runs here, what a version 1-4 name is read as, and whether it is Assay's own; null where no name stands there.

Example

client.indicator.scriptHover(new Bentrix.IndicatorApi.ScriptHoverArgs("…", 1L, 1L))

scriptInspect#

Run an Assay script recorded, as the IDE's Run and inspect does · tool script_inspect

scope: readplan: freesince 1.15.0

Runs a script over a workbench's bars of one market and interval, up to its cursor and never past it (the newest 5000), recorded as the IDE's Run and inspect records it, and answers: how many bars were read, each asked bar's named values at its close and the lines that ran in it (a bar outside the kept 5000 or past the bars read is refused), the bars where each stop fired, the script's log, its fault, and its lines by steps. Runs nothing on a chart and writes nothing.

Declaration

client.indicator
public Object scriptInspect(ScriptInspectArgs args)

Parameters

NameTypeWhat it is
sourceStringrequiredThe script's whole text.
benchStringrequiredThe workbench's uri, as get_state gives it.
symbolStringrequiredOne of the workbench's markets.
timeframeStringrequiredAn interval's label: M1, H4, D1.
barsList<Long>optionalThe bars whose rows are answered, by their place from 0 (the oldest read); omitted, the last.
stopsObjectoptionalStops, as the IDE's F9 puts them: the bars where each fired are answered.

Returns

Object — the tool’s answer as maps and lists.

What it answers

What the tool's description says.

Example

client.indicator.scriptInspect(new Bentrix.IndicatorApi.ScriptInspectArgs("…", bench, "SYN-DOCS", "H1"))

scriptReferences#

Every place an Assay script reads a name · tool script_references

scope: readplan: freesince 1.15.0

Answers every span where the script reads the name at line and col (its own name, in its own scope), the declaration among them unless include_declaration is false. Writes nothing.

Declaration

client.indicator
public Object scriptReferences(ScriptReferencesArgs args)

Parameters

NameTypeWhat it is
sourceStringrequiredThe script's whole text.
linelongrequiredThe line, from 1.
collongrequiredThe column, from 1, in characters.
includeDeclarationbooleanoptionalWhether the declaration is among the answers; true when omitted.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers every span where the script reads the name at line and col (its own name, in its own scope), the declaration among them unless include_declaration is false.

Example

client.indicator.scriptReferences(new Bentrix.IndicatorApi.ScriptReferencesArgs("…", 1L, 1L))

scriptRename#

Rename a name an Assay script declares · tool script_rename

scope: readplan: freesince 1.15.0

Answers the edits that rename the script's own name at line and col to new_name everywhere it is read in its scope, or refuses by name (a built-in, a name already taken there, a name that is not one). Answers edits and writes nothing; the agent applies them or not.

Declaration

client.indicator
public Object scriptRename(ScriptRenameArgs args)

Parameters

NameTypeWhat it is
sourceStringrequiredThe script's whole text.
linelongrequiredThe line, from 1.
collongrequiredThe column, from 1, in characters.
newNameStringrequiredThe name it is given.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the edits that rename the script's own name at line and col to new_name everywhere it is read in its scope, or refuses by name (a built-in, a name already taken there, a name that is not one).

Example

client.indicator.scriptRename(new Bentrix.IndicatorApi.ScriptRenameArgs("…", 1L, 1L, "…"))

scriptSignature#

The call an Assay script's place stands in · tool script_signature

scope: readplan: freesince 1.15.0

Answers the call that line and col of an Assay script stands inside: the callee as written, its signature, its parameters with their types, which one is being typed, its note and what a version 1-4 name is read as; null where the place is in no call. Writes nothing.

Declaration

client.indicator
public Object scriptSignature(ScriptSignatureArgs args)

Parameters

NameTypeWhat it is
sourceStringrequiredThe script's whole text, in any version 1 to 6 or with no version line.
linelongrequiredThe line, from 1.
collongrequiredThe column, from 1, in characters.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the call that line and col of an Assay script stands inside: the callee as written, its signature, its parameters with their types, which one is being typed, its note and what a version 1-4 name is read as; null where the place is in no call.

Example

client.indicator.scriptSignature(new Bentrix.IndicatorApi.ScriptSignatureArgs("…", 1L, 1L))

scriptSymbols#

An Assay script's outline · tool script_symbols

scope: readplan: freesince 1.15.0

Answers the outline the IDE shows: the declaration, the inputs, the functions with their parameters, the types and enums, and the outputs by title, each with its span and kind, nested. Writes nothing.

Declaration

client.indicator
public Object scriptSymbols(ScriptSymbolsArgs args)

Parameters

NameTypeWhat it is
sourceStringrequiredThe script's whole text, in any version 1 to 6 or with no version line.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers the outline the IDE shows: the declaration, the inputs, the functions with their parameters, the types and enums, and the outputs by title, each with its span and kind, nested.

Example

client.indicator.scriptSymbols(new Bentrix.IndicatorApi.ScriptSymbolsArgs("…"))

scriptVocabulary#

A version's own words · tool script_vocabulary

scope: readplan: freesince 1.15.0

Answers a version's keywords and, for versions 1 to 4, every name that version writes bare and what it is read as (sma read as ta.sma, study as indicator). Writes nothing.

Declaration

client.indicator
public Object scriptVocabulary(ScriptVocabularyArgs args)

Parameters

NameTypeWhat it is
versionlongrequiredA version, 1 to 6.

Returns

Object — the tool’s answer as maps and lists.

What it answers

Answers a version's keywords and, for versions 1 to 4, every name that version writes bare and what it is read as (sma read as ta.

Example

client.indicator.scriptVocabulary(new Bentrix.IndicatorApi.ScriptVocabularyArgs(1L))

Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed