Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 AttiM, 02-14-2024, 05:20 PM
      12 responses
      213 views
      0 likes
      Last Post DrakeiJosh  
      Started by cre8able, 02-11-2023, 05:43 PM
      3 responses
      238 views
      0 likes
      Last Post rhubear
      by rhubear
       
      Started by frslvr, 04-11-2024, 07:26 AM
      8 responses
      117 views
      1 like
      Last Post NinjaTrader_BrandonH  
      Started by stafe, 04-15-2024, 08:34 PM
      10 responses
      47 views
      0 likes
      Last Post stafe
      by stafe
       
      Started by rocketman7, Today, 09:41 AM
      3 responses
      12 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Working...
      X