3.8.4Settings for displaying trading charts

Note: this section - the options which can be set when displaying a trading chart - may be extended in future versions of the platform. Some of the functionality described in this section requires version 3 of the framework or higher.

A call to CreateDialog() or CreateSubWidget() to display a trading chart can optionally include a settings:{} block which configures the chart. For example:

Framework.CreateSubWidget({

domTarget: "ChartContainer", // Either the HTML element, or its id attribute

type: "chart",

context: {instrumentId: "GBP/USD", timeframe: 3600},

settings: {

// Filled, area-style chart

initialPriceStyle: "mountain",

// Hide the timeframe selector, making it unchangeable

hideTimeframe: true,

// Load MACD and RSI indicators onto the chart

loadIndicators: [

{indicator: "MACD", indicatorSettings: {fast: 10, slow: 11, signal: 12}},

{indicator: "RSI"} // Use default period (14 bars)

],

// Add a horizontal line at 1.35

loadDrawings: [{

type: "horizontalLine",

points: [{value: 1.35}],

text: "Support/resistance level",

style: {line: {color: "red"}}

}]

}

});

The settings:{} block can do several things:

Change the initial visual styles and options

Add indicators to the chart

Add drawings to the chart

Add event markers to the chart

Add bar highlights to the chart

Populate the chart's deal ticket