Skip to main content
Version: latest

IContext

Interface

PineJS execution context.

Properties

symbol

Symbol Instrument

Type

ISymbolInstrument

Methods

is_main_symbol

Checks if symbol is the main symbol

Signature

is_main_symbol(symbol: ISymbolInstrument) => boolean

Parameters

NameTypeDescription
symbolISymbolInstrumentsymbol to check

Returns

true if symbol is the main symbol

boolean


new_ctx

Creates a new context

Signature

new_ctx() => IContext

Returns

IContext


new_sym

Load a new symbol for the custom indicator

Signature

new_sym(tickerid: string, period: string, currencyCode?: string, unitId?: string, subsessionId?: string) => ISymbolInstrument

Parameters

NameTypeDescription
tickeridstringSymbol identifier
periodstringperiod for the new symbol
currencyCode?stringCurrency code
unitId?stringUnit ID
subsessionId?stringSubsession ID

Returns

ISymbolInstrument


new_unlimited_var

Creates an in-memory temporary storage with unlimited depth.

Signature

new_unlimited_var(value?: number) => IPineSeries

Parameters

NameTypeDescription
value?numbervariable's value

Returns

IPineSeries


new_var

Creates an in-memory temporary storage with depth defined by the first call new_var(value).get(n)

Signature

new_var(value?: number) => IPineSeries

Parameters

NameTypeDescription
value?numbervariable's value

Returns

IPineSeries


select_sym

Switch context to the other symbol received through IContext.new_sym

Signature

select_sym(i: number) => void

Parameters

NameTypeDescription
inumberthe index of the symbol (0 for the main series)

Returns

void