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

question on onmarketdata

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

    question on onmarketdata

    hi

    I´m trying to modify the VolumeProfile indicator and I looked for info on OnMarketData method, and MarketDataType but I didn´t what conditions identify each value of MarketDataType.Type, when it takes Bid, Ask, last what exactly does it means. Can anyone tell me more on this because NT help is too poor on this

    thanks

    #2
    telbentel, I'm sorry, I don't follow what you attempt doing: the OnMarketData() is called for each change in Level 1 data, this can be either the bid / ask or last.

    Also: it would work in realtime or Market Replay only, not in backtesting.
    BertrandNinjaTrader Customer Service

    Comment


      #3
      For what I read in NT help, the OnMarketData method is called any time there is a change in level 1 data, in particular this will happen every time a trade takes place, is that right?

      I need to know the volume asociated to that trade, I think I have to look the value of the parameter of the OnMarkedData call and if e.type==last then take the value of e.volume and I will have the volume of shares or contracts traded in the last trade at e.price. Is that right?

      I suppose e.type==bid will be when there is a change in the bid and similar for the ask.

      I took VolumeProfile as a template but I need to be sure of the above.

      Comment


        #4
        telbentel, your understanding is correct.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          thanks for your answer.

          Just one last question, in case there is a trade that consume all the volume available at the bid or ask price, in that case there will be a new bid or ask price and a trade took place. My question is: The OnMarketData method will be called twice, once with the e parameter with the value e.type==last and other with the e.type==Last?

          Comment


            #6
            Correct, as you see calls for each change in Level 1 MarketData.
            BertrandNinjaTrader Customer Service

            Comment


              #7
              In the OnMarketData method, can I have access to Time[] or Times[]? If not, what other restrictions do I have?

              Comment


                #8
                This method is called for each Level 1 data change and as such it's no tied to any bars update calls, therefore calling Time / Times would not be useful.
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  yes I know, but I want to know the timestamp of the bar in progress that´s why I use Time[0], but when I try to use it my indicator doesn´t work. Can I use it inside OnMarketData?

                  Comment


                    #10
                    You should be able to use it if you're running on CalculateOnBarClose = false - to get the last / bid / ask tick time, you can access e.Time
                    BertrandNinjaTrader Customer Service

                    Comment


                      #11
                      No I´m not able to access Time[] when I am in OnMarketData, I just check it, I put only an If sentence in the code for OnMarketData, the condition of this if was to check if Time[0] was between 2 timestamps and if yes show a messagebox, if not show another message box.

                      When I use Time[0] the indicator doesn´t work, it doesn´t show any of the two messages, when I use e.Time it works properly.

                      Just to let you know.

                      Comment


                        #12
                        Are you working in NT 6.5 or 7 beta here?
                        BertrandNinjaTrader Customer Service

                        Comment


                          #13
                          I´m using version 6.5.1000.16

                          Comment


                            #14
                            Ok, that explains our differences then - I was checking on NT7.
                            BertrandNinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by guillembm, Yesterday, 11:25 AM
                            2 responses
                            9 views
                            0 likes
                            Last Post guillembm  
                            Started by junkone, 04-21-2024, 07:17 AM
                            9 responses
                            68 views
                            0 likes
                            Last Post jeronymite  
                            Started by trilliantrader, 04-18-2024, 08:16 AM
                            4 responses
                            18 views
                            0 likes
                            Last Post trilliantrader  
                            Started by mgco4you, Yesterday, 09:46 PM
                            1 response
                            11 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Started by wzgy0920, Yesterday, 09:53 PM
                            0 responses
                            10 views
                            0 likes
                            Last Post wzgy0920  
                            Working...
                            X