3.5.10.2Opening a chart with attached deal ticket

As well as opening the dealticket or trading-action dialogs, you can also open a chart with an attached deal ticket using Framework.ChartDealTicket(). This lets the user see their prospective new order on the chart.

Note: ChartDealTicket() is a simplified wrapper around the more general ability to display a trading chart as a dialog.

ChartDealTicket() accepts an orderDefinition which uses the same format as a request to SendOrder(), so code which prepares a suggested trade can drive either the standard deal ticket or the chart deal ticket interchangeably. For example:

Framework.ChartDealTicket({

disposition: "dialog",

orderDefinition: {

tradingAction: FXB.OrderTypes.SELL,

instrumentId: "AUD/USD",

volume: 30000,

sl: {pips: 20}

},

allowInstrumentChange: false,

timeframe: 86400

}, function (Msg) {

if (Msg.result) {

// Chart has been closed

}

});

The possible parameters for Framework.ChartDealTicket() are as follows:

Property

Description

orderDefinition

A complete order definition to pre-populate into the chart's deal ticket. This is the same definition which is used for the dealticket or trading-action dialogs and for SendOrder().

disposition

Usually "dialog", as in the example above, to create a window where the user must place a trade or cancel the action. However, disposition can also be "floating" to create a window which is designed to remain open, for the user to inspect, while they carry out other activity in the platform.

allowInstrumentChange

Defaults to true, but is most commonly overridden to false so that the user cannot change the instrument specified in the parameters for ChartDealTicket().

timeframe

Initial timeframe for the chart, defaulting to 3600 (H1) if omitted

loadIndicators[]

loadDrawings[]

loadEventMarkers[]

loadBarHighlights[]

Same options as when displaying a trading chart as a dialog (or embedded in an iframe)

ChartDealTicket() is ultimately a wrapper around CreateDialog(), and accepts an optional asynchronous callback in the same way. The callback fires twice: once on creation, providing the ID of the chart, and again when the chart is closed, with Msg.result populated.

The following settings for the dealticket or trading-action dialogs are not available when displaying a chart as a deal ticket: handleExecution, message, noPosition, fullMode, noToolsIcon. You cannot, for example, instruct the chart to send you back the order definition rather than executing the order itself.