Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Compare bar date to todays date

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

    Compare bar date to todays date

    I am sure this is on the forum someplace but what can I use to compare the bar date to today.

    If ToDay(Time[0]) if the date of the bar (in ccyymmdd format), how can I compare that to see if the bar is today or a previous day. I want to display statistics on the screen and show various stats for just today (but I want to load the chart for the last week).

    I know I can input a variable and compare against that but I am looking to just use the current date (and not have to change an input variable everytime).

    #2
    Hello gregm,

    Thank you for your post and welcome to the NinjaTrader Support Forum.

    You can compare a bar to the current day by using Time[0].Date and DateTime.Today:
    Code:
    if (Time[0].Date == DateTime.Today)
    {
    //Do something.
    }
    For information on Time please visit the following link: http://www.ninjatrader.com/support/h....html?time.htm
    For information on the DateTime structure please visit the following link: http://msdn.microsoft.com/en-us/libr....datetime.aspx

    Please let me know if I may be of further assistance.

    Comment


      #3
      thanks - works great !!

      -greg

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      590 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      342 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      555 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      552 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X