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

dom data from prior tick

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

    dom data from prior tick

    Hello! I would like to know how to get the bid, bidsize, ask and asksize from the prior tick (or prior bar).

    If there's a sample of codes or an indicator using similar methods, please point me to it.

    Thank you!

    #2
    Historical bid/ask data is not supported but on our list for NT7. What you could do is monitor OnMarketData() and store the prior data as new comes it in strategy/indicator level variables.

    More information - http://www.ninjatrader-support.com/H...arketData.html
    RayNinjaTrader Customer Service

    Comment


      #3
      gamevoodoo,

      I responded to your PM outlining steps on how you can approach this.
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Originally posted by Josh View Post
        gamevoodoo,

        I responded to your PM outlining steps on how you can approach this.
        Thank you very much, you're awesome, I have solved the problem.

        Comment


          #5
          BidSize/AskSize

          Originally posted by NinjaTrader_Josh View Post
          gamevoodoo,

          I responded to your PM outlining steps on how you can approach this.
          I'm also interested to know how to do this. I'd like to get the bidsize and asksize for every tick. Is this now available in NT7?

          Comment


            #6
            Brillo,

            Are you on NinjaTrader 7 or NinjaTrader 6.5?

            I look forward to assisting you further.

            Comment


              #7
              I'm running NT 7. In NinjaScript I want to access:
              BID price
              ASK price
              BIDSIZE
              ASKSIZE
              for every tick that comes in.

              Comment


                #8
                Hello,

                Sure in NinjaTrader 7 this can be done with information from this page.

                The example on this page is an exact match to what you need.




                Let me know if I can be of further assistance.

                Comment


                  #9
                  Great! Thanks. I will try it out.

                  Comment


                    #10
                    Brett,
                    I've looked into your answer to accessing bid/ask/bidsize/asksize.
                    I have a few questions about working with this.

                    Firstly,
                    OnMarketData does not work with historical data ( according to the documentation ), so it can not be used in backtesting. I want to be able to backtest with it the bid/ask/bidsize/asksize data. I'm looking for a way to do this. Is there a way?

                    One idea have is to use to create a datafile that is written to during real time or MarketReplay.
                    Then the strategy would read the file during backtesting.

                    Here's the plan: I was thinking of an indicator that would write the bid/ask/bidsize/asksize data that it can get in the OnMarketData callback into a file, with the current bar time for each bid/ask/bidsize/asksize record as in: Time[0].ToString("yy-MM-dd HH:mm:ss.fffffff"). The recording would happen while running the indicator on a MarketReplay connection. Next I would run a strategy that would read the file. This strategy could be backtested. When the strategy engine calls OnBarUpdate, the code in my strategy's OnBarUpdate would read the bid/ask/bidsize/asksize file and find all the records that have timestamps that occur between the current Time[0] and the last Time[1].

                    1A. Does this seem feasible?

                    1B. Is there some standard way to write and read files that match up the data records?

                    2) Historical Data.
                    I have not used MarketReplay connection yet. I've been running with a Zen-Fire connection for weeks now but I have not had the "Record for market replay" checked. Nor have I had "Save chart data as historical". 2A) Why then am I able to view all the data and export it if I did not have these checkboxes checked? What do these check boxes do?

                    3) Will Indicators and strategies running on the MarketReplay connection have their OnMarketData() methods called? If so then why can't the backtesting engine do the same?

                    I would not have any of these issues if I had a way to backtest with the bid/ask/bidsize/asksize data. If there's some way to do that I would appreciate some direction.
                    Thanks,
                    Tim

                    Comment


                      #11
                      Tim - correct, OnMarketData() will not work in backtesting - best would be working in Market Replay then as the tick formation is then known and also if needed Level 2 data could be too accessed via OnMarketDepth(). For another workaround idea you can review Gomi's work here on the forums (his indicator record the bid / ask data to then provide a backfill).
                      BertrandNinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by NinjaTrader_Bertrand View Post
                        Tim - correct, OnMarketData() will not work in backtesting - best would be working in Market Replay then as the tick formation is then known and also if needed Level 2 data could be too accessed via OnMarketDepth(). For another workaround idea you can review Gomi's work here on the forums (his indicator record the bid / ask data to then provide a backfill).
                        Thanks Bert. That looks good.

                        Comment

                        Latest Posts

                        Collapse

                        Topics Statistics Last Post
                        Started by WHICKED, Today, 12:45 PM
                        2 responses
                        16 views
                        0 likes
                        Last Post WHICKED
                        by WHICKED
                         
                        Started by GussJ, 03-04-2020, 03:11 PM
                        15 responses
                        3,272 views
                        0 likes
                        Last Post xiinteractive  
                        Started by Tim-c, Today, 02:10 PM
                        1 response
                        8 views
                        0 likes
                        Last Post NinjaTrader_ChelseaB  
                        Started by Taddypole, Today, 02:47 PM
                        0 responses
                        2 views
                        0 likes
                        Last Post Taddypole  
                        Started by chbruno, 04-24-2024, 04:10 PM
                        4 responses
                        51 views
                        0 likes
                        Last Post chbruno
                        by chbruno
                         
                        Working...
                        X