Skip to content

Script Object

Script Object represents an instance of indicator script. Script id is determined by its position in the scripts array:

js
// Pane Object
{
    scripts: [
        {…}, // Script #0
        {…}, // Script #1
        {…}, // Script #2
        // ...
    ]
}

Scripts are executed in web-worker (script engine). Each script can create multiple overlays that are automatically placed on specific panes.

script.id

  • Type: number

Sequential script id, calculated by DataHub.

script.uuid

  • Type: string

Unique id that stays the same even if the script changes its position. Generated by DataHub.

script.type

  • Type: string

Script type (name) defines a script that will be used for execution. The library performs a lookup over iScripts in the Scripts component to find a matching script. If not found, the script wont be executed.

script.props

  • Type: object

Script props. Default values defined by the script:

js
[INDICATOR name=RSI, version=1.0.0]

prop('length', { type: 'integer', def: 14 })
prop('color', { type: 'color', def: '#3399ff' })
prop('prec', { type: 'integer', def: 2 })
prop('zIndex', { type: 'integer', def: 0 })

You can overwrite these values by setting script.props fields:

js
// Script object
{
    type: 'RSI',
    props: {
        length: 28,
        zIndex: 1
    }
}

script.settings

  • Type: object

Various script settings.

script.settings.execOrder

  • Type: number
  • Default 1

An order in which scripts are executed. This number represents a position in the execution list.

Released under the MIT License.