3.5.3Selecting a market or timeframe

The framework provides two standard dialogs for selecting a market or timeframe. Note: these functions only give you a final result. You don't get an initial creation message from the dialog which gives you the ability to destroy it. You also can't customise the size or style of these dialogs, or set noCancel on them.

You can ask the user to select a market using Framework.SelectInstrument(). The asynchronous return value is the instrumentId of an FXB.Instrument, or null. For example:

Framework.SelectInstrument(function (instrumentId) {

if (instrumentId) {

var market = Framework.Instruments.get(instrumentId);

} else {

// Cancellation of dialog

}

});

You can ask the user to select a timeframe using Framework.SelectTimeframe(). The asynchronous return value is the numeric chart timeframe, or null. For example:

Framework.SelectTimeframe(function (timeframe) {

if (timeframe) {

} else {

// Cancellation of dialog

}

});