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 cmoran13, 04-16-2026, 01:02 PM
    0 responses
    43 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    25 views
    0 likes
    Last Post PaulMohn  
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    163 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    98 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    158 views
    2 likes
    Last Post CaptainJack  
    Working...
    X