Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Addon with MarketDepth

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

    Addon with MarketDepth

    Hello.

    This Add-on displays the Ask side of the DOM. Video with the Addon running:
    Free online storage and sharing with Screencast.com. 2 GB of storage and 2 GB of bandwidth per month for free. We won't compress, alter or take ownership of your content.


    It is based on SampleAddon from NinjaTrader_Jesse:


    When I create a new tab page looks like if past data remain on memory. ES 12-15 must have ten ladders, but has twenty.
    This bug doesn't occurs when the addon starts, but when a new tab page is created.
    (If an addon is already displayed and a new addon is created, the bug appears too.)


    Snapshots from the debugging:

    Here is when the addon is created for first time. marketDepth.Asks.Count = 0. Correct.





    Here the following times. marketDepth.Asks.Count = 20. Incorrect.




    I attach the code.

    Thanks.
    Attached Files
    Last edited by cls71; 10-26-2015, 03:27 AM. Reason: Attach the Addon code

    #2
    Hello,

    I am currently looking through the code to see how this could be happening. Based on the video I do see how the list was "duplicated", I am unsure if this was the underlying collection that contained more items at that time or if this is the way the DataGrid is being refreshed manually/time it is refreshed.

    It appears the underlying collections are not notifying on collection changed events so this would likely be why you are using Items.Refresh(), I am unsure if that is also connected here. I will post back once I have had further time to research this.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hello,

      I looked over the code but have been unable reproduce this on my end.

      I tried using a Observable collection rather than the actual collection to prevent using Refresh arbitrarily, I would like to see if you could try this approach instead and see if you still have the same outcome.

      Rather than setting the ItemSource directly to the Ask collection, I had added the following code:


      Code:
      private ObservableCollection<MarketDepthRow> askCollection = new ObservableCollection<MarketDepthRow>();
      Code:
      datagridAsks.ItemsSource = askCollection;

      Code:
      private void marketDepth_Update(object sender, MarketDepthEventArgs e)
      {
      	if(e.MarketDataType == MarketDataType.Ask )
      	{
                    askCollection.Clear();
      	      foreach (MarketDepthRow marketDepthRow in marketDepth.Asks)
      	      {
                         askCollection.Add(marketDepthRow);
                      }
      	}
      }
      Rather than having to manually reload the datagrid, this would notify the grid of the changes in the collection each time it is updated. I have not had any duplication of the list using either method, this would just be another way of accomplishing the same task although this uses the standard notify approach.

      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #4
        Yes, the outcome is correct now. The original code works well also.
        Maybe the issue was only with beta5. I don't remember if I did with beta5 or beta6, sorry.

        Thanks very much.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by elderan, Yesterday, 08:03 PM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by samish18, Yesterday, 08:57 AM
        8 responses
        25 views
        0 likes
        Last Post samish18  
        Started by DJ888, 04-16-2024, 06:09 PM
        3 responses
        10 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by RookieTrader, Today, 07:41 AM
        0 responses
        3 views
        0 likes
        Last Post RookieTrader  
        Started by maybeimnotrader, Yesterday, 05:46 PM
        1 response
        19 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X