Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

GetBar() Question

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

    GetBar() Question

    Dear Support,

    I am using the GetBar() method as per the sample in the help.

    Instead of using the sample date, have the following:

    signalBar = GetBar(new DateTime(DateTime.Now.Year, DateTimeNow.Month, DateTime.Now.Day, 9, 30, 00));

    I then want to test that value, so I do:

    Print("The close price of signalBar is: " + Close[signalBar].ToString());

    When I check the output for a single session, I am getting multiple values, only 1 or 2 of which are the actual values.

    Here is my question: Shouldn't signalBar (for the day/session ) always be the same once I define it with that time? In other words, I am getting a specific bar and as such, shouldn't it always be the same for that session that matches my signalBar time/date?

    Thanks,

    #2


    Use Time[0] instead of DateTime.Now

    Hope this helps others.

    Comment


      #3
      Glad you got it figured out, r2kTrader. Let us know if you have any other questions.
      AustinNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by CarlTrading, 03-31-2026, 09:41 PM
      1 response
      62 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      33 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      44 views
      1 like
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      58 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      47 views
      0 likes
      Last Post CarlTrading  
      Working...
      X