Sidechair

indicator()

Browse the reference

Declares the script as an indicator and sets its title, pane placement, display format and drawing limits.

Try it in the editor

Put indicator() at the top of the script, once. It names the script and decides whether it draws on the main chart or in its own pane. Without overlay = true, the script gets its own pane under the chart.

format and precision control how values are written in the legend and on the price scale. The max_*_count arguments raise the number of lines, labels and boxes the script may keep; each is limited to 500.

Syntax

Pine Script
indicator(title: const string, shorttitle: const string (optional), overlay: const bool (optional), format: const string (optional), precision: const int (optional), scale: const scale_type (optional), max_bars_back: const int (optional), timeframe: const string (optional), timeframe_gaps: const bool (optional), explicit_plot_zorder: const bool (optional), max_lines_count: const int (optional), max_labels_count: const int (optional), max_boxes_count: const int (optional), calc_bars_count: const int (optional), max_polylines_count: const int (optional), dynamic_requests: const bool (optional), behind_chart: const bool (optional)) -> void

Arguments

NameTypeDefaultDescription
titleconst stringrequiredName of the script, shown in the legend and the indicator list.
shorttitleconst stringtitleShort name shown in the legend. The title is used when it is left out.
overlayconst boolfalsetrue draws on the main chart; false draws in a separate pane.
formatconst stringformat.inheritHow values are written: format.inherit, format.price, format.volume or format.percent.
precisionconst intnaNumber of decimals shown, from 0 to 16.
scaleconst scale_typescale.rightPrice scale the pane uses: scale.right, scale.left or scale.none.
max_bars_backconst int0Longest history lookback the script needs. Accepted and ignored; history is not trimmed.
timeframeconst string""Timeframe the script computes on. A value other than the chart's gives a warning and the script runs on the chart's timeframe.
timeframe_gapsconst booltrueWhether higher-timeframe values leave gaps. Accepted and ignored.
explicit_plot_zorderconst boolfalseWhether plots stack in code order. Accepted and ignored.
max_lines_countconst int50Most line objects kept. A whole number up to 500.
max_labels_countconst int50Most label objects kept. A whole number up to 500.
max_boxes_countconst int50Most box objects kept. A whole number up to 500.
calc_bars_countconst int0Number of history bars the script computes. Accepted and ignored.
max_polylines_countconst int50Most polyline objects kept. Accepted and ignored.
dynamic_requestsconst boolfalseAllows request.* calls to take series arguments. Accepted and ignored.
behind_chartconst booltrueWhether overlay plots draw behind the chart's candles. Accepted and ignored.

Returns

Nothing.

Remarks

  • A script has exactly one declaration: indicator, strategy or library.
  • On Sidechair: title, shorttitle, overlay, format, precision and the three max_*_count limits take effect. A different timeframe argument gives the warning "This script asks for another timeframe; it runs on the chart's." Use request.security for another timeframe's data.

Example

Pine ScriptA pane indicator with set precisionOpen in editor
//@version=6
indicator("Volume ratio", shorttitle = "VR", precision = 2)
ratio = volume / ta.sma(volume, 20)
plot(ratio, "Ratio", color = ratio > 1 ? color.green : color.gray, style = plot.style_columns)
hline(1)

See also

Runs on Sidechair