Skip to main content

instrument

Syntax Format

instrument(name, overlay)

Overview

This instrument function declares the basic parameters of the indicator, such as a name and a position on the chart. The function should be called only once at the beginning of the script.

Parameters

ParameterTypePurpose
name

string

Name of the instrument (indicator). It is considered best practice to give an instrument a logically coherent name, which corresponds to its purpose. The full name is used in the indicator’s settings
overlay

boolean

Position of the indicator regarding the chart. 

  • If true – the indicator is an overlay for the asset chart. 
  • If false – the indicator has its separate chart below the asset chart (i.e., Volume Oscillator)
Also, you can use additional parameters:
description

string

Description of the indicator and its position below the chart, in case you chose the String format. If the value is boolean, then the indicator will overlay on the chart.
icon_or_overlay

string or boolean

Icon of the indicator and its position below the chart, in case you chose the String format. If the value is boolean, then the indicator will overlay on the chart.

Example

instrument { name = "Darvas Box", overlay = true }