Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

ATM Strategy Window - Question about numbers

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

    ATM Strategy Window - Question about numbers

    Hi all,

    What are these numbers below the 'None' dropdown in the attached image, and how can I access them in Ninjatrader code for my own strategies?

    Thanks in advance!

    #2
    Hello Spiderbird,

    Thanks for your post.

    The A and B are the "Ask" and "Bid" values and the current volumes of each.

    You can access those values through the methods linked below:



    While those provide a snapshot of the values, which may be all you need, if you are looking for more dynamic updates, please review the educational example of a level 2 book here: https://ninjatrader.com/support/help...vel_ii_dat.htm
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Thanks Paul! I'll check those articles out. Much appreciated.

      Comment


        #4
        Originally posted by NinjaTrader_PaulH View Post
        Hello Spiderbird,

        Thanks for your post.

        The A and B are the "Ask" and "Bid" values and the current volumes of each.

        You can access those values through the methods linked below:



        While those provide a snapshot of the values, which may be all you need, if you are looking for more dynamic updates, please review the educational example of a level 2 book here: https://ninjatrader.com/support/help...vel_ii_dat.htm
        ------

        Hi Paul,

        So to clarify.. if I wanted to get the total bid or ask volume from a previous bar, then I would be referencing:

        protected override void OnBarUpdate()
        {
        if(BarsInProgress == 0)
        {
        long previousBidVolume = GetCurrentBidVolume(1);
        long previousAskVolume = GetCurrentAskVolume(1);
        Print("The Previous Bid volume is: " + previousBidVolume);
        Print("The Previous Ask volume is: " + previousAskVolume);
        }


        However, if a bar is currently being built with ticks (I have my limit at 20 per bar), and I wanted current data, it would look like this?

        if(BarsInProgress == 1)
        {
        long currentBidVolume = GetCurrentBidVolume(0);
        long currentAskVolume = GetCurrentAskVolume(0);
        Print("The Current Bid volume is: " + currentBidVolume);
        Print("The Current Ask volume is: " + curentAskVolume);
        }
        }

        Comment


          #5
          Hello Spiderbird,

          Thanks for your reply.

          GetCurrentBid() and GetCurrentAsk() return the values of the current tick when the OnBarUpdate() is called. When OnBarUpdate() is called depends on the "Calculate" mode used (OnBarClose, OnPriceChange, OnEachTick).

          In your example, you are showing two different BarsInProgress. BarsInProgress is only applicable if you are adding a dataseries to your script, The BarsInProgress would indicate which data series called the OnbarUpdate() Reference: https://ninjatrader.com/support/help...inprogress.htm

          To obtain the buy or sell volume of the bar, you can use the indicator BuySellVolume.
          Paul H.NinjaTrader Customer Service

          Comment


            #6
            Hi Paul,

            Okay, captured that data properly... no problem. Now I'm running into a tracking mismatch with the "Calculate" mode.

            It seems that both A and B (ask/bid numbers) are changing more frequently than a tick change. So there may be two or three different movements in A and B volume before a tick movement registers them into the strategy. Is there a mode where I can capture every movement of the bid/ask volume updates?

            Example:
            A/B at time of tick add: 54/22
            Ask Bid numbers change two times (65/21, 109/34)
            A/B at time of next tick add: (90/220)

            Please let me know when you have a moment.

            Comment


              #7
              Hello Spiderbird,

              Thanks for your post.

              That is a correct observation. You would need to subscribe to OnMarketData(), reference: https://ninjatrader.com/support/help...marketdata.htm The linked reference provides an example.

              You can also look at the coding of the indicator BuySellVolume for another reference.
              Paul H.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by jaybedreamin, Today, 05:56 PM
              0 responses
              3 views
              0 likes
              Last Post jaybedreamin  
              Started by DJ888, 04-16-2024, 06:09 PM
              6 responses
              18 views
              0 likes
              Last Post DJ888
              by DJ888
               
              Started by Jon17, Today, 04:33 PM
              0 responses
              1 view
              0 likes
              Last Post Jon17
              by Jon17
               
              Started by Javierw.ok, Today, 04:12 PM
              0 responses
              6 views
              0 likes
              Last Post Javierw.ok  
              Started by timmbbo, Today, 08:59 AM
              2 responses
              10 views
              0 likes
              Last Post bltdavid  
              Working...
              X