Skip to main content
Version: v27

LibraryPineStudy<TPineStudyResult>

Interface

Type parameters

Name
TPineStudyResult

Indexable

[key: string]: any

Methods

init

Optional

Called only once during the lifetime of the study and designed to get additional info for the study.

Example:

this.init = function(context, inputCallback) {
var symbol = '#EQUITY';
var period = PineJS.Std.period(this._context);
context.new_sym(symbol, period);
};

Signature

init(ctx: IContext, inputs: Function) => void

Parameters

NameTypeDescription
ctxIContextAn object containing symbol info along with some useful methods to load/store symbol
inputs<T>(index: number) => TThe inputs callback is an array of input values, placed in order of inputs in Metainfo.

Returns

void


main

Called every time the library wants to calculate the study. Also it's called for every bar of every symbol. Thus, if you request several additional symbols inside your indicator it will increase the count of runs.

Signature

main(ctx: IContext, inputs: Function) => TPineStudyResult

Parameters

NameTypeDescription
ctxIContextAn object containing symbol info along with some useful methods to load/store symbol
inputs<T>(index: number) => TThe inputs callback is an array of input values, placed in order of inputs in Metainfo.

Returns

TPineStudyResult