Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Inputting Time parameters

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

    Inputting Time parameters

    I am using time filtering for my trades and I want to input the time in a standard time format. hh:mm. I would rather not have a spereate input line for hours and then one for minutes.

    I have looked through the samples on handling time and done some searching in the forum but I can't find any examples on how to format the input. When I input using the DateTime object, on input I am asked for the date and the time. Date is superfluous in my case.

    This code inputs date & time. I want to input just the time. Maybe a custom object that just mimics time?

    Thanks

    [Description("Time to start the Filter")]
    [GridCategory("Parameters")]
    public DateTime AmericasStartTime
    {
    get { return tAmericas;}
    set { tAmericas = (value); }
    }

    Dave H

    #2
    Hello davehart,

    You could use a TimeSpan object for your time inputs. An implementation of this is available with the following indicator from our FileSharing section.



    Code:
     
    #region Variables
    private TimeSpan startTime;
    private TimeSpan endTime;
    #endregion
     
     
    #region Properties
    [Description("VWAP Start Time")]
    [Category("Settings")]
    [Gui.Design.DisplayName("\t\t\t\t\t\tStart Time")]
    public TimeSpan StartTime
    {
    get { return startTime; }
    set { startTime = value; }
    }
     
    [Description("VWAP End Time")]
    [Category("Settings")]
    [Gui.Design.DisplayName("\t\t\t\t\tEnd Time")]
    public TimeSpan EndTime
    {
    get { return endTime; }
    set { endTime = value; }
    }
    #endregion
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Hello,

      with that link I get "Linkid does not exist".

      How can one work then with these time inputs please? Can you give me a short example?

      eg setting a bool true when inside the time input from parameters.

      (Samples DateTimeFunctions and TimeFilter dont show how to refer to the input/parameters)

      Thank you!
      Tony
      Last edited by tonynt; 04-25-2017, 06:24 AM. Reason: clearifying

      Comment


        #4
        Hello tonynt,

        I have attached a sample indicator which will allow you to define the start and end time of the time filter and will draw an arrow on the current bar if its within the timespan.

        Please let us know if you need further assistance.
        Attached Files
        Alan P.NinjaTrader Customer Service

        Comment


          #5
          Hello,

          thank you for your sample. Why do you have

          (08, 30, 00, 00); hour, min, sec, ???
          (10, 10, 00, 00); hour, min, sec, ???

          Didnt find an answer with "Timespan syntax...."

          And what would be please the correct parameter to use it as it is in the NT-sample TimeFilter.


          Thank you
          Tony
          Attached Files
          Last edited by tonynt; 04-26-2017, 06:21 AM. Reason: clearifying

          Comment


            #6
            Hello tonynt,

            The 8 in (08, 30, 00, 00), refers to days.

            I have modified the initial sample and used int variables to define the start and end time rather than TimeSpan variables. This more closely reflects the sample you posted.

            Please let us know if you need further assistance.
            Attached Files
            Alan P.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by arvidvanstaey, Today, 02:19 PM
            3 responses
            9 views
            0 likes
            Last Post NinjaTrader_Zachary  
            Started by jordanq2, Today, 03:10 PM
            2 responses
            8 views
            0 likes
            Last Post jordanq2  
            Started by traderqz, Today, 12:06 AM
            10 responses
            18 views
            0 likes
            Last Post traderqz  
            Started by algospoke, 04-17-2024, 06:40 PM
            5 responses
            47 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by mmckinnm, Today, 01:34 PM
            3 responses
            7 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X