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

Correct sequence of trade event

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

    Correct sequence of trade event

    Dear Support,
    I have read a lot of documentation about Ninjatrader 8 elaborates the tick data process to have the best available resolution.

    So I understand that Ninjatrader 8 support historical and real tick data till the microsecond resolution, link below:
    https://ninjatrader.com/blog/new-dat...ninjatrader-8/

    But f I try to print it in ninjascript output window I have:

    Case 1: HH:mm:ss.fff (3 decimals)
    Time: 12.00.00.125 (only millisecond resolution)

    Case 2 HH:mm:ss.fffffff (7 decimals)
    Time: 12.00.00.1250000 (always only millisecond resolution)

    Same thing in the integrted Time and Sales window.

    So, I mean that this problem depends from my datafeed (CQG), that doesn’t provide this information.
    Right?
    How can I be sure that 5 ticks with the same millisecond time stamp are in the correct sequence?

    I also read this:

    https://ninjatrader.com/support/foru...-1-microsecond

    But if I have 5 ticks with the same millisecond, and no other informations about this, how can I be sure of which tick was the first trade event and the last trade event in the same millisecond?
    Moreover, I read this:

    https://ninjatrader.com/support/foru...683-nt8-tickid

    If what I mean is correct this method should be prevent the problem of the correct sequence of ticks with the same millisecond timestamp, but this is not available at the moment, see below:

    https://ninjatrader.com/support/foru...683-nt8-tickid

    So, the only way to have the correct sequence of trade is use two methods:

    1 – Microsecond resolution timestamp
    2 – Unique identifier

    But both the two methods are not available at the moment

    How can I do an indicator for the delta calculation if the correct sequence is not sure?

    I use OnMarketData event to do this and seem to work correctly, but I think that this is an approximation.
    My indicators are equal to other indicators of third parts, so I’m sure that it works correctly.

    I need to know with what logic the tick trade event are sorted.

    Thank you for your support, best regards

    Andrea
    Last edited by AndreaBhs; 04-11-2020, 12:33 PM.

    #2
    Hello AndreaBhs,

    I'm not sure that this blog post is saying that your real-time data provider will be providing data with that granularity. From my understanding real-time and historical data has microsecond granularity sent by most providers including CQG/Continuum and Kinetick.

    The platform may be capable of processing 100 nano second granularity values in .NET but I don't this would mean that real-time data providers actually provide this.


    NinjaTrader processes the ticks in the order they are received, also in historical data.
    I'm working on a strategy using Calculate.OnBarClose using a data series with a 1 tick resolution. I have a case where there are an influx of 298 ticks with the same timestamp 18:17:51.789... The price range during that event is 17.420 to 17.310... During real time processing does Ninjatrader actually wait to process each tick


    When you mention:
    "But if I have 5 ticks with the same millisecond, and no other informations about this, how can I be sure of which tick was the first trade event and the last trade event in the same millisecond?"

    I'm not sure what you are asking. Are you asking how to know which tick will be the last tick? The ticks will be processed in order. So the last tick processed with that time stamp would be the last tick..

    You are wanting the delta of the price of the first tick with that time stamp and the price of the last tick of that timestamp?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Hello Chelsea,

      Thank you for your reply, I'm try to explain better. In the post that you linked I can read this:

      "Historical data (processing data that is already on the chart, backtesting, optimizing) is processed chronologically based on the bar timestamps."

      So, my question is, when I receive a lot of tick with the same timestamp, can you ensure the order in which they are processed is correct?

      Example:

      1° tick - 100,00 - 16:45:00.123 - Volume 1 - Bid
      2° tick - 100,00 - 16:45:00.123 - Volume 2 - Bid
      3° tick - 100,01 - 16:45:00.123 - Volume 2 - Ask
      4° tick - 100,02 - 16:45:00.123 - Volume 5 - Ask
      5° tick - 100,00 - 16:45:00.123 - Volume 1 - Ask

      In this case we have 5 tick, that have prices, volume and side different.
      You know that in fast market moment we can have a lot of tick in the same millisecond.

      If the process is based on their timestamps, and the timestamp is not unique for a single tick, but for all the tick in that moment, you can ensure always correct sequence?
      In which mode?

      Please, see attached picture.
      In this case we have 63 tick with a total of 81 contracts. Some tick hit Bid side, some tick hit Ask Side. Price changes level many times. Timestamp is the same, 21:50:00.117 for all ticks between the two blue vertical lines.

      So my question is, you (Ninjatrader 8) can ensure that this is the order in which these ticks are received and then plotted on chart? Always?
      Or inside the same tick the order could be different sometimes?

      Example:

      1° tick - 100,02 - 16:45:00.123 - Volume 5 - Ask (in the previour example this was the 4th tick)
      2° tick - 100,00 - 16:45:00.123 - Volume 2 - Bid
      3° tick - 100,01 - 16:45:00.123 - Volume 2 - Ask
      4° tick - 100,00 - 16:45:00.123 - Volume 1 - Bid (in the previous example this was the first tick)
      5° tick - 100,00 - 16:45:00.123 - Volume 1 - Ask

      About this:
      "You are wanting the delta of the price of the first tick with that time stamp and the price of the last tick of that timestamp?"

      No, I'm able to use OnMarketDataEvent to know if Bid or Ask are hit (using Ask Vs Bid mode) or if the tick is an UpTick or DownTick (using OnBarClose adding a 1 tick series)

      My only question was about the correct sequence.

      Thanks a lot for your support!!

      Best Regards

      Andrea







      Attached Files

      Comment


        #4
        Hello Andrea,

        The data is processed in real-time in the order these are transmitted in.

        This is processed synchronously not asynchronously.

        You could look at the prints from NinjaTrader and then call the data provider and ask what sequence they transmitted the data in if you are not trusting our answer.

        Chelsea B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by bigc0220, 09-18-2018, 09:16 AM
        6 responses
        2,579 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by lorem, 04-25-2024, 09:18 AM
        18 responses
        76 views
        0 likes
        Last Post lorem
        by lorem
         
        Started by joselube001, 05-10-2024, 12:17 PM
        4 responses
        20 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by DawnTreader, 05-08-2024, 05:58 PM
        21 responses
        81 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by doihaveto13, Today, 12:46 PM
        2 responses
        4 views
        0 likes
        Last Post doihaveto13  
        Working...
        X