3.3.6Closing all open trades or pending orders on the whole account

The following tradingAction types close all the open trades and/or pending orders across the whole account. Like position actions, they save your code having to scan the Framework.Orders list and build its own list of individual trading requests. With some types of account/back-end trading platform the framework may be able to use a more optimised trading request than closing each order/trade individually.

For example, the following request completely flattens your entire account - closes all open trades and deletes all pending orders:

Framework.SendOrder({

tradingAction: FXB.OrderTypes.FLATTEN

}, function (MsgResult) {

});

All the following tradingAction types require no other properties in the request, because they simply operate across the whole account:

FXB.OrderTypes.

Description

FLATTEN

Closes all open trades and pending orders on all markets

FLATTENTRADES

Closes all open trades on all markets, but not pending orders

FLATTENPENDING

Deletes all pending orders on all markets, but not open trades

FLATTENWINNERS

Closes all profitable open trades on all markets (netProfit > 0)

FLATTENLOSERS

Closes all loss-making open trades on all markets (netProfit < 0)

FLATTENLONG

Closes all long trades and pending orders on all markets

FLATTENSHORT

Closes all short trades and pending orders on all markets