Add an indicator

add_indicatorChanges the chart

The app adds an indicator to a chart.

Details#

Add a new copy of an indicator to a layout and return its id. Always adds another copy, even when that indicator is already on the layout; a further copy of a built-in study starts in its own colour so the member can tell the copies apart, and its legend reads its inputs (SMA 9 close). A layout holds at most 20 copies; the 21st is refused with indicator_limit. name is a type or name from list_indicators (sma, Simple Moving Average, SMA, rsi), a saved script id to draw that script, or Money Line (Bullmania's invite-only script; refused with feature_locked when this account has no access). The type is stored as the chart's own type (sma, not the display name). The answer's id is the copy. Use that id with remove_indicator and configure_indicator. After adding a catalog study, tell the member it was added to their chart, then call read_chart to read its values. If the add is refused with feature_locked, tell the member that feature is not included in their account and do not guess values. A script added this way is drawn on the chart, and read_chart returns its plotted values and any table it draws. If a table is off, read_chart says to turn it on in that indicator's Settings, for example Turn on "Show Info Table" in this indicator's Settings to see its table. Example: name sma, settings {"length": 200}.

Inputs#

NameTypeRequiredDescription
namestringRequiredIndicator type or name from list_indicators, for example sma or rsi, a saved script id, or Money Line.
settingsstringOptionalOptional settings as JSON, for example {"length": 20}. Omit to keep the current ones.
layoutstringOptionalLayout name from list_layouts, or "Default" (the member's own chart). Omit to use the layout the member has open, or Default when no chart is open.