Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bars.GetTime(0) returns time from 2 days ago?

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

    Bars.GetTime(0) returns time from 2 days ago?

    Hello there.

    I have my DataSeries to load just 1 day and indeed only Apr 18 and 19th are charted (24 hours ending Apr 19th).

    I am using Bars.GetTime(0) to get the time from the last bar, but it is returning date of Apr 17 for every bar.

    How can I get the date of the last bar on the chart (not session).

    Many Thanks, Caesar.

    #2
    Hello Caesar,

    Thanks for your note.

    Bars.GetTime() returns the time stamp at the current bar index value. Note that a bar index value is different than BarsAgo.

    ChartBars.ToIndex could be used to get the bar index of the last bar rendered on the chart. This value could be passed into the Bars.GetTime() method to get the time of the last bar rendered on the chart.

    Bars.GetTime(ChartBars.ToIndex)

    See the help guide page for more information and sample code:

    ChartBars.ToIndex: https://ninjatrader.com/support/help...rs_toindex.htm
    Bars.GetTime(): https://ninjatrader.com/support/help...t8/gettime.htm
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Many Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      646 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      367 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      107 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      569 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      573 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X