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

Modifying Time And Sales...

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

    Modifying Time And Sales...

    I would like to modify the T&S window to display the cumulative trades as they scroll by For instance, if 10 trades fired off at bid, I would like to display that total as opposed to each individual. Would I do this as an "AddOn"? Can I modify an existing T&S window as opposed to reinventing the wheel?

    #2
    Hello funk101,


    I have submitted a feature request to the product management team for the following feature :
    This user would like to be able to add customizable columns to the T&S window, similar to MarketAnalyzerColumns
    I will follow up with more information as soon as it's available. If the feature requests already exists, a vote will be added to it.

    I am also preparing a starter sample for the T&S window which will allow you to access it from an add-on.

    Please let us know if there are any other ways we can help.
    Jessica P.NinjaTrader Customer Service

    Comment


      #3
      Thank you for the starter template looking forward to it. However, as far as the feature request, adding a column will not achieve the same result as I am requesting if you think about it. I think the data has to be accumulated before it is displayed, adding a column would just, well, add a column to each individual trade. Maybe I'm missing something? Anyway, thanks for the template.

      Comment


        #4
        I would be happy to clarify my intent with this feature request. With the ability to add a column, you could run a simple check to see if the previous row was the same type of trade as the current row, and if this was the case, you could accumulate data from the previous row into this row's data and display it. For instance, if 10 trades occurred at the bid, and then 10 more, and then 8 more, before 10+ trades occurred at the ask, and your block size is 10, you would be able to display information for all 38 trades at the bid in a single cell. The information for the 1st 10 trades would appear in this row for the first 10 trades at bid, the first 20 trades in the 2nd row, and all 38 trades in the third row.
        Jessica P.NinjaTrader Customer Service

        Comment


          #5
          BAM! You rock, thanks.

          Comment


            #6
            Thank you funk101. The attached indicator should help you get started investigating what can be done through an add-on with the T&S window.
            Attached Files
            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              This is awesome, but I have no clue where to begin. This code will sort of "override" the existing T&S window? Is there anything you can point me to that I can reverse engineer? Like the T&S code where it get's the marketdata, etc? Not used to seeing this code in NT. Not as familiar as the DrawingTools, or Indicator base code.

              Comment


                #8
                I would be happy to walk through this code.

                Add-ons have a method OnWindow that is created whenever any kind of window is created. This code tries to see if the created window is a Time and Sales window and, if it is, it sets up another process OnTnSWindow to be called once a second. If you would like this to happen more often, I have defined the constants ONE_US, ONE_MS, and ONE_S to represent one microsecond, one millisecond, and one second, respectively. For example, 100 milliseconds would be 100 * ONE_MS . You would make this change on line 81.

                At any rate, inside the method OnTnSWindow, I have used the instructions my colleague Jesse put together here, http://ninjatrader.com/support/forum...44&postcount=7 , to dissect the various parts of the Time and Sales window itself, and I have made them available to you. For example, myTimeAndSalesAskPriceText allows you to read or modify the Ask price at the top of the Time and Sales window.

                This is as far as I have gone with this script. It is intended as a sort of a blank canvas you can use to decide how you would like the Time and Sales window to be displayed. As an exercise to get you familiar with using add-ons of this type, and to help you modify the time and sales window however you see fit, I would like to recommend you review the publicly available MSDN documentation on System.Windows.Controls.TextBlock at this link,



                With that documentation, I would then add code to this add-on after line 125 like the following :

                Code:
                            if (null != myTimeAndSalesBidPriceText)
                            {
                                myTimeAndSalesBidPriceText.Text += " and a nickel";
                            }
                You can see this addition in the attached picture. I have attached the revised code as well. This is probably the best place to start reverse engineering from.
                Attached Files
                Jessica P.NinjaTrader Customer Service

                Comment


                  #9
                  Hmm, Ok, thanks for that, but I don't see that when I compile that example code. Nothing changes. I must be missing something

                  Comment


                    #10
                    You will need to have data coming in to the T&S window for this to work I have made a video going over everything in my most recent post. Please let me know if any questions come up I may answer.

                    Jessica P.NinjaTrader Customer Service

                    Comment


                      #11
                      I have data coming in, I watched the screen cast, I still don't see the added text. I've tried restarting NT, pulling up new T&S windows, etc What could I be missing? Running your code as is, should show up as in your screen cast, right?

                      Comment


                        #12
                        I realize that I made a typo with the first version of my script that is not in the second version of my script. If you have not already, please use the second version of my script completely, or copy / paste the following over your existing OnTnSWindow method.

                        Code:
                        [FONT=Courier New]
                        private static void OnTnSWindow(object s, WindowEventArgs e)
                                {
                                    Gui.TimeAndSales.TimeAndSalesControl myTnSControl =
                                        e.Window.FindFirst("TimeAndSalesControl")
                                        as Gui.TimeAndSales.TimeAndSalesControl;
                                    System.Windows.Controls.TabControl myTimeAndSalesTabControl =
                                        e.Window.FindFirst("TimeAndSalesTabControl")
                                        as System.Windows.Controls.TabControl;
                                    System.Windows.Controls.TextBlock myTimeAndSalesAskText =
                                        e.Window.FindFirst("TimeAndSalesAskText")
                                        as System.Windows.Controls.TextBlock;
                                    System.Windows.Controls.TextBlock myTimeAndSalesBidText =
                                        e.Window.FindFirst("TimeAndSalesBidText")
                                        as System.Windows.Controls.TextBlock;
                                    System.Windows.Controls.TextBlock myTimeAndSalesAskPriceText =
                                        e.Window.FindFirst("TimeAndSalesControlAskPriceText")
                                        as System.Windows.Controls.TextBlock;
                                    System.Windows.Controls.TextBlock myTimeAndSalesAskSizeText =
                                        e.Window.FindFirst("TimeAndSalesControlAskSizeText")
                                        as System.Windows.Controls.TextBlock;
                                    System.Windows.Controls.TextBlock myTimeAndSalesBidPriceText =
                                        e.Window.FindFirst("TimeAndSalesControlBidPriceText")
                                        as System.Windows.Controls.TextBlock;
                                    System.Windows.Controls.TextBlock myTimeAndSalesBidSizeText =
                                        e.Window.FindFirst("TimeAndSalesControlBidSizeText")
                                        as System.Windows.Controls.TextBlock;
                        
                                    if (null != myTimeAndSalesBidPriceText)
                                    {
                                        myTimeAndSalesBidPriceText.Text += " and a nickel";
                                    }
                                }[/FONT]
                        Jessica P.NinjaTrader Customer Service

                        Comment


                          #13
                          Yes! Works now, thank you.

                          Comment


                            #14
                            I'm kind of reviving this thread because I pulled this code to access TnS "source code".

                            Firstly, I'm wondering if there is a better way to do this now since it's been a few years.

                            If this is still the best way to pull the data, I am trying to build the orderflow labs "bubble tape" kind of thing that I've seen.

                            My first question being, is it possible to take in an integer (size of last trade) and then output a shape of some kind? And then have the size and color of said shape be dependent on trade size and direction (at bid/ask).

                            Also having thought about it some more, would the size of these shapes possibly cause ninja to break if the size isn't restricted to the given row on the times and sales?

                            Thank you for any help

                            Comment


                              #15
                              Hello Entropy7,

                              Thanks for your note.

                              We are looking into your inquiry at this time and will get back to you with more information as soon as we have researched this topic further.

                              Thanks for your patience. I look forward to further assisting.
                              Brandon H.NinjaTrader Customer Service

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by rtwave, 04-12-2024, 09:30 AM
                              2 responses
                              19 views
                              0 likes
                              Last Post rtwave
                              by rtwave
                               
                              Started by tsantospinto, 04-12-2024, 07:04 PM
                              5 responses
                              67 views
                              0 likes
                              Last Post tsantospinto  
                              Started by cre8able, Today, 03:20 PM
                              0 responses
                              6 views
                              0 likes
                              Last Post cre8able  
                              Started by Fran888, 02-16-2024, 10:48 AM
                              3 responses
                              49 views
                              0 likes
                              Last Post Sam2515
                              by Sam2515
                               
                              Started by martin70, 03-24-2023, 04:58 AM
                              15 responses
                              115 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Working...
                              X