Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Current Inside Bid - Offer

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

    Current Inside Bid - Offer

    Hi,

    short question,

    what whould be the most efficient and reliable way to get the current inside bid and offer price in OnMarketData() and OnMarketDepth()?

    is it useful to use GetCurrentAsk(), GetCurrentBid()?

    When are those methods updated, are they updated depending on the method from which they are called? e.g. calling GetCurrentAsk() from OnMarketData whould mean it is updated by each MarketData event, or if not, when is it updated?

    is there maybe a better way to get the current inside market prices using OnMarketData and OnMarketDepth?

    regards

    #2
    Hello keepsimple

    OnMarketData is Level I data; this would be the inside row of Level II data.

    OnMarketDepth is Level II data; this would be all ten rows of ask and all ten rows of bid.

    GetCurrentAsk() / GetCurrentBid() will get the last update of OnMarketData and are useful when calling this from any method that is not OnMarketData or OnMarketDepth such as from OnBarUpdate when you need a quick snapshot of the current ask or bid price.

    GetCurrentAsk() - http://ninjatrader.com/support/helpG...currentask.htm
    GetCurrentBid() - http://ninjatrader.com/support/helpG...currentbid.htm
    OnMarketData() - http://ninjatrader.com/support/helpG...marketdata.htm
    OnMarketDepth() - http://ninjatrader.com/support/helpG...arketdepth.htm
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thanks Chelsea,

      so, getting the inside ask / bid inside OnMarketData without using GetCurrentAsk() / Bid()
      whould require the use of a variable to store the last ask / bid event I think?

      If Type == Ask => variable = ask;

      is this correct, or is there another way of doing that?

      How whould i do that using OnDepth?

      I am asking so detailed, because I tried several ways and I really need that to be precise.

      regards

      Comment


        #4
        Hello keepsimple,

        This would depend on what you are trying to do.

        If you want to submit an order from OnMarketData you could use the e.Price without saving this to a variable.

        If you want to use the value later or in another method, then you would need to save the value to a variable.

        Below is a link to an example called TnSPrints that demonstrates using OnMarketData. This is made for NT7, but the behavior is the same in NT8.


        Also, below is a link to a reference sample demonstrating how to use OnMarketDepth.
        Last edited by NinjaTrader_ChelseaB; 11-02-2016, 11:08 AM.
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          Thanks Chelsea,

          great help as always, last question, specifically what i am trying to do, is accumulating the traded volume as long as the inside bid ask does not change, if the inside bid ask changes to a new price, i want to reset the volume which traded there to 0 and start a new accumulation on that price. so my question is stated otherwise, is it as reliable using GetCurrentAsk() to store the last inside bid ask as storing inside OnMarketData via a variable?

          regards

          Comment


            #6
            Hello keepsimple,

            OnMarketData and GetCurrentAsk/GetCurrentBid/GetCurrentAskVolume/GetCurrentBidVolume return the same information. One updates for every market data event, the other gives you a snapshot of the last event when called.

            The reliability of these are the same. The data provided by these are the same.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thanks a lot.

              Regards

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by judysamnt7, 03-13-2023, 09:11 AM
              4 responses
              59 views
              0 likes
              Last Post DynamicTest  
              Started by ScottWalsh, Today, 06:52 PM
              4 responses
              36 views
              0 likes
              Last Post ScottWalsh  
              Started by olisav57, Today, 07:39 PM
              0 responses
              7 views
              0 likes
              Last Post olisav57  
              Started by trilliantrader, Today, 03:01 PM
              2 responses
              21 views
              0 likes
              Last Post helpwanted  
              Started by cre8able, Today, 07:24 PM
              0 responses
              10 views
              0 likes
              Last Post cre8able  
              Working...
              X