LibraryPineStudy<TPineStudyResult>
Interface
Type parameters
Name |
---|
TPineStudyResult |
Indexable
▪ [key: string
]: any
Methods
init
OptionalCalled 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
Name | Type | Description |
---|---|---|
ctx | IContext | An object containing symbol info along with some useful methods to load/store symbol |
inputs | <T>(index: number) => T | The 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
Name | Type | Description |
---|---|---|
ctx | IContext | An object containing symbol info along with some useful methods to load/store symbol |
inputs | <T>(index: number) => T | The inputs callback is an array of input values, placed in order of inputs in Metainfo. |
Returns
TPineStudyResult