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 CaptainJack, 05-29-2026, 05:09 AM
      0 responses
      231 views
      0 likes
      Last Post CaptainJack  
      Started by CaptainJack, 05-29-2026, 12:02 AM
      0 responses
      149 views
      0 likes
      Last Post CaptainJack  
      Started by charlesugo_1, 05-26-2026, 05:03 PM
      0 responses
      161 views
      1 like
      Last Post charlesugo_1  
      Started by DannyP96, 05-18-2026, 02:38 PM
      1 response
      243 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 05-11-2026, 05:56 AM
      0 responses
      198 views
      0 likes
      Last Post CarlTrading  
      Working...
      X