[FEBE] ParseOrderType

stable
By pshai in Other Published October 2020 👁 1,373 views 💬 0 comments

Description

Necessary command for FEBE which converts order types to numbers and back to enums. More information about FEBE: https://www.haasscripts.com/blog/guides/first-ever-bot-engine-febe-for-haasscript/
HaasScript
DefineCommand('FEBE_ParseOrderType', 'Parses the order type enums to FEBE-compatible values')

local type = DefineParameter(DynamicType, 'type', 'Order type to be parsed', true, LimitOrderType, 'InputOrderType, LimitOrderType, MarketOrderType, MakerOrCancelOrderType, StopLimitOrderType, StopMarketOrderType, TakeProfitLimitOrderType, TakeProfitMarketOrderType')
local ret
local arr = {
    LimitOrderType,
    MarketOrderType,
    MakerOrCancelOrderType,
    NoTimeOutOrderType,
    StopLimitOrderType,
    StopMarketOrderType,
    TakeProfitLimitOrderType,
    TakeProfitMarketOrderType
    }

for i=1, #arr do
    if type == i then
        ret = arr[i]
        break
    elseif type == arr[i] then
        ret = i
        break
    end
end

DefineOutput(DynamicType, ret, 'Parsed order type value')

0 Comments

Sign in to leave a comment.

No comments yet. Be the first!