[FEBE] ParseOrderType

0 61 Views No Comments 2 months ago
  • 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 Code
    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')
Login or Register to Comment

Unlock your crypto trading potential

Create a free account and enjoy everything we have to offer.

Join for Free