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

Does the bid/ask still hold accumulated resting orders?

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

    Does the bid/ask still hold accumulated resting orders?

    Hi all,

    Back in 2018, for NT7, someone clarified that the volume on a historical bid and ask series is not the traded volume, but the accumulated resting order volume-at-price over the bar's time period.

    See https://forum.ninjatrader.com/forum/...ask-bid-series

    Is that still true for NT8?

    Thanks!

    #2
    Hello wadams,

    Thank you for your inquiry.

    Yes, what JoshG posted in your linked forum post is still applicable to NinjaTrader 8.

    Please let us know if you have any other questions.

    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      That was a quick reply! Thanks, NinjaTrader_Gaby.

      Can you spot check my understanding a little bit more?

      I'm guessing that accumulation does not happen with a 1-tick series. The volume values are effectively a snapshot.

      For example, I'm adding series like the following:

      Code:
      else if (State == State.Configure)
      {
          AddDataSeries(Instrument.FullName, BarsPeriodType.Tick, 1, MarketDataType.Ask);
          AddDataSeries(Instrument.FullName, BarsPeriodType.Tick, 1, MarketDataType.Bid);
      }​
      When "State == State.Historical" and I'm accessing the series with the following code:

      Code:
      protected override void OnBarUpdate()
      {
          if (State == State.Realtime) return;
      
          if (BarsInProgress == 1)
          {
              lastAskPrice = Close[0];
              lastAskVolume = Volume[0];
              return;
          }
          else if (BarsInProgress == 2)
          {
              lastBidPrice = Close[0];
              lastBidVolume = Volume[0];
              return;
          }
      }​
      then the "lastAskVolume" and "lastBidVolume" variables (defined in the class scope) should each have a snapshot of the last recorded resting order volumes for the ask and bid.

      Is that correct?
      Last edited by wadams; 12-08-2023, 08:44 AM.

      Comment


        #4
        Hello,

        Thank you for your response.

        Yes, Volume[] will be the last value for each of the series you added (since you are using BarsInProgress conditions).

        As a side note, you should be using AddDataSeries(null instead of AddDataSeries(Instrument.FullName, to assume the primary instrument correctly.

        Please let us know if you have any other questions.
        Gaby V.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by pibrew, Today, 06:37 AM
        0 responses
        4 views
        0 likes
        Last Post pibrew
        by pibrew
         
        Started by rbeckmann05, Yesterday, 06:48 PM
        1 response
        14 views
        0 likes
        Last Post bltdavid  
        Started by llanqui, Today, 03:53 AM
        0 responses
        6 views
        0 likes
        Last Post llanqui
        by llanqui
         
        Started by burtoninlondon, Today, 12:38 AM
        0 responses
        11 views
        0 likes
        Last Post burtoninlondon  
        Started by AaronKoRn, Yesterday, 09:49 PM
        0 responses
        16 views
        0 likes
        Last Post AaronKoRn  
        Working...
        X