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

Value of Time[0]

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

    Value of Time[0]

    In my strategy, I am referencing the value of Time[0] in the OnExecution event. The value it returns is not a bar time stamp on my chart.

    In my case, I am using a 3 minute chart. The Bar Time stamps on the chart are 11:00, 11:03. 11:06, etc. An OnExecution event fired at 11:21:30. The active bar was time stamped 11:24 per my chart, but Time[0] returned 11:22 during the OnExecution event. I expected 11:24, not 11:22. 11:22 is not on an even 3-minute boundary.

    Any ideas??

    #2
    Hello Elevator2TheTop,

    Thank you for your post.

    Are you using multiple data series for the strategy?

    The reason I ask this is, that with Time[0] in OnExecution() it will return the last closed bar from the last BarsInProgress that was called.
    Cal H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Cal View Post
      Hello Elevator2TheTop,

      Thank you for your post.

      Are you using multiple data series for the strategy?

      The reason I ask this is, that with Time[0] in OnExecution() it will return the last closed bar from the last BarsInProgress that was called.
      If I am using multiple data series, it is unintentional. Not even sure how to do that. How can I confirm one way or the other?

      Comment


        #4
        Elevator2TheTop,

        You would see Add(PeriodType, period value); in the initialize section of the script

        Can you share your Initialize section?
        Cal H.NinjaTrader Customer Service

        Comment


          #5
          I see the problem. Even though my chart is on a three-minute bar interval, the strategy is configured to 1 (apparently the default). I have corrected the setting, and now Time[0] is reporting the correct timestamp.

          Thank you for your assistance!.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Klaus Hengher, Yesterday, 03:13 AM
          2 responses
          15 views
          0 likes
          Last Post Klaus Hengher  
          Started by Sebastian - TwinPeaks, Yesterday, 01:31 PM
          2 responses
          13 views
          0 likes
          Last Post Sebastian - TwinPeaks  
          Started by wbennettjr, 07-15-2017, 05:07 PM
          16 responses
          2,532 views
          1 like
          Last Post eladlevi  
          Started by Human#102, Yesterday, 09:54 AM
          2 responses
          8 views
          0 likes
          Last Post Human#102  
          Started by Patlpp, 08-16-2021, 03:10 PM
          10 responses
          500 views
          0 likes
          Last Post Joerg
          by Joerg
           
          Working...
          X