Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ToDay(Time[0])

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

    ToDay(Time[0])

    I need to check against a fixed date in both replay and live

    1. it is 27 jan....why does ToDay(Time[0]) print 20100126...i.e. which time zone does it use so I can adjust for mine...this works fine for live feed but not in replay
    ToDay(Time[0]) 20100126
    DateTime.Now 1/27/2010 8:02:44 AM

    2. if I use
    if ( DateTime.Now.Ticks > Time[0].Ticks )
    it does not work for live feed because the ticks are off like this on live feed:

    DateTime.Now.Ticks 634001516115070000
    Time[0].Ticks 634000950200000000

    looks like they will always be off...how can I adjust for 10 mins for instance
    Last edited by ATI user; 01-27-2010, 07:04 AM.

    #2
    ATI user,

    Not sure how DateTime.Now is relevant.

    ToDay(Time[0]) gives you the date portion of the timestamp of the bar. I am not sure why you feel this is not working in a replay. If your bars are 1/27 then you will get 1/27. Since you are using a replay, they are most likely 1/26 replay bars so that is what you will get then.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      no...I test back to 4 Jan and the date shown from ToDay(Time[0]) is further back in dec for some reason

      please comment re 1 and 2 above...i.e. why is the 26th printing on the 27th...etc...and how to use
      DateTime.Now.Ticks 634001516115070000
      Time[0].Ticks 634000950200000000
      so that they are equal in real time

      thanks

      Comment


        #4
        ATI user,

        Please check your actual bars as seen on the chart. ToDay(Time[0]) simply prints the timestamp of your bars. Nothing fancy and would have no difference between replay/live.

        DateTime.Now vs. Time[0] is not suppose to be the same. DateTime.Now is your PC clock time at the very instant it is called. Time[0] is the timestamp of the bar. If your computer processed DateTime.Now a split second beyond Time[0]'s timestamp, it is now a different value. Again, not sure how DateTime.Now is relevant for use in any time checking against bar timestamps.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Josh View Post
          ATI user,

          Please check your actual bars as seen on the chart. ToDay(Time[0]) simply prints the timestamp of your bars.
          .
          I am running on zenfire live

          Print ("ToDay(Time[0]) = "+ToDay(Time[0]).ToString( ) );

          outputs: ToDay(Time[0]) = 20100121 see pic 1 attached

          today is NOT the 21st...see 2nd pic
          Attached Files

          Comment


            #6
            now it is printing the 27th per the pic

            all I did in the meantime was stay connected to zen and remove and reload the strat

            ??????????
            Attached Files

            Comment


              #7
              Print the bar it is processing for your output line and compare it to that exact bar on the chart. You will find it is accurate.
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Josh View Post
                Print the bar it is processing for your output line and compare it to that exact bar on the chart. You will find it is accurate.
                forgot to mention that this all takes place on a 20 sec chart...so how could the bar be anything but current?

                seems to be working now though

                Comment


                  #9
                  No way for me to speculate on the scenario. All I can say is that if it printed any other dates it simply means somewhere in the bars it is processing there was a bar with that date. It is just a matter of finding where.
                  Josh P.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  623 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  359 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  105 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  562 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  567 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X