Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Time type and parameter

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

    Time type and parameter

    What data type does ToTime() return?

    And do I need to know any tricks to make a Strategy Parameter of that type?

    #2
    Hi dbooksta,

    ToTime() returns an integer.

    You can read about this in the help guide under ToTime().
    http://www.ninjatrader.com/support/h...nt7/totime.htm

    For an example of how to make a public int, take a look at the #region Properties of the SMA indicator (Tools -> Edit NinjaScript -> Indicator... -> SMA -> OK).
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      So there is no way to create a Strategy Parameter that prompts the user for a time using a format the user would be familiar with? Only as an unconstrained HHMMSS?

      Comment


        #4
        dbooksta, as alternative you could also look into C# directly for this purpose via a TimeSpan user input - for example something like -

        Code:
        [XmlIgnore]
        [Description("RTH StartTime")]
        [GridCategory("RTH Parameters")]
        public TimeSpan RTHStart
        {
        	get { return rthStart; }
        	set { rthStart = value; }
        }
        		
        [Browsable(false)]
        public string RTHStartSerialize 
        {
        	get { return rthStart.ToString(); }
        	set { rthStart = TimeSpan.Parse(value); }
        }

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        566 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
        547 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