Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Any way to add dynamic(variable) inputs?

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

    Any way to add dynamic(variable) inputs?

    HI.
    at this moment, I always declare the inputs with fixed blocks, like:

    Code:
    	[Category("xyz")]
            [Display(Name = "InutName abc", Order = 1)]
            public bool Enable_Smth_1
            {
                get { return enable_smth[1]; }	set { enable_smth[1] = value; }
            }

    is it somehow possible to create the dynamic number of inputs, like:
    Code:
    for(var i=0; i<4; i++){
    
    	[Category("xyz"+i)]
            [Display(Name = "InutName abc"+i, Order = i)]
            public bool "Enable_Smth"+i
            {
                get { return enable_smth[i]; }	set { enable_smth[i] = value; }
            }
    
    }

    #2
    Hello,

    Thank you for the post.

    You could explore using Collections such as an Array if the user needs to input multiple choices. There is a sample here that contains a list of elements as a property: https://ninjatrader.com/support/foru...ad.php?t=97919

    Otherwise, I am unaware of a way to have any sort of looping logic like this outside of the method level in the class scope. There would not be anything I could personally suggest to make adding of properties more dynamic like you have shown. If any other users have explored this concept, they could certainly provide their solutions here.


    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    569 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
    548 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X