[pshaiCmd] SuperInput

2 396 Views 7 Comments 1 year 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 1 year ago by pshai.
    HaasScript Code
    Sign in or Register to download for free
    • #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 1 year 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 9 months, 2 weeks ago by Kobalt.
      • #2626
        pshai
        Admin
        Up
        0
        Down
        ::

        Well, one good example would be a daily moving average that is using closed prices only. You would only have to calculate that ONCE every 1440 minutes, right? But, in case the user changes the length or type of this moving average, you might want to recalculate it immediately vs wait until the next calculation occurs. This is the kind of case where this command (or any logic that tracks changes in input values) comes in handy.

    • #2703
      Kobalt
      Basic
      Up
      0
      Down
      ::

      Right I see, (really I think it just got a lot clearer) Cool!

      Maybe.. just maybe this has more potential as an enhancement feature to post on Trello??
      (I’d say “keep it in the back of your head”, but fear that many insignificant to you but potentially much greater things reside)

      This one haas the : “A small step for pshai, but a leap for all HaasHoles” potential too.

      I’m going to spitball here:

      1: upgrade the Input command by default with the optimization option for (Super log) as a general tick box for all Inputs or an optional boolean parameter to add in each that either defaults false if left blank or if specified, true for Super. (I like the on off tick-box option better)

      I’m going here because I’m assuming that: These/there are more than a couple of typical scenarios (like your MA example would otherwise go ‘unfettered’ lol what a word)
      Operations with no Return.. etc that later on perhaps we can find a way to collect, identify, detect, extract, correct adjust or optimize….

      2: Not just when if a script is slow to enable Super scan for detection of (potentially) unnecessary recalculations..

      3: A script tuner similar to HaasLab only for detecting obsolete or problematic lines of code.. you can try and commit or discard / undo to:
      Tune for efficiency and reliability. (and educate)

      Ideally (and since the singularity is accelerating, perhaps sooner and with less effort than we think;) this could evolve into:

      4. Some intelligent scan heuristics and what not.. analysis/safety net (on running scripts that seem to be on the. verge of ‘trouble’ in the back end for *all running scripts in the cloud..
      *everyone may opt in or out…etc. (unless it’s super basic stupid foolproof trouble avoidance only and has zero chance of. false positives)

      Greets

      • This reply was modified 3 days, 6 hours ago by Kobalt.
      • This reply was modified 3 days, 5 hours ago by Kobalt. Reason: removed excessive compliments ;P
Login or Register to Comment

Unlock your crypto trading potential

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

Join for Free