• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

When Calling GetCurrentBid() what is happening?

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

    When Calling GetCurrentBid() what is happening?

    Hi,

    What is happening (behind the scenes) when I call GetCurrentBid()/GetCurrentBidVolume()?
    Does it actively check the market or just check a parameter that was updated in the last market update?

    One more question if I Add Add(xxx, PeriodType.Second, 1, MarketDataType.Bid);
    Can I check GetCurrentBid()/GetCurrentAsk() the same as for MarketDataType.Last?

    Thanks!

    #2
    freewind, the GetCurrentBid / Ask functions are tied to the bar updates processing, so it would not be the exact same event as working for example from OnMarketData, solely updating when the Level 1 change event is seen.

    I don't fully follow the second question, you can add Last / Bid / Ask data with this add series call and if your dataprovider supports it, you can access historical series data then (in contrast to the GetCurrent functions that would see the Close price substituted in here).
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Hi Bertrand,

      So what is the best way to get the most accurate Bid/Ask Prices and quantity? Keeping it within OMarketData or using GeCurrentBid() ?

      My second question is if I add a bid barseries for example BIP == 1 can I use GetCurrentAsk(1) ?

      TX!

      Comment


        #4
        Accurate is relative, it depends on which events you would want to act / calculate.

        All true level 1 data updating events would be best handled in OnMarketData directly, as the Get functions will only be tied to the bar updates.

        You can call the Get functions with an index passed in, however for any tries to align trades with bid / ask you would need to keep in mind the timestamp granularity is limited to a second (which is considered for enhancement to millisecond for our next major update).
        BertrandNinjaTrader Customer Service

        Comment


          #5
          If I add two bid/ask series of the same product
          Add(ES 09-13, PeriodType.Second, 1, MarketDataType.Bid);
          Add(ES 09-13, PeriodType.Second, 1, MarketDataType.Ask);

          and in OnMarketUpdate:

          Code:
          protected override void OnMarketData(MarketDataEventArgs e)
                  {
                    
                       if(BarsInProgress == ESAskIndex)
          
          {
                          if (e.MarketDataType == MarketDataType.Last)
                              Print("Last = " + e.Price + " " + e.Volume);
                          else if (e.MarketDataType == MarketDataType.Ask)
                              Print("Ask = " + e.Price + " " + e.Volume);
                          else if (e.MarketDataType == MarketDataType.Bid)
                              Print("Bid = " + e.Price + " " + e.Volume);
          }
                      }
          Do I need to check also for the BIP ESBidIndex, or using ESAskIndex I'll get also bid updates?

          Comment


            #6
            You would not need to add those series in to have access to bid / ask events in OnMarketData() for the ES. The adding in would be strictly done for historical access of those series in OnBarUpdate().

            For BIP filters in OnMarketData, with multi-time frame and instrument strategies, OnMarketData() will be called for all unique instruments in your strategy. Use the BarsInProgress to filter the OnMarketData() method for a specific instrument. (BarsInProgress will return the first BarsInProgress series that matches the instrument for the event)
            BertrandNinjaTrader Customer Service

            Comment


              #7
              I didn't fully understand the second paragraph.
              If I have multi-time frame for a signal instrument which BIP should I check for in the OnMarketData, or it is not matter because all of them will be triggered one after the other?

              Comment


                #8
                It would only be important if you added more than one instrument, so you can differentiate between those. If you have only one instrument > the events would be triggered whenever they trigger / report.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  OK, but and if I have multi-frame multi instrument which BIP should I check for in the OnMarketData to separate the different instruments?

                  Thanks again for the great support!

                  Comment


                    #10
                    Just use the first one that would be for a different instrument. Let's say you add 4 frames besides the primary in and then a series on another instrument > that would be then BIP 6 (primary + 4 adds + 1)
                    BertrandNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by priceisking, Today, 12:51 PM
                    1 response
                    7 views
                    0 likes
                    Last Post NinjaTrader_PaulH  
                    Started by chartish, Today, 10:33 AM
                    3 responses
                    17 views
                    0 likes
                    Last Post chartish  
                    Started by casabella, Today, 11:51 AM
                    1 response
                    6 views
                    0 likes
                    Last Post NinjaTrader_PaulH  
                    Started by Johnny, Today, 11:42 AM
                    1 response
                    13 views
                    0 likes
                    Last Post NinjaTrader_Jermaine  
                    Started by habibalex, Today, 09:03 AM
                    2 responses
                    14 views
                    0 likes
                    Last Post sledge
                    by sledge
                     
                    Working...
                    X