• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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,

                https://msdn.microsoft.com/en-us/lib...textblock.aspx

                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.

                    https://www.screencast.com/t/6Ff63WbWHOq
                    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:
                        
                        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";
                                    }
                                }
                        Jessica P.NinjaTrader Customer Service

                        Comment


                          #13
                          Yes! Works now, thank you.

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by ballboy11, Today, 05:22 PM
                          0 responses
                          3 views
                          0 likes
                          Last Post ballboy11  
                          Started by ballboy11, Today, 04:33 PM
                          2 responses
                          4 views
                          0 likes
                          Last Post ballboy11  
                          Started by dedouglas, Today, 03:16 PM
                          1 response
                          7 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Started by TradeMyth, Today, 02:45 PM
                          3 responses
                          26 views
                          0 likes
                          Last Post NinjaTrader_ChelseaB  
                          Started by Ticnician, Today, 01:46 PM
                          1 response
                          9 views
                          0 likes
                          Last Post NinjaTrader_Jim  
                          Working...
                          X