Firetron’s InputDebugOptions

1 32 Views No Comments 2 weeks ago
  • Creates a group of inputs for debug options: fee, logging, plotting, reporting, verbose, verbosityInterval.

    Custom Command Dependencies:
    None

    • This topic was modified 1 week, 4 days ago by Firetron. Reason: Added fee input
    HaasScript Code
    --  ============================================================================
    --    Firetron's InputDebugOptions
    --
    --    Creates a group of inputs for debug options: fee, logging, plotting,
    --    reporting, verbose, verbosityInterval.
    --
    --    Custom Command Dependencies:
    --    None
    --
    --    Discord: @FiretronP75
    --  ============================================================================
    
    --  ========================================================
    --    Variables
    --  ========================================================
    
    --  ------------------------------------
    --    Definition
    --  ------------------------------------
    
    local description
    local inputSuggestions
    local label
    local output
    local outputSuggestions
    local tooltip
    
    --  ------------------------------------
    --    Parameter
    --  ------------------------------------
    
    local pFee
    local pGroup
    local pIsLogging
    local pIsPlotting
    local pIsReporting
    local pIsVerbose
    local pVerbosityInterval
    
    --  ========================================================
    --    Command Definition
    --  ========================================================
    
    description = 'Creates a group of inputs for debug options: logging, plotting, reporting, verbose, verbosityInterval.'
    DefineCommand('InputDebugOptions', description)
    
    --  ========================================================
    --    Parameter Definition
    --  ========================================================
    
    description      = 'The group of the input fields.'
    inputSuggestions = 'Text'
    pGroup           = DefineParameter(StringType, 'group', description, true, 'DebugOptions', inputSuggestions)
    
    --  ========================================================
    --    Input Definitions
    --  ========================================================
    
    label   = 'Fee Percentage'
    tooltip = 'Fee to use for backtests and simulated trading. Ignored for live trading.'
    pFee    = Input(label, Fee(), tooltip, pGroup)
    
    label      = 'Logging'
    tooltip    = 'Turns console logging on or off.'
    pIsLogging = Input(label, true, tooltip, pGroup)
    
    label       = 'Plotting'
    tooltip     = 'Turns chart plotting on or off.'
    pIsPlotting = Input(label, true, tooltip, pGroup)
    
    label        = 'Reporting'
    tooltip      = 'Turns custom report of current state on or off.'
    pIsReporting = Input(label, true, tooltip, pGroup)
    
    label      = 'Verbose'
    tooltip    = 'Turns verbose console logging on or off. Ignored if logging is turned off.'
    pIsVerbose = Input(label, false, tooltip, pGroup)
    
    label              = 'Verbose Logging Interval'
    tooltip            = 'Time between verbose logging. Ignored if logging or verbose is turned off.'
    pVerbosityInterval = InputInterval(label, 60, tooltip, pGroup)
    
    --  ========================================================
    --    Output Definitions
    --  ========================================================
    
    output = {
      fee               = pFee,
      logging           = pIsLogging,
      plotting          = pIsPlotting,
      reporting         = pIsReporting,
      verbose           = pIsVerbose,
      verbosityInterval = pVerbosityInterval,
    }
    
    description       = 'ListDynamic with named elements.'
    outputSuggestions = ''
    DefineOutput(ListDynamicType, output, description, outputSuggestions)
    
    description = 'Fee to use for backtests and simulated trading.'
    DefineOutputIndex( 1, NumberType, 'fee', description)
    
    description = 'Turns console logging on or off.'
    DefineOutputIndex( 2, BooleanType, 'logging', description)
    
    description = 'Turns chart plotting on or off.'
    DefineOutputIndex( 3, BooleanType, 'plotting', description)
    
    description = 'Turns custom report of current state on or off.'
    DefineOutputIndex( 4, BooleanType, 'reporting', description)
    
    description = 'Turns verbose console logging on or off.'
    DefineOutputIndex( 5, BooleanType, 'verbose', description)
    
    description = 'Time between verbose logging.'
    DefineOutputIndex( 6, NumberType, 'verbosityInterval', description)
Login or Register to Comment

Unlock your crypto trading potential

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

Join for Free