Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

String input variable

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

    String input variable

    How do I specify a string as an input variable? For an int I know I can do this:

    Code:
    [NinjaScriptProperty]
    [Range(0, int.MaxValue)]
    [Display(Name="ExtraTriggerPips", Description="Additional Pips (or ticks for futures) above/below trigger bar to enter", Order=4, GroupName="Parameters")]
    public int ExtraTriggerPips
    { get; set; }
    But how can I do this for a string?

    What I want to do is let the user enter a time in the format 07:30:58 (in other words, HH:MM:SS) and then I want to parse that internally.

    How do I do this?

    #2
    Hello westofpluto,

    Thanks for your post.

    You could use the Strategy Builder to set up a string user-input variable and then click the 'View code' button to see the code that is used to make it. To do so, open a New > Strategy Builder window, navigate to the Inputs and Variables screen, then create a string input in the Inputs section and click the 'View code' button.

    The code to create a user-input string would look something like this.

    Code:
    [NinjaScriptProperty]
    [Display(Name="MyStringInput", Order=1, GroupName="Parameters")]
    public string MyStringInput
    { get; set; }
    See this help guide page for more information: https://ninjatrader.com/support/help...ariablesScreen

    Let us know if we may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    80 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    64 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    63 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    54 views
    0 likes
    Last Post CarlTrading  
    Working...
    X