[cmd] CheckOpenOrder

stable
By Strooth in Miscellaneous Published November 2021 👁 1,342 views 💬 0 comments

Description

--Usage local oid = CheckOpenOrder(Load('oid', ''))
HaasScript
DefineCommand("CheckOpenOrder", "Check if order is open or filled or cancelled")
local oids = DefineParameter(ListDynamicType, "oid", "the oid or list of oids to check", false, '', 'string, guid')
local checkoid = function(oid)
    if oid != '' then 
        local order = OrderContainer(oid)
            if order.isOpen then 
                return oid 
            else 
                return ''
            end 
    else 
        return ''
    end 
end 
if Count(oids) > 1 then 
    for index, oid in pairs(oids) do 
        oids[index] = checkoid(oid)
    end 
elseif Count(oids) == 1 then 
    oids = checkoid(oids)
end 

DefineOutput(ListDynamicType, oids, 'the list of checked oids', 'ListDynamicType, guid, string')

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!