Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

In a quandry with bool?[]

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

    In a quandry with bool?[]

    I have a var:
    private bool?[] Enable = new bool?[20];

    I expose the array:
    #region Properties
    [Description("Prior Year - Enable/Disable (true/false)")]
    [Category("Parameters")]
    public bool? Prior_Year
    {
    get { return Enable[0]; }
    set { Enable[0] = value; }
    }

    [Description("52 Week - Enable/Disable (true/false)")]
    [Category("Parameters")]
    public bool? Trailing_52_Week
    {
    get { return Enable[1]; }
    set { Enable[1] = value; }
    }

    [Description("Current Year - Enable/Disable (true/false)")]
    [Category("Parameters")]
    public bool? Current_Year
    {
    get { return Enable[2]; }
    set { Enable[2] = value; }
    }
    ...

    While the array has a dimension of [20] the members will be less.
    I want the empty members to be null, however I want to set the default values in "properties" to true or false.

    I want to do this because I loop through all instances of Enable[] and perform operations while (Enable[x] != null) within this loop, I perform operations if(Enable[x] != false) and I assign a queue for Enable[x] = true.

    How can I assign false to each exposed Enable[] and leave the rest as null, or more simply put; how do I set Enable[] default 'false' or user input 'true' within "Properties"?

    #2
    Hello SleepingTroll,

    This is unfortuantely outside our scope of support. Hopefully another community member may offer assistance or you can check MSDN documentation.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thnx, found my way around having to use a nullable.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      571 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      330 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
      548 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      549 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X