Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Bar Date

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

    Bar Date

    Hi all,

    I would like to know how I can compare a bar date with system date

    Thanks

    Dervakon

    #2
    Hello,

    A bar's time stamp is Time[0].
    Your system clock is Date.Time.Now

    There is NinjaScript method ToDay() that takes the day portion of a date/time object and converts to integer. You can also use C# methods for comparing date / time.
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Thanks Ryan,

      But my problem is when I use
      protectedoverridevoid OnBarUpdate() Is always downloading all the bar you got on your chart.


      Me I want to do this; is the bar date is not equal to the date system skip it


      Thanks


      Dervakon

      Comment


        #4
        How I can convert Time[0]. to Date.Time.Now so I can compare them...

        Thanks

        Dervakon

        Comment


          #5
          if (ToDay(Time[0]) != ToDay(DateTime.Now))
          {
          //do something
          }
          Ryan M.NinjaTrader Customer Service

          Comment


            #6
            Thank you for your help...

            Comment


              #7
              Another question,

              With the same
              if (ToDay(Time[0]) != ToDay(DateTime.Now))
              {
              //do something
              }

              How I can compare minute to minute...

              Thanks

              Comment


                #8
                You can use NinjaScript method ToTime() to take the time portion of a date / time object and convert to integer.

                Please see this reference sample for additional help working with date / time objects:
                Ryan M.NinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by Dervakon View Post
                  Another question,

                  With the same
                  if (ToDay(Time[0]) != ToDay(DateTime.Now))
                  {
                  //do something
                  }

                  How I can compare minute to minute...

                  Thanks
                  Code:
                  Time[0].Minute != DateTime.Now.Minute

                  Comment


                    #10
                    Thank you Koganam

                    This will help

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Hwop38, 05-04-2026, 07:02 PM
                    0 responses
                    164 views
                    0 likes
                    Last Post Hwop38
                    by Hwop38
                     
                    Started by CaptainJack, 04-24-2026, 11:07 PM
                    0 responses
                    317 views
                    0 likes
                    Last Post CaptainJack  
                    Started by Mindset, 04-21-2026, 06:46 AM
                    0 responses
                    245 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by M4ndoo, 04-20-2026, 05:21 PM
                    0 responses
                    350 views
                    0 likes
                    Last Post M4ndoo
                    by M4ndoo
                     
                    Started by M4ndoo, 04-19-2026, 05:54 PM
                    0 responses
                    179 views
                    0 likes
                    Last Post M4ndoo
                    by M4ndoo
                     
                    Working...
                    X