Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Exact time of Tick arrival

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

    Exact time of Tick arrival

    Hi

    I'm trying to get the exact time of the arrival of my Ticks (at least to the resolution of 1 seconds)

    Time[0].Second or Time[0].Ticks seems to be useless in my case.

    I've been reading some info about using timer, but it seems It's not applicable if I want to do market replay. (ie. even when I pause the time, the timer continues to tick)

    Why am I doing this? Let's say because I want to cancel order if in the next 30 seconds the order doesn't get filled.

    Thank you

    #2
    Hi buddie,

    Try...
    DateTime.Now.Second
    TimNinjaTrader Customer Service

    Comment


      #3
      Hi Tim,

      I supposed that would work if I'm running real time. But how about if I want to do a market replay?

      I understand that DateTime.Now refers to system time at that moment, not at that particular bar/tick.

      Comment


        #4
        Hi buddie,

        I see, I assume your series is larger than a 30 second interval? Hence why you are having trouble using Time[0].Second or Time[0].Ticks?
        TimNinjaTrader Customer Service

        Comment


          #5
          Because it always refer to the previous bar close?

          Time[0].Second always return 0, while Time[0].Ticks will return the same value until it moves on to the next bar

          I saw this thread: http://www.ninjatrader.com/support/f...ad.php?t=12610

          and seems that he suggessted to use timer. But getting a tick time should be simple, why is it so difficult.
          Last edited by buddie; 07-23-2010, 03:05 AM.

          Comment


            #6
            buddie,

            Then this topic has been covered already, if you want to to do this in real time, you have options, same as when using Market Replay, as mentioned in this post:
            TimNinjaTrader Customer Service

            Comment


              #7
              I found this: http://bitbucket.org/tooooooby/ninjatrader_tobysoundcounter/src/54d75aa63436/TobySoundCounter.cs

              and basically he/she used:

              Bars.MarketData.Connection.Options.Provider == Cbi.Provider.Replay ? Bars.MarketData.Connection.Now : DateTime.Now


              what do you think?

              Comment


                #8
                Originally posted by buddie View Post
                I found this: http://bitbucket.org/tooooooby/ninjatrader_tobysoundcounter/src/54d75aa63436/TobySoundCounter.cs

                and basically he/she used:

                Bars.MarketData.Connection.Options.Provider == Cbi.Provider.Replay ? Bars.MarketData.Connection.Now : DateTime.Now


                what do you think?
                I believe that will work.
                RayNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by giulyko00, Today, 12:03 PM
                0 responses
                2 views
                0 likes
                Last Post giulyko00  
                Started by AttiM, 02-14-2024, 05:20 PM
                12 responses
                213 views
                0 likes
                Last Post DrakeiJosh  
                Started by cre8able, 02-11-2023, 05:43 PM
                3 responses
                238 views
                0 likes
                Last Post rhubear
                by rhubear
                 
                Started by frslvr, 04-11-2024, 07:26 AM
                8 responses
                117 views
                1 like
                Last Post NinjaTrader_BrandonH  
                Started by stafe, 04-15-2024, 08:34 PM
                10 responses
                47 views
                0 likes
                Last Post stafe
                by stafe
                 
                Working...
                X