3.3.3Modifying open trades and pending orders

You can modify a pending order or open trade using FXB.OrderTypes.CHANGE as the tradingAction. You must supply the orderId of an open order or trade in the Framework.Orders list. For example:

// Change the stop-loss on order O12345 to 30 pips from the current market price

// (leaving all other settings unchanged)

Framework.SendOrder({

orderId: "O12345",

tradingAction: FXB.OrderTypes.CHANGE,

sl: {pips: 30}

}, function (MsgResult) {

});

The stop-loss (sl) and take-profit (tp) of a trade or order can always be changed. You can alter the openPrice of a pending order but not of an open trade - obviously! Support for trailing stops (trail) is determined by the features of the trading account and its back-end platform. The ability to change the volume of a pending order also depends on the features of the account and back-end platform. A new value for the volume will be ignored if the back-end platform does not support such a change.

When modifying an order or trade, you can use all the same options as when making a new request. For example, you can change an open trade as follows:

Framework.SendOrder({

orderId: "T12345",

tradingAction: FXB.OrderTypes.CHANGE,

timeframe: 3600, // Timeframe for candle-based stop-loss

sl: {bar: {index: 1, price: "l"}}, // Set the stop-loss to the low of the previous H1 bar

tp: {pips: 30} // Set the take-profit to 30 pips from the current market price

}, function (MsgResult) {

});