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

T&S and DOM

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

    T&S and DOM

    Why are the time and sales last buys and sells different than the DOM's last buys and sales? Note: T&S doesn't have a size filter.

    #2
    Hello mlprice12,

    Thank you for the message.

    Who are you connecting to for Market Data?

    What instrument are you looking at?

    Please take a screenshot that includes both the SuperDOM and T & S Window so we may see what the windows look like.
    • If you are unsure of how to take a screenshot, I recommend using the Windows Snipping tool.
    • Click on the Windows Icon at the bottom of your screen and type the word "Snip"
    • Click on the Snipping tool, click New, then click and drag around the area you want to screenshot
    • Click File > Save As > Save the screenshot where you can find it
    • Please click here for a video demonstration
    Clayton G.NinjaTrader Customer Service

    Comment


      #3
      Thanks Clayton,

      Connected through Ninjatrader Continuum.
      Looking at the ES.
      Here is some code to show how last buy vol is calculated on DOM
      Code:
      if (aggressor == TradeAggressor.BUYER)
      {
      Trade oldTrade;
      bool gotOldTrade = SlidingWindowBuys.TryGetValue(close, out oldTrade);
      
      Trade trade = new Trade();
      trade.Ask = ask;
      trade.Time = time;
      
      if (gotOldTrade)
      {
      trade.Size = oldTrade.Size + volume;
      }
      else
      {
      trade.Size = volume;
      }
      
      if (updateSlidingWindow)
      {
      SlidingWindowBuys.AddOrUpdate(close, trade, (price, existingTrade) => existingTrade = trade);
      }
      TotalBuys.AddOrUpdate(close, volume, (price, oldVolume) => oldVolume + volume);
      }
      Code:
      internal long GetBuysInSlidingWindow()
      {
      long total = 0;
      foreach (Trade trade in SlidingWindowBuys.Values)
      {
      total += trade.Size;
      }
      return total;
      }
      Attachments show (circled) last Buy/Sell volume and if you look to the right T&S (filtered to 9 and over size) these volumes aren't listed.
      Attached Files

      Comment


        #4
        Hello mlprice12,

        Thank you for the update.

        Could you please provide more information on the Windows you are using from NinjaTrader and if these are default NinjaTrader Windows and Indicators or if they are 3rd party NinjaScripts or from another program?
        • The windows within the screenshots you provided do not look like Default NinjaTrader Windows.
        • Here is what the SuperDOM and T & S window look like within NinjaTrader for comparison
          • Click image for larger version

Name:	LT139a.png
Views:	540
Size:	77.6 KB
ID:	1187080

        Are the windows in your screenshot windows provided by the Default NinjaTrader platform? Are these a 3rd party add-on? Are these another trading platform?


        As well, you have provided some code with your last response to show how something is calculated. Is this a NinjaScript you are working on for NinjaTrader?


        Clayton G.NinjaTrader Customer Service

        Comment


          #5
          The screenshot is from another platform but it occurs with my Ninjatrader platform as well.

          The time and sales is default ninjatrader and the DOM column is (code I shared) is a 3rd party addon for ninjatrader.

          Comment


            #6
            Hello mlprice12,

            Thank you for the update.

            Within the NinjaTrader platform, we would expect for the Default NinjaTrader SuperDOM and T & S Window to line up like my previously submitted screenshot.

            Providing us screenshots of another program that has some odd behavior similar to what you are seeing in NinjaTrader does not help us provide further information on what is happening within NinjaTrader.
            • We would need a screenshot of this behavior happening within NinjaTrader windows specifically
            • The NinjaTrader Platform Support Team only has documentation on NinjaTrader and we \have no documentation on why another trading platform could look the way it does in your screenshot

            If you are comparing the values of a 3rd party add-on to something within NinjaTrader and it is not lining up as expected, you would need to reach out to the developer of the add-on and ask them why it is behaving that way and what needs to be done.
            • If you are working on creating a NinjaScript Strategy yourself, please let us know so we may provide more information. If you got this NinjaScript from someone else, please reach out to them for further information on the NinjaScript

            If you open a NinjaTrader SuperDOM window and NinjaTrader T & S Window set to the same instrument, do they line up? If not, please take a screenshot of them and include that in your response.
            Clayton G.NinjaTrader Customer Service

            Comment


              #7
              Does time and sales record all trade data or is some trade data hidden from T&S?

              Why would my ninjascript that's set to print last trade volume on the bid and last trade volume on the ask be different than the T&S buy sell data?
              Or is the last traded volume from my ninjascript printing a value of combined trade volume if multiple trades are hitting at the same price at the same second?
              Code:
              internal Trade GetBuysInSlidingWindow(double price)
              {
              Trade trade = null;
              SlidingWindowBuys.TryGetValue(price, out trade);
              return trade;
              }
              
              internal Trade GetSellsInSlidingWindow(double price)
              {
              Trade trade = null;
              SlidingWindowSells.TryGetValue(price, out trade);
              return trade;
              }
              
              internal long GetLastBuySize(double price)
              {
              long lastSize = 0;
              
              Trade current = GetBuysInSlidingWindow(price);
              if (current != null && current.Size > 0) {
              
              long prevSize;
              if (LastBuy.TryGetValue(price, out prevSize))
              {
              lastSize = current.Size - prevSize;
              }
              
              long oldValue;
              LastBuy.TryRemove(price, out oldValue);
              LastBuy.TryAdd(price, current.Size);
              }
              return lastSize;
              }
              
              internal long GetLastSellSize(double price)
              {
              long lastSize = 0;
              
              Trade current = GetSellsInSlidingWindow(price);
              if (current != null && current.Size > 0)
              {
              
              long prevSize;
              if (LastSell.TryGetValue(price, out prevSize))
              {
              lastSize = current.Size - prevSize;
              }
              
              long oldValue;
              LastSell.TryRemove(price, out oldValue);
              LastSell.TryAdd(price, current.Size);
              }
              return lastSize;
              }
              Thanks for your insight
              Last edited by mlprice12; 01-25-2022, 06:54 PM.

              Comment


                #8
                Hello mlprice,

                We have moved this thread to our NinjaScript Development forums since it sounds like you are talking about your own DOM NinjaScript being out of sync with NinjaTrader Time and Sales reports.

                I cannot give much comment on why your results are showing differently with what is available, but I would like to make the following points:
                1. Different windows have different refresh intervals, What you are looking at in a Time and Sales window may not be the same as what you see in the SuperDOM
                2. Before splitting trades Last ticks into buys and sells, are you looking at the same report of Bid/Ask and Last prices when reading the level 1 data? If Identifying buys/sells, the bid/ask associated with the Last tick should be used
                It also isn't exactly clear if you are comparing Level 2 data with Level 1 data, or comparing L2 with L2 and L1 with L1. Are you using an OnMarketData feed and are you comparing this with Time and Sales? Since that would be L1 vs. L1, I think you would be able to get the same Last ticks and Bid/Ask prices as the Time and Sales window.

                We look forward to assisting.
                JimNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by gentlebenthebear, Today, 01:30 AM
                1 response
                8 views
                0 likes
                Last Post NinjaTrader_Jesse  
                Started by Aviram Y, Today, 05:29 AM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by cls71, Today, 04:45 AM
                1 response
                7 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by TradeForge, Today, 02:09 AM
                1 response
                22 views
                0 likes
                Last Post NinjaTrader_ChelseaB  
                Started by elirion, Today, 01:36 AM
                2 responses
                14 views
                0 likes
                Last Post elirion
                by elirion
                 
                Working...
                X