Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Subscribing OnMarketDepth from custom BarType

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

    Subscribing OnMarketDepth from custom BarType

    Hello,

    I'm trying to subscribe to OnMarketDepth event from a Bartype, like instructions on HelpGuide for an Add-On (NinjaScript->Language reference->Add On->Market Depth). But not seem to work. The handler method (myInstrument_MarketDepthUpdate) is run only once rather than with each update of the order book.

    Another problem is that my custom parameter does not appear in the dialog for the DataSerie.

    Thanks.
    Attached Files

    #2
    Hello cls71,

    Thanks for your post.

    For the property, in bar types this would be set in the State.Configure. Take a look at other bar types and note that properties not needed are removed. You can use SetPropertyName to name the property in the UI: http://ninjatrader.com/support/helpG...opertyname.htm.

    You can set the value using: http://ninjatrader.com/support/helpG...faultvalue.htm

    I will need to investigate the OnMarketdepth questions. Can you clarify what you are trying to do with that information?
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_Paul View Post
      I will need to investigate the OnMarketdepth questions. Can you clarify what you are trying to do with that information?
      I want to build the bars from the order book data.

      Comment


        #4
        Hello cls71,

        Thanks for your patience.

        Attached please find an example of how to call OnMarketDepth.
        Attached Files
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Paul View Post
          Hello cls71,

          Thanks for your patience.

          Attached please find an example of how to call OnMarketDepth.
          Thanks very much.

          Comment


            #6
            Hello,

            I have found a serious problem when the chart is closing.

            I attach a sample custom barstype that inherits from MinuteBarsType.
            It is subscribed to MarketData.Update and MarketDepthUpdate events from Bars.Instrument.

            It receives a lot of data from onmarketdata and onmarketdepth events from the instrument so it seems to work well.

            The bug happens when the chart is closing. Then NinjaTrader is frozen.

            I think the resources are correctly released inside OnStateChange when State == State.Terminated, but I do not know if I've missed something.

            Thanks

            PD: Beta 6
            Attached Files

            Comment


              #7
              In debugging this, I noticed there is some issue unsubscribing from the OnMarketData handler. There must be some exception that is not being caught, although I'm not sure why and will check that out.

              If I use the previously attached where we're just using OnMarketDepth it works - can you confirm the same on your end?

              While I check this out with development: Out of pure curiosity, why are you subscribing to OnMarketData in a BarsType? Wouldn't OnDataPoint provide you the same info?
              Last edited by NinjaTrader_Matthew; 10-27-2015, 03:45 PM.
              MatthewNinjaTrader Product Management

              Comment


                #8
                Originally posted by NinjaTrader_Matthew View Post
                If I use the previously attached where we're just using OnMarketDepth it works - can you confirm the same on your end?
                Yes, only OnMarketDepth works well.
                It seems the problem is only with OnMarketData.


                Originally posted by NinjaTrader_Matthew View Post
                While I check this out with development: Out of pure curiosity, why are you subscribing to OnMarketData in a BarsType? Wouldn't OnDataPoint provide you the same info?
                Yes, it should be the same result. I just wanted to do some tests while receiving the data directly from the instrument instead of the OnDataPoint method.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by trilliantrader, 04-18-2024, 08:16 AM
                5 responses
                22 views
                0 likes
                Last Post trilliantrader  
                Started by Davidtowleii, Today, 12:15 AM
                0 responses
                3 views
                0 likes
                Last Post Davidtowleii  
                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
                70 views
                0 likes
                Last Post jeronymite  
                Started by mgco4you, Yesterday, 09:46 PM
                1 response
                14 views
                0 likes
                Last Post NinjaTrader_Manfred  
                Working...
                X