cancelOrder (SDK Trading)
cancelOrder is a Fintechee API to cancel a pending order(limit or stop).
cancelOrder(brokerName, accountId, orderId)
EA SDK This function cancels the specific pending order. Phase (this API's scope): onTick | deinit
Kind: global function
Param | Type | Description |
---|---|---|
brokerName | string | broker name |
accountId | string | account ID |
orderId | string | order ID |
cancelOrder (SDK Trading)
registerEA(
"test_api",
"An EA to test APIs",
[],
function (context) { // Init()
},
function (context) { // Deinit()
},
function (context) { // OnTick()
var account = getAccount(context, 0)
var brokerName = getBrokerNameOfAccount(account)
var accountId = getAccountIdOfAccount(account)
var symbolName = "EUR/USD"
var length = getPendingOrdersListLength(context)
for (var i = 0; i < length; i++) {
var pendingOrder = getPendingOrder(context, i)
if (pendingOrder != null) {
var orderId = getOrderId(pendingOrder)
cancelOrder(brokerName, accountId, orderId)
}
}
})