Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketData(MarketDataEventArgs e): Price, Last, Bid, Ask - what are they?

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

    OnMarketData(MarketDataEventArgs e): Price, Last, Bid, Ask - what are they?

    On every call to OnMarketData properties Price, Last, Bid, Ask are set to some values.
    From examples in other threads I take that the Price has the value for the corresponding event type (i.e. Last, Bid, Ask)
    Hence the question: what are the three other values in MarketDataEventArgs?
    What I've noticed:
    - In case of Bid event Bid property not always equals to Price or Last properties and Price not always equals Last
    - In case of Ask event Ask property not always equals to Price or Last properties and Price not always equals Last
    - In case of Last event Price property not always equals to Last property

    How does all of this make any sense?

    #2
    Hello searope,

    Thank you for your post.

    OnMarketData is the Level 1 feed, where you see completed Last trades, Best Bid's, Best Ask's, and other data point items that can be found in MarketDataEventArgs.

    To keep it simple, just focus on:
    • Best Bid: marketDataType.Bid updates
    • Best Ask: marketDataType.Ask updates
    • and Last: marketDataType.Last updates (completed trades.)
    When MarketDataType.Bid updates, Price is the price of that Best Bid update, Volume represents the number of contracts at the bid.

    When MarketDataType.Askupdates, Price is the price of that Best Ask update, Volume represents the number of contracts at the asl.

    When MarketDataType.Last updates, Price is the price where the transition occurred, and Volume represents the number of contracts sold. Bis and Ask represent the best bid and best ask prices at the time the trade was made. (We can compare Bid/Ask and Last prices to see if a MarketDataType.Last update was a buy/sell).

    Please let us know if we may be of further assistance to you.

    Comment


      #3
      Thanks for the quick response.
      Do you mean I can ignore Last, Bid and Ask properties in case of Bid or Ask events?
      And in case Last event, I can ignore Last property?
      If this is the case, setting ignored properties to 0, or better yet make them nullable and set to null will make more sense.

      Comment


        #4
        Hello searope,

        I am not sure if I may suggest what to ignore for your purposes, but if it helps for clarity:

        The Best Bid and Best Ask price can be retrieved from the marketDataTypeArgs.Bid and marketDataTypeArgs.Ask properties.

        NinjaTrader uses bid/ask stamped ticks and we can get the best bid/best ask by accessing these properties on marketDataTypeArgs.MarketDataType.Last updates. This is how BuySellVolume works.

        If you need actions to happen on the each Bid event or Ask update (not a completed trade) you would then use the marketDataTypeArgs.MarketDataType.Bid and marketDataTypeArgs.MarketDataType.Ask updates.


        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        646 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        367 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        107 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        569 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        573 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X