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

Time as input

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

    Time as input

    Hi all,

    Is it possible to use Time (HH:MM or any other format) as a user input using Wizard?

    Best Regards,
    Carlos

    #2
    Hello CarlosTTW,

    I am including a picture where I have loaded up a time value in the Condition Builder section of the Strategy Wizard. You can reach this screen from the 4th page of the Strategy Wizard by clicking the uppermost Add button on the right.

    Please let us know if there are any other ways we can help.
    Attached Files
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Thanks Jessica,

      But how can I define time as user input? Is it a integer (or double) variable?

      Comment


        #4
        NinjaTrader contains the convenience method ToTime. I will provide a help guide excerpt.

        Originally posted by http://ninjatrader.com/support/helpGuides/nt7/totime.htm
        Integer representation of time is in the following format Hmmss where 7:30 AM would be 73000 and 2:15:12 PM would be 141512.
        Thus, if you take an integer input as user input, where the ten-thousands and hundred-thousands digits are the 24 hour local time, the hundreds and thousands digits are the minutes, and the tens and ones digits are seconds, with no leading zero(es) for hours 0-9, then you can compare these to times which involve the ToTime() method, including wizard generated times.

        Please let us know if there are any other ways we can help.
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          Thanks Jessica, I understand what you mean.

          But, how to define following condition using Wizard:

          If current bar close (current time) > StartTime (defined input for example 093000) Then enter long

          Thanks again,
          Carlos

          Comment


            #6
            Hello again CarlosTTW,

            What you are attempting is currently not possible using the strategy wizard alone. You will need to unlock your Strategy code, or click generate on your Indicator code, and then compare the output of ToTime(hour, minute, second) to the integer you input.

            You can, however, generate most of this code through the wizard. I am including a picture with an example you can use on page 3 of the strategy wizard. On page 4, in the condition builder, simply set both the left and right hand sides to the time value I showed you for the left hand side earlier.

            Once you have done all that through the wizard, you can then compare the output of ToTime(hour, minute, second) directly to the value of TimeToDoStuff .

            Please let us know if there are any other ways we can help.
            Attached Files
            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              Thanks Jessica, it works perfect.

              One more question. I supose it is the same procedure for dates, isn't it?

              Regards

              Comment


                #8
                Correct, except that you would use the ToDay() method , http://ninjatrader.com/support/helpGuides/nt7/today.htm , in YYYYMMDD format where YYYY is the 4 digit year (10 millions through 10 thousands), MM is the 2 digit month (thousands and hundreds), and DD is the 2 digit day of the month (tens and ones).
                Jessica P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by DJ888, 04-16-2024, 06:09 PM
                6 responses
                18 views
                0 likes
                Last Post DJ888
                by DJ888
                 
                Started by Jon17, Today, 04:33 PM
                0 responses
                1 view
                0 likes
                Last Post Jon17
                by Jon17
                 
                Started by Javierw.ok, Today, 04:12 PM
                0 responses
                6 views
                0 likes
                Last Post Javierw.ok  
                Started by timmbbo, Today, 08:59 AM
                2 responses
                10 views
                0 likes
                Last Post bltdavid  
                Started by alifarahani, Today, 09:40 AM
                6 responses
                41 views
                0 likes
                Last Post alifarahani  
                Working...
                X