Delete Order
To delete an order, please fill the following values in the value map:
Valuemap field |
Datatype |
Description |
Command |
string |
The command. Must be |
OrderID |
string |
The identifier of the order. The order must exist and must be in the waiting status. |
Example: Delete All Waiting Orders at Every Tick [hide]
function Init() strategy:name("Sample"); strategy:description(""); end local offer; local account; local amount; local BuySell; local canClose; local nexecuting = 0; function Prepare(onlyName) instance:name(profile:id() .. "(" .. instance.bid:instrument() .. ")"); end function Update() local enum, row; if nexecuting > 0 then return ; end enum = core.host:findTable("orders"):enumerator(); row = enum:next(); while (row ~= nil) do if row.FixStatus == "W" then local valuemap = core.valuemap(); valuemap.Command = "DeleteOrder"; valuemap.OrderID = row.OrderID; success, msg = terminal:execute(200, valuemap); if not(success) then terminal:alertMessage(instance.bid:instrument(), instance.bid[NOW], "Failed delete order " .. msg, instance.bid:date(NOW)); else nexecuting = nexecuting + 1; end end row = enum:next(); end end function AsyncOperationFinished(cookie, success, msg) if cookie == 200 then nexecuting = nexecuting - 1; if not(success) then terminal:alertMessage(instance.bid:instrument(), instance.bid[NOW], "Failed delete order:" .. msg, instance.bid:date(NOW)); end end end