Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Extract present Ask and Bid data on request

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

    Extract present Ask and Bid data on request

    Hello everyone,

    I find myself currently developing a trading strategy that involves reading a certain range of Bid and Ask values in a specific moment.

    My first approach was to read those values through:

    Code:
    protected override void OnMarketDepth(MarketDepthEventArgs e)
           {
           }​
    But then this function would trigger supposedly after every order book update and I only want a quick peek at the bid/ask data.

    I also tried to implement some call to the SuperDOM but I was completely unsuccessful. Namely, everything proposed in this help page: (https://ninjatrader.com/es/support/helpGuides/nt8/?superdomcolumn_marketdepth.htm) --> copy and paste the link or otherwise it won't work.

    This sounds to me like a question that should come up often but I couldn't find any post with experience from other users, nor SuperDOM implementations with NinjaScript.

    What would be the best approach to this? Thank you for your time.
    - Ginsterfeld
    Last edited by Ginsterfeld; 11-06-2022, 06:18 PM.

    #2
    Hello Ginsterfeld,

    Thanks for your post.

    That is correct. OnMarketDepth() is an event-driven method that is called for every change in level two market data (market depth) for the underlying instrument.

    OnMarketDepth(): https://ninjatrader.com/support/help...arketdepth.htm

    If you simply need to access the current Bid price or current Ask price when a certain condition is true, you could consider using GetCurrentBid() and GetCurrentAsk().

    See the help guide documentation linked below for more information and sample code.

    GetCurrentAsk(): https://ninjatrader.com/support/help...currentask.htm
    GetCurrentBid(): https://ninjatrader.com/support/help...currentbid.htm

    Let me know if I may assist further.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment


      #3
      Originally posted by NinjaTrader_BrandonH View Post
      Hello Ginsterfeld,

      Thanks for your post.

      That is correct. OnMarketDepth() is an event-driven method that is called for every change in level two market data (market depth) for the underlying instrument.

      OnMarketDepth(): https://ninjatrader.com/support/help...arketdepth.htm

      If you simply need to access the current Bid price or current Ask price when a certain condition is true, you could consider using GetCurrentBid() and GetCurrentAsk().

      See the help guide documentation linked below for more information and sample code.

      GetCurrentAsk(): https://ninjatrader.com/support/help...currentask.htm
      GetCurrentBid(): https://ninjatrader.com/support/help...currentbid.htm

      Let me know if I may assist further.
      Good evening Brandon,

      I see that these two functions only get the greatest Bid value, and the smallest Ask value. What if I want some other value of the order book, like for instance, those close to an important resistance/support? Is there any other function that is able to provide that?

      Best regards,
      Ginsterfeld

      Comment


        #4
        Hello Ginsterfeld,

        Thanks for your note.

        The other option would be to use OnMarketDepth() as you stated in post # 1 to get Ask and Bid prices. This method guarantees to be in the correct sequence for every change in level two market data (market depth) for the underlying instrument.

        See this help guide page about using OnMarketDepth() and sample code: https://ninjatrader.com/support/help...arketdepth.htm

        Let me know if I may assist further.
        <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

        Comment


          #5
          Originally posted by NinjaTrader_BrandonH View Post
          Hello Ginsterfeld,

          Thanks for your note.

          The other option would be to use OnMarketDepth() as you stated in post # 1 to get Ask and Bid prices. This method guarantees to be in the correct sequence for every change in level two market data (market depth) for the underlying instrument.

          See this help guide page about using OnMarketDepth() and sample code: https://ninjatrader.com/support/help...arketdepth.htm

          Let me know if I may assist further.
          It's not necessary. I have all the information I need to keep developing my algorithms. Thank you very much for your support! Much appreciated.

          Best regards,
          Ginsterfeld

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          637 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          366 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          107 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          569 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          571 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X