IChartWidgetApi
Integration guide ยท Reference index
Runtime facade. Entries identify whether the current source exposes each member. Optional provider-dependent methods still require their configured capability.
Commands and events for one chart in the widget. Get it from widget.activeChart() or widget.chart(index) after onChartReady.
automationAvailable
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
automationAvailable(): boolean;Whether the optional automation asset has been installed in this chart's iframe.
openAutomation
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
openAutomation(options?: OpenChartAutomationOptions): Promise<ChartAutomation>;Opens an automation session for this chart: loads the optional automation asset when needed, installs the requested native command families and wires exact-chart PNG capture. Close the session when done; removing the chart closes it.
| Parameter | Type | Required |
|---|---|---|
options | OpenChartAutomationOptions | No |
createDrawingDocument
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
createDrawingDocument(binding: ChartBinding): ChartDrawingDocumentApi;Native persistence remains available without the automation add-on.
| Parameter | Type | Required |
|---|---|---|
binding | ChartBinding | Yes |
createStudyDocument
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
createStudyDocument(binding: ChartBinding, options: { chartId: string; documentId: string; revision: number }): ChartStudyDocumentApi;Creates a study-document owner bound to this chart that exports, restores and commits the chart's studies and pane layout as a versioned document identified by chartId, documentId and revision. You own its lifetime; it is destroyed when the chart is removed, and creating one on a removed chart throws.
| Parameter | Type | Required |
|---|---|---|
binding | ChartBinding | Yes |
options | { chartId: string; documentId: string; revision: number } | Yes |
footprintStatus
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
footprintStatus(): FootprintStatus;Beta. Status of the volume footprint data for this chart.
onFootprintStatusChanged
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
onFootprintStatusChanged(): ISubscription<(status: FootprintStatus) => void>;Beta. Fires when the volume footprint status changes.
onDataChanged
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
onDataChanged(): ISubscription<() => void>;Committed main-series data changes, including realtime updates.
onRemoved
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
onRemoved(listener: () => void): () => void;Fires once on chart removal; returns an unsubscribe function.
| Parameter | Type | Required |
|---|---|---|
listener | () => void | Yes |
readLoadedBars
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
readLoadedBars(input: { from: number; to: number; limit?: number }): {
bars: Array<{ time: number; open: number; high: number; low: number; close: number; volume?: number }>;
coverage: { from: number | null; to: number | null; complete: boolean };
};Bounded raw loaded candles. All times are UTC epoch milliseconds. No add-on required.
| Parameter | Type | Required |
|---|---|---|
input | { from: number; to: number; limit?: number } | Yes |
onDataLoaded
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
onDataLoaded(): ISubscription<() => void>;Returns a subscription that fires each time the main series finishes loading without an error.
dataStatus
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
dataStatus(): ChartDataStatus;Whether the main series has data to show, with a plain-language reason when loading failed.
Hosts that disable the series_data_error_overlay feature use this to present data errors themselves.
onDataStatusChanged
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
onDataStatusChanged(): ISubscription<(status: ChartDataStatus) => void>;Returns a subscription that fires with the new dataStatus() value whenever its state or message changes.
datafeedStatus
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
datafeedStatus(): ChartDatafeedConnectionStatus;Realtime connection state of this chart's datafeed. idle until a datafeed session starts.
Hosts can show a short "Reconnecting" notice for reconnecting and clear it on live.
onDatafeedStatusChanged
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
onDatafeedStatusChanged(): ISubscription<(status: ChartDatafeedConnectionStatus) => void>;Returns a subscription that fires with the new datafeed connection status whenever its state or retry attempt changes.
onSymbolChanged
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
onSymbolChanged(): ISubscription<() => void>;Returns a subscription that fires, with no arguments, whenever the chart's symbol changes.
onIntervalChanged
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
onIntervalChanged(): ISubscription<
(
interval: ResolutionString,
timeFrameParameters: {
timeframe?: TimeFrameValue;
},
) => void
>;Returns a subscription that fires with the new resolution whenever the chart's interval changes. The second argument's timeframe is always undefined.
onVisibleRangeChanged
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
onVisibleRangeChanged(): ISubscription<(range: VisibleTimeRange) => void>;Returns a subscription that fires with the new visible time range whenever the chart scrolls or zooms.
onChartTypeChanged
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
onChartTypeChanged(): ISubscription<(chartType: SeriesType) => void>;Returns a subscription that fires with the new series type whenever the chart type changes.
dataReady
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
dataReady(callback?: () => void): boolean;Returns true when the main series is neither loading nor in error. If callback is given, calls it immediately when ready, otherwise after the current load completes.
| Parameter | Type | Required |
|---|---|---|
callback | () => void | No |
crossHairMoved
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
crossHairMoved(): ISubscription<(params: CrossHairMovedEventParams) => void>;Returns a subscription that fires with the crosshair position each time the user moves it over the chart; programmatic moves from setExternalCrosshair do not fire it.
setExternalCrosshair
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
setExternalCrosshair(point: { time: number; price: number } | null): void;Position the chart crosshair at a time and price, or clear a previously positioned crosshair.
point: The time and price to focus, or null to clear the crosshair.
| Parameter | Type | Required |
|---|---|---|
point | { time: number; price: number } | null | Yes |
Failure conditions: Crosshair point must contain finite time and price values.
onHoveredSourceChanged
Compatibility declaration only. This member is not exposed by the current source facade. Do not rely on it in this release.
onHoveredSourceChanged(): ISubscription<(sourceId: EntityId) => void>;Use the type signature above and the integration guide for the owning capability.
setVisibleRange
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
setVisibleRange(
range: SetVisibleTimeRange,
options?: SetVisibleRangeOptions,
): Promise<void>;Scrolls and zooms the time scale to show the given range and resolves once it is applied. percentRightMargin adds empty space on the right, and loadedOnly keeps the range within loaded bars without requesting more history.
| Parameter | Type | Required |
|---|---|---|
range | SetVisibleTimeRange | Yes |
options | SetVisibleRangeOptions | No |
setSymbol
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
setSymbol(symbol: string, options?: SetSymbolOptions | (() => void)): void;Changes the chart's symbol and activates the chart unless doNotActivateChart is set. A callback runs after the new data finishes loading, or on the next microtask when the symbol is unchanged.
| Parameter | Type | Required |
|---|---|---|
symbol | string | Yes |
options | SetSymbolOptions | (() => void) | No |
setResolution
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
setResolution(
resolution: ResolutionString,
options?: SetResolutionOptions | (() => void),
): Promise<boolean>;Changes the chart's interval, or every chart's interval when the interval lock is on, and activates the chart unless doNotActivateChart is set. Resolves true immediately for an unsupported or unchanged resolution, otherwise whether any chart changed; dataReady runs after the main series finishes loading.
| Parameter | Type | Required |
|---|---|---|
resolution | ResolutionString | Yes |
options | SetResolutionOptions | (() => void) | No |
setChartType
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
setChartType(type: SeriesType, callback?: () => void): void;Changes the main series style and calls callback after the series data finishes loading. Throws for an unsupported style, and for volume footprint unless the chart_style_volume_footprint feature is enabled.
| Parameter | Type | Required |
|---|---|---|
type | SeriesType | Yes |
callback | () => void | No |
Failure conditions: Volume footprint requires the chart_style_volume_footprint feature.
resetCache
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
resetCache(): void;Reset cached bar data for this chart's active datafeed session.
resetData
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
resetData(): void;Purges the cached history for this chart and reloads it from the datafeed, keeping the visible range.
executeActionById
Compatibility declaration only. This member is not exposed by the current source facade. Do not rely on it in this release.
executeActionById(actionId: ChartActionId): void;Use the type signature above and the integration guide for the owning capability.
| Parameter | Type | Required |
|---|---|---|
actionId | ChartActionId | Yes |
getCheckableActionState
Compatibility declaration only. This member is not exposed by the current source facade. Do not rely on it in this release.
getCheckableActionState(actionId: ChartActionId): boolean;Use the type signature above and the integration guide for the owning capability.
| Parameter | Type | Required |
|---|---|---|
actionId | ChartActionId | Yes |
refreshMarks
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
refreshMarks(): void;Discards the loaded bar and timescale marks and requests them again from the datafeed for the current range.
clearMarks
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
clearMarks(marksToClear?: ClearMarksMode): void;Removes bar marks, timescale marks or both (the default) without requesting them again for the current range. Throws a RangeError for an unknown mode.
| Parameter | Type | Required |
|---|---|---|
marksToClear | ClearMarksMode | No |
getAllShapes
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
getAllShapes(): EntityInfo[];Returns the id and name of every drawing on the chart.
getAllStudies
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
getAllStudies(): EntityInfo[];Returns the id and name of every study on the chart.
getPriceToBarRatio
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
getPriceToBarRatio(): number | null;Returns the current price-to-bar ratio of the main price scale, or null when it cannot be computed.
setPriceToBarRatio
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
setPriceToBarRatio(ratio: number, options?: UndoOptions): void;Sets the price-to-bar ratio of the main price scale, recording an Undo step unless disableUndo is set.
| Parameter | Type | Required |
|---|---|---|
ratio | number | Yes |
options | UndoOptions | No |
isPriceToBarRatioLocked
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
isPriceToBarRatioLocked(): boolean;Returns whether the main price scale's price-to-bar ratio is locked.
setPriceToBarRatioLocked
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
setPriceToBarRatioLocked(value: boolean, options?: UndoOptions): void;Locks or unlocks the price-to-bar ratio, recording an Undo step unless disableUndo is set. Locking switches the price scale to regular mode and keeps the current ratio.
| Parameter | Type | Required |
|---|---|---|
value | boolean | Yes |
options | UndoOptions | No |
getAllPanesHeight
Compatibility declaration only. This member is not exposed by the current source facade. Do not rely on it in this release.
getAllPanesHeight(): number[];Use the type signature above and the integration guide for the owning capability.
setAllPanesHeight
Compatibility declaration only. This member is not exposed by the current source facade. Do not rely on it in this release.
setAllPanesHeight(heights: readonly number[]): void;Use the type signature above and the integration guide for the owning capability.
| Parameter | Type | Required |
|---|---|---|
heights | readonly number[] | Yes |
maximizeChart
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
maximizeChart(): void;Activates this chart and maximizes it within a multi-chart layout; has no effect when the chart is not visible in the layout.
isMaximized
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
isMaximized(): boolean;Returns whether this chart is currently maximized in the layout.
restoreChart
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
restoreChart(): void;Restores the layout from a maximized chart so all charts are shown again.
availableZOrderOperations
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
availableZOrderOperations(
sources: readonly EntityId[],
): AvailableZOrderOperations;Returns which z-order operations can be applied to the given drawings, with every operation disabled when none apply.
| Parameter | Type | Required |
|---|---|---|
sources | readonly EntityId[] | Yes |
sendToBack
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
sendToBack(entities: readonly EntityId[]): void;Moves the given drawings beneath all other drawings.
| Parameter | Type | Required |
|---|---|---|
entities | readonly EntityId[] | Yes |
bringToFront
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
bringToFront(sources: readonly EntityId[]): void;Moves the given drawings above all other drawings.
| Parameter | Type | Required |
|---|---|---|
sources | readonly EntityId[] | Yes |
bringForward
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
bringForward(sources: readonly EntityId[]): void;Moves the given drawings one step up in the drawing order.
| Parameter | Type | Required |
|---|---|---|
sources | readonly EntityId[] | Yes |
sendBackward
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
sendBackward(sources: readonly EntityId[]): void;Moves the given drawings one step down in the drawing order.
| Parameter | Type | Required |
|---|---|---|
sources | readonly EntityId[] | Yes |
createStudy
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
createStudy<TOverrides extends Partial<SingleIndicatorOverrides>>(
name: string,
forceOverlay?: boolean,
lock?: boolean,
inputs?: Record<string, StudyInputValue>,
overrides?: TOverrides,
options?: CreateStudyOptions,
): Promise<EntityId | null>;Adds the built-in study whose display name matches name (case-insensitive), merged with saved defaults, and resolves to its entity id or null when it could not be added. Throws when no study has that name; with checkLimit, resolves null once the study limit is reached.
| Parameter | Type | Required |
|---|---|---|
name | string | Yes |
forceOverlay | boolean | No |
lock | boolean | No |
inputs | Record<string, StudyInputValue> | No |
overrides | TOverrides | No |
options | CreateStudyOptions | No |
Failure conditions: Study '${studyName}' is unavailable.
compilePineScript
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
compilePineScript(
source: string,
options?: PineScriptRunOptions,
): Promise<PineScriptCompileResult>;Compiles Pine Script source against the chart's current bars without adding a study and resolves with the compile result. Rejects unless Pine Script is enabled in the pine_script widget option.
| Parameter | Type | Required |
|---|---|---|
source | string | Yes |
options | PineScriptRunOptions | No |
createPineStudy
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
createPineStudy(
source: string,
options?: PineScriptStudyOptions,
): Promise<EntityId | null>;Compiles the source and adds it to the chart as a Pine study, resolving to its entity id or null when it could not be added. Rejects on compile errors or when Pine Script is disabled.
| Parameter | Type | Required |
|---|---|---|
source | string | Yes |
options | PineScriptStudyOptions | No |
updatePineStudy
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
updatePineStudy(
entityId: EntityId,
source: string,
options?: PineScriptStudyOptions,
): Promise<void>;Recompiles an existing Pine study with new source, carrying over compatible inputs and overrides. Rejects when the entity is missing or not a Pine study, on compile errors, or when a newer update supersedes this one.
| Parameter | Type | Required |
|---|---|---|
entityId | EntityId | Yes |
source | string | Yes |
options | PineScriptStudyOptions | No |
getPineStudy
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
getPineStudy(entityId: EntityId): PineScriptStudyState | null;Returns a copy of a Pine study's descriptor, inputs, overrides, pane, status, error and alert conditions, or null when the entity is not a Pine study.
| Parameter | Type | Required |
|---|---|---|
entityId | EntityId | Yes |
createPineAlertRule
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
createPineAlertRule(input: PineAlertRuleInput): PineAlertRule;Creates an alert rule on one of a Pine study's alert conditions and returns it with its generated id. Throws when Pine alerts are disabled (pine_script.alerts) or the study does not declare that condition.
| Parameter | Type | Required |
|---|---|---|
input | PineAlertRuleInput | Yes |
Failure conditions: Pine alerts are unavailable.
updatePineAlertRule
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
updatePineAlertRule(
id: string,
patch: Partial<PineAlertRuleInput>,
): PineAlertRule;Applies patch to an existing Pine alert rule and returns the updated rule. Throws when alerts are disabled, the rule does not exist, or the target condition is missing.
| Parameter | Type | Required |
|---|---|---|
id | string | Yes |
patch | Partial<PineAlertRuleInput> | Yes |
Failure conditions: Pine alerts are unavailable.
removePineAlertRule
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
removePineAlertRule(id: string): boolean;Removes a Pine alert rule and returns whether one was removed. Throws when Pine alerts are disabled.
| Parameter | Type | Required |
|---|---|---|
id | string | Yes |
getPineAlertRules
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
getPineAlertRules(): PineAlertRule[];Returns copies of all Pine alert rules on this chart.
getPineAlertHistory
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
getPineAlertHistory(): PineAlertEvent[];Returns copies of the Pine alert events fired so far, keeping at most pine_script.max_alert_events (500 by default).
subscribePineAlertEvents
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
subscribePineAlertEvents(
listener: (event: PineAlertEvent) => void,
): () => void;Calls listener with each Pine alert event as it fires and returns a function that unsubscribes. Throws a TypeError when listener is not a function.
| Parameter | Type | Required |
|---|---|---|
listener | (event: PineAlertEvent) => void | Yes |
Failure conditions: Pine alert listener must be a function.
getPineStrategyReport
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
getPineStrategyReport(studyId: EntityId): PineStrategyReport | null;Returns a frozen copy of a Pine strategy's latest backtest report, or null before one is available. Throws when the study does not exist, is not a Pine study, or is not a strategy.
| Parameter | Type | Required |
|---|---|---|
studyId | EntityId | Yes |
Failure conditions: Pine strategies are unavailable.
getPineStudyObject
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
getPineStudyObject(
studyId: EntityId,
objectId: string,
): PineStudyObjectSnapshot | null;Returns a frozen snapshot of one drawing object (such as a line, label or box) produced by a Pine study, or null when the study has no object with that id. Throws when the entity is not a Pine study.
| Parameter | Type | Required |
|---|---|---|
studyId | EntityId | Yes |
objectId | string | Yes |
Failure conditions: Pine object inspection is unavailable.
getPineStudyObjects
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
getPineStudyObjects(studyId: EntityId): readonly PineStudyObjectSnapshot[];Returns frozen snapshots of all drawing objects the Pine study produced in its latest run. Throws when the entity is missing or is not a Pine study.
| Parameter | Type | Required |
|---|---|---|
studyId | EntityId | Yes |
Failure conditions: Pine object inspection is unavailable.
listPineWorkspaceDocuments
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
listPineWorkspaceDocuments(
request?: PineWorkspaceListRequest,
options?: PineScriptRunOptions,
): Promise<PineWorkspacePage>;Lists one page of Pine documents from the configured pine_script.workspace_provider, up to 50 per page by default. Rejects when no workspace provider is configured or the provider returns an invalid page; pass options.signal to abort.
| Parameter | Type | Required |
|---|---|---|
request | PineWorkspaceListRequest | No |
options | PineScriptRunOptions | No |
loadPineWorkspaceDocument
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
loadPineWorkspaceDocument(
id: string,
options?: PineScriptRunOptions,
): Promise<PineWorkspaceDocument>;Loads a Pine document, including its source, from the configured workspace provider. Rejects when no provider is configured, the id is empty, or the provider returns a different document.
| Parameter | Type | Required |
|---|---|---|
id | string | Yes |
options | PineScriptRunOptions | No |
createPineWorkspaceDocument
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
createPineWorkspaceDocument(
request: PineWorkspaceCreateRequest,
options?: PineScriptRunOptions,
): Promise<PineWorkspaceDocument>;Creates a Pine document through the configured workspace provider and resolves with the stored document. Rejects when no provider is configured or the source is empty or larger than 256 KB.
| Parameter | Type | Required |
|---|---|---|
request | PineWorkspaceCreateRequest | Yes |
options | PineScriptRunOptions | No |
updatePineWorkspaceDocument
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
updatePineWorkspaceDocument(
request: PineWorkspaceUpdateRequest,
options?: PineScriptRunOptions,
): Promise<PineWorkspaceDocument>;Saves new source to an existing Pine document through the configured workspace provider and resolves with the updated document. The request must include expectedRevision, which the provider can use to reject conflicting writes.
| Parameter | Type | Required |
|---|---|---|
request | PineWorkspaceUpdateRequest | Yes |
options | PineScriptRunOptions | No |
deletePineWorkspaceDocument
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
deletePineWorkspaceDocument(
id: string,
expectedRevision: string,
options?: PineScriptRunOptions,
): Promise<void>;Deletes a Pine document through the configured workspace provider, passing expectedRevision so the provider can refuse a stale delete. Rejects when no provider is configured or either argument is empty.
| Parameter | Type | Required |
|---|---|---|
id | string | Yes |
expectedRevision | string | Yes |
options | PineScriptRunOptions | No |
listPineWorkspaceRevisions
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
listPineWorkspaceRevisions(
request: PineWorkspaceRevisionListRequest,
options?: PineScriptRunOptions,
): Promise<PineWorkspaceRevisionPage>;Lists one page of saved revisions for a Pine document, up to 50 per page by default. Rejects when no workspace provider is configured or the provider does not support revision history.
| Parameter | Type | Required |
|---|---|---|
request | PineWorkspaceRevisionListRequest | Yes |
options | PineScriptRunOptions | No |
loadPineWorkspaceRevision
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
loadPineWorkspaceRevision(
id: string,
revision: string,
options?: PineScriptRunOptions,
): Promise<PineWorkspaceRevision>;Loads the source of one saved revision of a Pine document. Rejects when no workspace provider is configured, the provider has no revision history, or it returns a different revision.
| Parameter | Type | Required |
|---|---|---|
id | string | Yes |
revision | string | Yes |
options | PineScriptRunOptions | No |
linkPineStudyToWorkspace
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
linkPineStudyToWorkspace(
studyId: EntityId,
document: { id: string; revision: string },
): void;Records on a Pine study which workspace document and revision its source came from, so the link is saved with the chart. Throws when the entity is not a Pine study.
| Parameter | Type | Required |
|---|---|---|
studyId | EntityId | Yes |
document | { id: string; revision: string } | Yes |
Failure conditions: Pine workspace is unavailable.
publishPineStudy
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
publishPineStudy(
studyId: EntityId,
identity: PinePublicationIdentity & {
visibility: "private" | "unlisted" | "public";
},
options?: PineScriptRunOptions,
): Promise<PinePublication>;Compiles the Pine study's current source and publishes it through the configured pine_script.publication_provider, then records the publication on the study. Rejects when the declared script kind differs from identity.kind, no provider is configured, or the provider's result does not match the request.
| Parameter | Type | Required |
|---|---|---|
studyId | EntityId | Yes |
identity | PinePublicationIdentity & { visibility: "private" | "unlisted" | "public"; } | Yes |
options | PineScriptRunOptions | No |
setPineAlertDeliveryChannel
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
setPineAlertDeliveryChannel(ruleId: string, channelId: string | null): void;Routes future events of a Pine alert rule to a delivery channel, or stops delivery for that rule when channelId is null or blank. Delivery happens only when pine_script.alert_delivery_provider is configured.
| Parameter | Type | Required |
|---|---|---|
ruleId | string | Yes |
channelId | string | null | Yes |
Failure conditions: Pine alert delivery is unavailable.
getPineAlertDeliveryStatuses
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
getPineAlertDeliveryStatuses(): readonly PineAlertDeliveryStatus[];Returns frozen snapshots of Pine alert deliveries attempted by this chart, each in the pending, delivered, failed or cancelled state. Returns an empty array when nothing has been delivered.
getPineObjectOverrides
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
getPineObjectOverrides(
studyId: EntityId,
): readonly PineObjectOverrideSnapshot[];Returns the user edits currently stored on a Pine study's drawing objects. Throws when the entity is not a Pine study.
| Parameter | Type | Required |
|---|---|---|
studyId | EntityId | Yes |
Failure conditions: Pine object interaction is unavailable.
updatePineObjectOverride
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
updatePineObjectOverride(
studyId: EntityId,
objectId: string,
patch: PineObjectOverridePatch,
): PineObjectOverrideSnapshot;Validates and merges a patch into the stored override for one Pine drawing object, saves it on the study with undo support, and returns the resulting override. Throws when pine_script.object_interaction is disabled, the object no longer exists, the object is locked, or the override limit is exceeded.
| Parameter | Type | Required |
|---|---|---|
studyId | EntityId | Yes |
objectId | string | Yes |
patch | PineObjectOverridePatch | Yes |
Failure conditions: Pine object interaction is unavailable.
resetPineObjectOverride
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
resetPineObjectOverride(
studyId: EntityId,
objectId: string,
paths?: readonly PineObjectOverridePath[],
): void;Removes the given override paths from a Pine drawing object, or its whole override when paths is omitted; does nothing if the object has no override. Throws when object interaction is disabled or the object is locked and paths does not include locked.
| Parameter | Type | Required |
|---|---|---|
studyId | EntityId | Yes |
objectId | string | Yes |
paths | readonly PineObjectOverridePath[] | No |
Failure conditions: Pine object interaction is unavailable.
subscribePineStrategyReport
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
subscribePineStrategyReport(
studyId: EntityId,
listener: (change: PineStrategyReportChange) => void,
): () => void;Calls the listener with a frozen strategy report each time the Pine strategy produces a new one, and returns an unsubscribe function. Throws when the study is not a Pine strategy; returns a no-op unsubscribe when the chart has no Pine support.
| Parameter | Type | Required |
|---|---|---|
studyId | EntityId | Yes |
listener | (change: PineStrategyReportChange) => void | Yes |
Failure conditions: Pine strategy listener must be a function.
subscribePineStudyObjects
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
subscribePineStudyObjects(
studyId: EntityId,
listener: (change: PineStudyObjectChange) => void,
): () => void;Calls the listener with frozen snapshots whenever a Pine study's drawing objects change, and returns an unsubscribe function. Throws when the entity is not a Pine study or the listener is not a function.
| Parameter | Type | Required |
|---|---|---|
studyId | EntityId | Yes |
listener | (change: PineStudyObjectChange) => void | Yes |
Failure conditions: Pine object listener must be a function.
subscribePineAlertDeliveryStatuses
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
subscribePineAlertDeliveryStatuses(
listener: (status: PineAlertDeliveryStatus) => void,
): () => void;Calls the listener with a frozen status each time a Pine alert delivery changes state, and returns an unsubscribe function. Throws when the listener is not a function.
| Parameter | Type | Required |
|---|---|---|
listener | (status: PineAlertDeliveryStatus) => void | Yes |
Failure conditions: Pine alert delivery listener must be a function.
subscribePineObjectOverrides
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
subscribePineObjectOverrides(
studyId: EntityId,
listener: (change: PineObjectOverrideChange) => void,
): () => void;Calls the listener whenever the stored overrides on a Pine study's drawing objects change, and returns an unsubscribe function. Throws when the entity is not a Pine study or the listener is not a function.
| Parameter | Type | Required |
|---|---|---|
studyId | EntityId | Yes |
listener | (change: PineObjectOverrideChange) => void | Yes |
Failure conditions: Pine object override listener must be a function.
subscribePineStudyMigrations
Capability-dependent. Requires the matching optional feature/provider and valid chart binding.
subscribePineStudyMigrations(
listener: (studyId: EntityId, report: PineStudyMigrationReport) => void,
): () => void;Calls the listener with a report when a Pine study's source changes and its inputs, style overrides and alert rules are carried over to the new script, listing what was kept, reset or removed. Returns an unsubscribe function.
| Parameter | Type | Required |
|---|---|---|
listener | (studyId: EntityId, report: PineStudyMigrationReport) => void | Yes |
Failure conditions: Pine migration listener must be a function.
getStudyById
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
getStudyById(entityId: EntityId): IStudyApi;Returns an API object for reading and changing an existing study, including its inputs, styles, visibility, z-order and pane placement. Throws when no study has that id.
| Parameter | Type | Required |
|---|---|---|
entityId | EntityId | Yes |
Failure conditions: There is no such study.
getSeries
Compatibility declaration only. This member is not exposed by the current source facade. Do not rely on it in this release.
getSeries(): ISeriesApi;Use the type signature above and the integration guide for the owning capability.
createShape
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
createShape<TOverrides extends object>(
point: ShapePoint,
options: CreateShapeOptions<TOverrides>,
): EntityId | null;Creates a single-point drawing of the type named in options.shape and returns its id, or null when the chart did not create it. Throws when the point or options fail validation.
| Parameter | Type | Required |
|---|---|---|
point | ShapePoint | Yes |
options | CreateShapeOptions<TOverrides> | Yes |
createMultipointShape
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
createMultipointShape<TOverrides extends object>(
points: ShapePoint[],
options: CreateMultipointShapeOptions<TOverrides>,
): EntityId | null;Creates a drawing from several points, using the tool named in options.shape, and returns its id, or null when the chart did not create it. Throws when the points do not fit the tool or fail validation.
| Parameter | Type | Required |
|---|---|---|
points | ShapePoint[] | Yes |
options | CreateMultipointShapeOptions<TOverrides> | Yes |
createAnchoredShape
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
createAnchoredShape<TOverrides extends object>(
position: PositionPercents,
options: CreateAnchoredShapeOptions<TOverrides>,
): EntityId | null;Creates a drawing positioned by a percentage of the pane rather than by time and price, and returns its id or null. Behaves like createShape with the anchored flag set.
| Parameter | Type | Required |
|---|---|---|
position | PositionPercents | Yes |
options | CreateAnchoredShapeOptions<TOverrides> | Yes |
getShapeById
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
getShapeById(entityId: EntityId): ILineDataSourceApi;Returns an API object for reading and editing the drawing with the given id, such as its points and properties.
| Parameter | Type | Required |
|---|---|---|
entityId | EntityId | Yes |
removeEntity
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
removeEntity(entityId: EntityId, options?: UndoOptions): void;Removes the drawing or study with the given id. Logs a warning when no drawing or study has that id.
| Parameter | Type | Required |
|---|---|---|
entityId | EntityId | Yes |
options | UndoOptions | No |
removeAllShapes
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
removeAllShapes(): void;Removes every drawing from the chart and clears its drawing groups.
removeAllStudies
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
removeAllStudies(): void;Removes every study from the chart, along with drawings attached to those studies, as one undoable step.
selection
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
selection(): ISelectionApi;Returns an API object for reading and changing which drawings and studies are selected, and for subscribing to selection changes.
showPropertiesDialog
Compatibility declaration only. This member is not exposed by the current source facade. Do not rely on it in this release.
showPropertiesDialog(studyId: EntityId): void;Use the type signature above and the integration guide for the owning capability.
| Parameter | Type | Required |
|---|---|---|
studyId | EntityId | Yes |
createStudyTemplate
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
createStudyTemplate(options: CreateStudyTemplateOptions): object;Returns a plain-object template of the chart's studies and pane layout, optionally including the symbol (saveSymbol) and interval (saveInterval). Throws when study templates are unavailable.
| Parameter | Type | Required |
|---|---|---|
options | CreateStudyTemplateOptions | Yes |
applyStudyTemplate
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
applyStudyTemplate(template: object): void;Replaces the chart's studies and pane layout with those in a template, switching symbol or interval only when the template includes them; the change is recorded as one undo step. Throws a TypeError when the template is not a plain object.
| Parameter | Type | Required |
|---|---|---|
template | object | Yes |
createOrderLine
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
createOrderLine(options?: UndoOptions): IOrderLineAdapter;Adds an order line at the latest price and returns an adapter for configuring it, with order-line defaults from the trading customization applied. Pass disableUndo: true to keep the creation out of undo history.
| Parameter | Type | Required |
|---|---|---|
options | UndoOptions | No |
Failure conditions: Order lines are not supported by this chart.
createPositionLine
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
createPositionLine(options?: UndoOptions): IPositionLineAdapter;Adds a position line at the latest price and returns an adapter for configuring it, with position-line defaults from the trading customization applied. Pass disableUndo: true to keep the creation out of undo history.
| Parameter | Type | Required |
|---|---|---|
options | UndoOptions | No |
Failure conditions: Position lines are not supported by this chart.
createExecutionShape
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
createExecutionShape(options?: UndoOptions): IExecutionLineAdapter;Adds an execution marker at the latest price and time and returns an adapter for configuring it. Pass disableUndo: true to keep the creation out of undo history.
| Parameter | Type | Required |
|---|---|---|
options | UndoOptions | No |
Failure conditions: Execution shapes are not supported by this chart.
symbol
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
symbol(): string;Returns the chart's current symbol, or an empty string when none is set.
symbolExt
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
symbolExt(): SymbolExt | null;Returns the resolved symbol information for the main series, or null while the symbol has not resolved.
resolution
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
resolution(): ResolutionString;Returns the chart's current resolution.
getVisibleRange
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
getVisibleRange(): VisibleTimeRange;Returns the time range currently visible on the chart; returns { from: 0, to: 0 } before the chart surface is ready.
priceFormatter
Compatibility declaration only. This member is not exposed by the current source facade. Do not rely on it in this release.
priceFormatter(): INumberFormatter;Use the type signature above and the integration guide for the owning capability.
chartType
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
chartType(): SeriesType;Returns the current chart style of the main series.
getTimezoneApi
Compatibility declaration only. This member is not exposed by the current source facade. Do not rely on it in this release.
getTimezoneApi(): ITimezoneApi;Use the type signature above and the integration guide for the owning capability.
getPanes
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
getPanes(): IPaneApi[];Returns an API object for each pane, top to bottom, giving access to its height, price scales and the studies it contains. The first pane holds the main series.
exportData
Compatibility declaration only. This member is not exposed by the current source facade. Do not rely on it in this release.
exportData(options?: Partial<ExportDataOptions>): Promise<ExportedData>;Use the type signature above and the integration guide for the owning capability.
| Parameter | Type | Required |
|---|---|---|
options | Partial<ExportDataOptions> | No |
canZoomOut
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
canZoomOut(): boolean;Returns true when the bar spacing is greater than 3 pixels, so zoomOut can still shrink the bars.
zoomOut
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
zoomOut(): void;Zooms out by dividing the current bar spacing by 1.2.
setZoomEnabled
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
setZoomEnabled(enabled: boolean): void;Enables or disables zooming the chart through user interaction.
| Parameter | Type | Required |
|---|---|---|
enabled | boolean | Yes |
setScrollEnabled
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
setScrollEnabled(enabled: boolean): void;Enables or disables scrolling the chart through user interaction.
| Parameter | Type | Required |
|---|---|---|
enabled | boolean | Yes |
shapesGroupController
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
shapesGroupController(): IShapesGroupControllerApi;Returns an API object for creating, naming, hiding, locking and reordering groups of drawings.
barTimeToEndOfPeriod
Compatibility declaration only. This member is not exposed by the current source facade. Do not rely on it in this release.
barTimeToEndOfPeriod(unixTime: number): number;Use the type signature above and the integration guide for the owning capability.
| Parameter | Type | Required |
|---|---|---|
unixTime | number | Yes |
endOfPeriodToBarTime
Compatibility declaration only. This member is not exposed by the current source facade. Do not rely on it in this release.
endOfPeriodToBarTime(unixTime: number): number;Use the type signature above and the integration guide for the owning capability.
| Parameter | Type | Required |
|---|---|---|
unixTime | number | Yes |
getTimeScale
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
getTimeScale(): ITimeScaleApi;Returns an API object for the chart's time scale, with bar spacing, right offset, width and coordinate-to-time conversion.
isSelectBarRequested
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
isSelectBarRequested(): boolean;Returns true while a requestSelectBar request is waiting for the user to pick a bar.
requestSelectBar
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
requestSelectBar(options?: SelectBarRequestOptions): Promise<number>;Puts the chart into bar-selection mode and resolves with the time of the bar the user clicks. Rejects when a request is already pending, the main series has no data yet, or the selection is cancelled.
| Parameter | Type | Required |
|---|---|---|
options | SelectBarRequestOptions | No |
cancelSelectBar
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
cancelSelectBar(): void;Cancels a pending requestSelectBar request, which rejects its promise. Does nothing when no request is pending.
resetView
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
resetView(): void;Restores the default time viewport and automatic price scale.
loadChartTemplate
Compatibility declaration only. This member is not exposed by the current source facade. Do not rely on it in this release.
loadChartTemplate(templateName: string): Promise<void>;Use the type signature above and the integration guide for the owning capability.
| Parameter | Type | Required |
|---|---|---|
templateName | string | Yes |
marketStatus
Compatibility declaration only. This member is not exposed by the current source facade. Do not rely on it in this release.
marketStatus(): IWatchedValueReadonly<MarketStatus | null>;Use the type signature above and the integration guide for the owning capability.
setTimeFrame
Compatibility declaration only. This member is not exposed by the current source facade. Do not rely on it in this release.
setTimeFrame(timeFrame: RangeOptions): void;Use the type signature above and the integration guide for the owning capability.
| Parameter | Type | Required |
|---|---|---|
timeFrame | RangeOptions | Yes |
getLineToolsState
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
getLineToolsState(): LineToolsAndGroupsState;Returns a serializable snapshot of the chart's drawings and drawing groups for saving to separate drawing storage. Throws when the saveload_separate_drawings_storage feature is disabled.
applyLineToolsState
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
applyLineToolsState(state: LineToolsAndGroupsState): Promise<void>;Replaces the chart's drawings and drawing groups with those in a saved snapshot in one step. Rejects when the saveload_separate_drawings_storage feature is disabled.
| Parameter | Type | Required |
|---|---|---|
state | LineToolsAndGroupsState | Yes |
reloadLineToolsFromServer
Runtime-backed. Use after chart readiness unless this is a readiness or disposal method.
reloadLineToolsFromServer(): void;Re-reads the chart's drawings from separate drawing storage when one is attached; otherwise re-applies the current drawings without recording an undo step.
Related types
- OpenChartAutomationOptions
- ISubscription
- ChartDataStatus
- ChartDatafeedConnectionStatus
- ResolutionString
- TimeFrameValue
- VisibleTimeRange
- SeriesType
- CrossHairMovedEventParams
- EntityId
- SetVisibleTimeRange
- SetVisibleRangeOptions
- SetSymbolOptions
- SetResolutionOptions
- ChartActionId
- ClearMarksMode
- EntityInfo
- UndoOptions
- AvailableZOrderOperations
- SingleIndicatorOverrides
- StudyInputValue
- CreateStudyOptions
- PineScriptRunOptions
- PineScriptCompileResult
- PineScriptStudyOptions
- PineScriptStudyState
- PineAlertRuleInput
- PineAlertRule
- PineAlertEvent
- PineStrategyReport
- PineStudyObjectSnapshot
- PineWorkspaceListRequest
- PineWorkspacePage
- PineWorkspaceDocument
- PineWorkspaceCreateRequest
- PineWorkspaceUpdateRequest
- PineWorkspaceRevisionListRequest
- PineWorkspaceRevisionPage
- PineWorkspaceRevision
- PinePublicationIdentity
- PinePublication
- PineAlertDeliveryStatus
- PineObjectOverrideSnapshot
- PineObjectOverridePatch
- PineObjectOverridePath
- PineStrategyReportChange
- PineStudyObjectChange
- PineObjectOverrideChange
- PineStudyMigrationReport
- IStudyApi
- ISeriesApi
- ShapePoint
- CreateShapeOptions
- CreateMultipointShapeOptions
- PositionPercents
- CreateAnchoredShapeOptions
- ILineDataSourceApi
- ISelectionApi
- CreateStudyTemplateOptions
- IOrderLineAdapter
- IPositionLineAdapter
- IExecutionLineAdapter
- SymbolExt
- INumberFormatter
- ITimezoneApi
- IPaneApi
- ExportDataOptions
- ExportedData
- IShapesGroupControllerApi
- ITimeScaleApi
- SelectBarRequestOptions
- IWatchedValueReadonly
- MarketStatus
- RangeOptions
- LineToolsAndGroupsState