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 Variables

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

    Time Variables

    Anyone know how to have different time intervals for optimization.
    For Example say I wanted to enter a trade at a certain hour then I can create a variable such as
    && ToTime(Time[
    0]) == ToTime(Hours, 0, 0)
    and this works ok
    but say that I also want to have a minutes variable as well
    && ToTime(Time[0]) == ToTime(Hours,Mins, 0)this doesn't work
    I also used two lines with hours in one and minutes in the other but either approach doesn't work .

    #2
    waza1960, what range of values are you then allowing for those 2 variables?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      for hours the range I am trying is 1----12 & minutes 1---59 . Thanks

      Comment


        #4
        Hi waza1960,

        What interval are you running this against?

        Trading hours could range from 0-23. 0-59 is a valid range for minutes, but will also need to look at the interval you're using for this strategy. A 60 minute+ chart will not have any minute granularity.

        Example:
        Time[0] is the bar time stamp. There won't typically be a time stamp of 13:18 on a 15 minute interval. It would go from 13:15 and the next at 13:30.
        Ryan M.NinjaTrader Customer Service

        Comment


          #5
          interval = 60 min chart
          Thanks

          Comment


            #6
            Ok, then please try to simply set the the inputs to a hour and minute range that should 'hit' on a present timestamp on your chart - would you then get an entry shown, so you would know the logic is working / triggering trades?
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Ok, then please try to simply set the the inputs to a hour and minute range that should 'hit' on a present timestamp on your chart - would you then get an entry shown, so you would know the logic is working / triggering trades?
              Ok will do

              Example:
              Time[0] is the bar time stamp. There won't typically be a time stamp of 13:18 on a 15 minute interval. It would go from 13:15 and the next at 13:30.
              Does this mean that if I'm optimising on a 60min chart I can't optimise minutes because the Smallest Time Stamp here is 60mins/hour?

              Comment


                #8
                That's correct you would be limited to the timestamp granularity that your charted bars series offers, for a 1 minute for example this is down to the minute interval, but for a 60 min that would be only the hourly interval then. You could create a MultiSeries strategy though that would submit orders to a lower timeframe and thus you had access to smaller timestamps as well by using the Times[x] method.

                BertrandNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by rayyyu12, Today, 12:47 AM
                0 responses
                2 views
                0 likes
                Last Post rayyyu12  
                Started by ETFVoyageur, 05-07-2024, 07:05 PM
                17 responses
                133 views
                0 likes
                Last Post ETFVoyageur  
                Started by ETFVoyageur, Yesterday, 10:13 PM
                1 response
                8 views
                0 likes
                Last Post ETFVoyageur  
                Started by somethingcomplex, Yesterday, 10:36 PM
                0 responses
                9 views
                0 likes
                Last Post somethingcomplex  
                Started by sofortune, 05-10-2024, 10:28 AM
                5 responses
                22 views
                0 likes
                Last Post sofortune  
                Working...
                X