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

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.
    Kate W.NinjaTrader Customer Service

    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.


        JimNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by pechtri, 06-22-2023, 02:31 AM
        8 responses
        122 views
        0 likes
        Last Post Nyman
        by Nyman
         
        Started by frankthearm, 04-18-2024, 09:08 AM
        16 responses
        64 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by habeebft, Today, 01:18 PM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by benmarkal, Today, 12:52 PM
        2 responses
        13 views
        0 likes
        Last Post benmarkal  
        Started by f.saeidi, Today, 01:38 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X