[CMD]CheckPositionId
stableDescription
Usage
local positionid = CC_CheckPositionId(Load('positionid', NewGuid()))
--- Run bot code, do blah, make teh profitz
Save('positionId', CC_CheckPositionId(positionid))
HaasScript
DefineCommand('CheckPositionId', 'Check if the position is closed and return newguid if it is')
local positionId = DefineParameter(DynamicType, 'PositionId', 'The positionId to check', true, NewGuid(), 'NewGuid()')
local checkPid = function(pid)
if pid then
if IsPositionClosed(pid) then
if IsAnyOrderOpen(pid) then
CancelAllOrders(pid)
end
if GetPositionAmount(pid) == 0 then
return NewGuid()
else return pid
end
else return pid
end
else return NewGuid()
end
end
DefineOutput(DynamicType, checkPid(positionId), 'The positionId', '')
1 Comment
Sign in to leave a comment.
good СС_ for optimizing and checking orders