OpenNewChart

Description

The OpenNewChart method creates and opens a new chart with the specified symbol and timeframe.

Syntax

public OpenNewChart(symbol: string, timeframe: number): number

Parameters

  • symbol: A string representing the trading symbol (e.g., "EURUSD")

  • timeframe: The chart timeframe period

Return Value

Returns a number representing the ID of the newly created chart. Returns -1 if the operation fails.

Example

const newChartId = this.api.OpenNewChart('EURUSD', 60) // 60 minute timeframe
if (newChartId !== -1) {
    console.log(`New chart opened with ID: ${newChartId}`)
} else {
    console.log('Failed to open new chart')
}

Last updated