Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Default set null values to zero in User Interface

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Default set null values to zero in User Interface

    1. User has the ability to manually set a double value in the indicator's user interface.
    2. The default setting for this value on the initial chart loading sequence is zero.
    3. If this value is changed to something besides zero, it is now that value and loaded onto chart.
    4. If the user pulls up the indicator user interface and deletes that value, if it's not specifically reset to zero, upon hitting apply it's reverts to the last assigned value.
    5. If the user simply deletes the value without entering a new one, this is now a null condition. Objective is for the indicator to identify this null condition and reset the value to zero automatically.

    I've looked around & I'm sure this is addressed somewhere, just can't find it. Assuming also its a simple C# method...
    What's going on is on is if you load a value into the indicator's UI corresponding slot, currently you can't just delete it when done with it.


    Example: On initial load, 'Level 1' is set to zero as a property. So User opens the UI, types in a value, say '6055' and now that value is in place. When the user is done with it, reopens the UI & just deletes it, upon hitting the apply button if the user has not specifically set it back to zero by typing in that value, the indicator reloads the previously assigned value, in this case 6055 above.

    So if user deletes the value, I want the absence of an assigned value, a null entry in this case, to auto-default to zero.


    #2
    Hello johnMoss,

    Thank you for your post.

    No, there is no way to specifically do what you're describing. Doubles and ints cannot be null.

    You could have the user use -1 (or something other value) to mean "no value", and then in your code, you could read that value and set it to some default value.

    Please let us know if you have any further questions.

    Comment


      #3
      Well right now what has to be done is that the user has to manually reset the value back to zero, and if performed, that works just fine. My intent here is one of an intuitive interpretation process by the code to save the user confusion. I have to respectfully assume what you say is fact in NinjaScript, but are we dead-set on this?

      C# does have a method for this, so I'm curious if I can pull a stunt and incorporate it directly in C# or in a Ninjascript method somehow...

      Workable C# Example: int? A = null; return a ?? 0; // this will return A with a value of 0​

      As it stands my example here is true but I'm not competent enough to know how or where to apply or attempt to apply it.

      Comment


        #4
        Hello johnMoss,

        No, unfortunately there is no way to do what you're describing

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        557 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        324 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        545 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        547 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X