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 pvincent, 06-23-2022, 12:53 PM
      14 responses
      238 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      383 views
      1 like
      Last Post Gavini
      by Gavini
       
      Started by oviejo, Today, 12:28 AM
      0 responses
      1 view
      0 likes
      Last Post oviejo
      by oviejo
       
      Started by pechtri, 06-22-2023, 02:31 AM
      10 responses
      125 views
      0 likes
      Last Post Leeroy_Jenkins  
      Started by judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      59 views
      0 likes
      Last Post DynamicTest  
      Working...
      X