Announcement

Collapse
No announcement yet.

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 CarlTrading, 03-31-2026, 09:41 PM
          1 response
          68 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by CarlTrading, 04-01-2026, 02:41 AM
          0 responses
          37 views
          0 likes
          Last Post CarlTrading  
          Started by CaptainJack, 03-31-2026, 11:44 PM
          0 responses
          62 views
          1 like
          Last Post CaptainJack  
          Started by CarlTrading, 03-30-2026, 11:51 AM
          0 responses
          62 views
          0 likes
          Last Post CarlTrading  
          Started by CarlTrading, 03-30-2026, 11:48 AM
          0 responses
          53 views
          0 likes
          Last Post CarlTrading  
          Working...
          X