3.5.10.1Opening the dealticket or trading-action dialogs

You can open either the dealticket or trading-action window, with no pre-population, using very simple calls to Framework.CreateDialog(). For example:

Framework.CreateDialog({type: "dealticket"});

Framework.CreateDialog({type: "trading-action"});

In both cases, CreateDialog() can have an asynchronous callback function which receives an update when the dialog is created, and a final result when the dialog closes itself. For example:

Framework.CreateDialog({type: "dealticket"}, function (Msg) {

if (Msg.result) {

// Final result of the dialog, which is now closed

} else {

// Initial update, providing the ID of the dialog

}

});

Both dialogs can be pre-populated with the following optional settings:

Property

Description

instrumentId

Initial instrument to set in the dialog

orderDefinition

A complete order definition to pre-populate into the dialog. The possible properties of orderDefinition are simply the same as passing a request to SendOrder(). If both are present, orderDefinition takes precedence over instrumentId. You can pass a wider range of orderDefinition values into the trading-action than into the dealticket. The dealticket can only pre-populate with an instruction to open a new trade or order, whereas the trading-action can pre-populate with anything which can be passed to SendOrder().

handleExecution

Defaults to true. If set to false, the dialog returns an orderDefinition to you, in its result, rather than executing the trading action itself.

message

A brief message to display at the top of the dialog

For example:

// Display a suggested trade, with an accompanying message, and get the

// user's selection back from the dealticket rather than having the order

// executed by the dealticket

Framework.CreateDialog({

type: "dealticket",

settings: {

orderDefinition: {

tradingAction: FXB.OrderTypes.SELL,

instrumentId: "AUD/USD",

volume: 30000,

sl: {pips: 20}

},

handleExecution: false,

message: "This is my suggested trade"

}

}, function (Msg) {

if (Msg.result && Msg.result.orderDefinition) {

// Dialog is passing back the user's settings rather than executing them itself

} else {

// Initial update, or cancellation of the dialog

}

});

The dealticket has further settings which can be used to customise it:

Property

Description

allowInstrumentChange

Defaults to true. If false, prevents the user from changing the initial market (which you set using instrumentId or orderDefinition)

noPosition

If true, the dealticket does not display the current-position indicator and the secondary panel for carrying out actions on the whole position. Turning off allowInstrumentChange automatically turns on noPosition, and means that the deal ticket can only be used for placing new orders, not for closing existing orders on the selected market.

fullMode

By default the dealticket selects between its "simple" and "full" modes depending on whether the pre-populated or default order definition can be represented in simple mode. You can force the deal-ticket to open in full mode by setting fullMode:true

noToolsIcon

Can be used to turn off the settings icon in the dealticket, preventing a switch between simple and full mode, and preventing access to saved order templates