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 NullPointStrategies, Today, 05:17 AM
    0 responses
    52 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    130 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    70 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    44 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    49 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X