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

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.
    Brandon H.NinjaTrader Customer Service

    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.
        Brandon H.NinjaTrader Customer Service

        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 tsantospinto, 04-12-2024, 07:04 PM
          5 responses
          67 views
          0 likes
          Last Post tsantospinto  
          Started by cre8able, Today, 03:20 PM
          0 responses
          6 views
          0 likes
          Last Post cre8able  
          Started by Fran888, 02-16-2024, 10:48 AM
          3 responses
          47 views
          0 likes
          Last Post Sam2515
          by Sam2515
           
          Started by martin70, 03-24-2023, 04:58 AM
          15 responses
          114 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by The_Sec, Today, 02:29 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Working...
          X