[pshaiCmd] SuperInput

2 214 Views 5 Comments 6 months ago
  • Creates an input field and monitors changes in value.

    A handy way to monitor values and/or optimize calculations.

    Requires:
    https://www.haasscripts.com/t/pshaicmd-superinputsettings/

    Example:

    EnableHighSpeedUpdates()
    --
    local settings = CC_SuperInputSettings('some default value', 'a tool-tip', 'a group!', 2)
    local someVar = CC_SuperInput('Input', 'Some Input', settings)
    --
    if someVar.FieldChanged then
        LogWarning('some setting was changed, recalculate AI...')
    else
        local value = someVar.FieldValue -- get value from input field
    end
    • This topic was modified 6 months, 1 week ago by pshai.
    HaasScript Code
    Sign in or Register to view
    • #1667
      Firetron
      Basic
      Up
      0
      Down

      Can you provide some more details or use cases of how to benefit?

    • #1698
      pshai
      Admin
      Up
      0
      Down

      The idea was to be able to make scripts more optimized. There could be something you need to calculate based on some inputs you get, but is slowing down your script execution. But if those inputs stay the same (like they probably will for quite some time), it could be better to re-calculate those heavy-values _only_ when you change the values.

      Hope this helps.

      • #1704
        Kobalt
        Basic
        Up
        0
        Down

        Is there a way to check if a CC or calculation in some part of your script is slowing down execution or resources used per command dependency.
        To find things SuperInputs would improve, or to avoid in general or any other way avoid sluggish execution?

        Maybe there are common bad practices an optimisation check script could detect.
        [These are more inspirational than straight questions. I assume something like this doesn’t yet exist. Unless I’m over complicating this and theres a check list or simple way to do this..:)]

        Your example makes me curious what might benefit here, can you give an obvious/notorious example? (Interval, VWAP reset loopback those kind of things?)
        And SuperInput works in running HaasBots so can maybe help people running 50+ scripts?

        • This reply was modified 5 months, 3 weeks ago by Kobalt.
      • #1714
        pshai
        Admin
        Up
        0
        Down

        Your example makes me curious what might benefit here, can you give an obvious/notorious example? (Interval, VWAP reset loopback those kind of things?)
        And SuperInput works in running HaasBots so can maybe help people running 50+ scripts?

        Yes, these are the kind of things I mean. If you can find something that doesn’t need to be re-calculated unless the input values have changed, you can use this to detect that.

        You could do the same for every input in your script by saving/loading and comparing the current input value to previously saved value, but I would argue that this makes it a little bit easier. 😛

      • #2012
        Kobalt
        Basic
        Up
        0
        Down

        Ok just to drain the regular folks talk out of you | show how little I know | try to bridge the gap between:

        what is obvious to you and is still very vague territory to many…
        Would using this instead for every Input make sense?
        In the sense: Can’t hurt to always use SuperInput vs regular Input.

         if SuperInput "only makes things faster never slower" then
        Upgrade the default Input command: to enhanced (super)Input.
        Input=SuperInput
        end 
        return Input
        else
        If super is not always better then
        Log [array content}

        Please list some Inputs everyone uses: [categorise or label as I, Input or SI, SuperInput]
        So users who are not the king, tron or the wizard.
        Get a still not set in stone but better idea which “stuff” calculates and whatever magics..
        And may or may not qualify for using SuperInput over regular Input.

        • This reply was modified 2 months, 4 weeks ago by Kobalt.
Login or Register to Comment

Unlock your crypto trading potential

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

Join for Free