Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Missing Updates?

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

    Missing Updates?

    Hi,

    I am using the following code to print changes using OnMarketData and it appears as though it is missing some changes, is this expected or is there something wrong with my code?

    Code:
    protected override void OnMarketData(MarketDataEventArgs e)
            {    
                if (e.MarketDataType == MarketDataType.Ask)askPrice     = e.Price; 
                
                if (e.MarketDataType == MarketDataType.Ask)askVol         = e.Volume; 
                    
                if (e.MarketDataType == MarketDataType.Bid)bidPrice     = e.Price;
            
                if (e.MarketDataType == MarketDataType.Bid)bidVol         = e.Volume;
                    
                if (e.MarketDataType == MarketDataType.Last)lastPrice     = e.Price;
                
                if (e.MarketDataType == MarketDataType.Last)lastVol     = e.Volume;
                
                if (e.MarketDataType != MarketDataType.Last)return;
                    
                {
                    if(storeBid != bidPrice)
                    {
                    storeBid = bidPrice;
                    storeBV = bidVol;
                    }
                    
                    else if(storeBid == bidPrice) 
                    {
                    storeBV = bidVol;
                    Print("StoreBV = " + storeBV + " @ " + bidPrice + " Time " + Time[0]);
                    }
                }    
            }
    Regards,
    suprsnipes

    #2
    Can you please clarify why you feel it is missing some updates? How did you determine this?
    MatthewNinjaTrader Product Management

    Comment


      #3
      Hi, thanks for your response,

      I am referring to the changes in (e.MarketDataType == MarketDataType.Bid)bidVol = e.Volume. When I print directlly under this line of code I can see that the prints reflect the current bid correctly but I'm wondering why my code in the original post does not show the current bid, it seems to miss a great number of changes.

      What I am trying to do is store each change in bid volume when the price has not changed could you please let me know how I can fix this or what I may be doing wrong.

      Regards,
      suprsnipes

      Comment


        #4
        I'm sorry I'm not quite following - when I run your code and compare it to the T&S window, I'm getting the current bid price.

        Where are you comparing the current bid when you determine it is not matching?
        MatthewNinjaTrader Product Management

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        579 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        334 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        101 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        551 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X