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

Conditionally include OnMarketDepth / OnMarketData in an indicator.

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

    Conditionally include OnMarketDepth / OnMarketData in an indicator.

    I have an indicator that includes the OnMarketDepth / OnMarketData override methods. Depending on the user configuration of the custom indicator properties those might not be needed. So the use of those methods is conditional. Ideally they would not process when they are not needed. Any suggestions on how to accomplish this? My thought was to create a separate indicator that contains those methods and only reference it in the primary indicator when needed.


    #2
    Hello martyn73,

    Thanks for your post.

    Adding the OnMarketDepth and OnMarketData overrides will add these events to the NinjaScript and it is advised to not add these methods if they are not used.

    You could use AddOn code to add MarketData and MarketDepth events to your script conditionally. I have attached an example in this post.

    MarketData Events - https://ninjatrader.com/support/help...marketdata.htm

    MarketDepth Events - https://ninjatrader.com/support/help...arketdepth.htm

    Please let us know if we can be of further assistance.
    Attached Files
    JimNinjaTrader Customer Service

    Comment


      #3
      Perfect, thank you!

      Comment


        #4
        This solution works well for MarketData but the MarketDepth solution does not fire as often as the OnMarketDepth() method does. I need to retrieve that data as fast as OnMarketDepth but only conditionally. My current solution is to put OnMarketDepth in a separate indicator and import it into my primary indicator only when needed. But this creates an indicator on the indicator list that should not be used which is confusing to users. And NT does not allow you to hide indicators from the list. Is there a way to accomplish my requirements with a modification of the solution you provided?

        Comment


          #5
          Hello martyn73,

          What MarketDataEventArgs are you retrieving in OnMarketDepth that you cannot retrieve when subscribing to the Account's MarketDepth event for this instrument?

          I look forward to being of further assistance.
          JimNinjaTrader Customer Service

          Comment


            #6
            My indicator renders depth of market to the chart when set by the user as a preference. The solution provided in this thread does not appear to update often enough. So it lags far behind compared with what shows up on the SuperDOM.

            Comment


              #7
              Hello martyn73,

              Thanks for clarifying.

              I do not have a way I can suggest to modify the refresh interval for the MarketDepth.Update event. If you have found a solution writing to the AddOn namespace from another indicator, you could move forward with that approach, otherwise I would suggest implementing anything that requires MarketDepth in a separate indicator.

              I have submitted a feature request on your behalf to be able to customize the rate at which Market.Depth.Update refreshes. The ticket ID is SFT-3862. As with other feature requests, we cannot offer an ETA or promise of fulfillment, but interest for this idea is being tracked.

              If there is anything else I can do to help, please let me know.
              JimNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by trilliantrader, 04-18-2024, 08:16 AM
              4 responses
              18 views
              0 likes
              Last Post trilliantrader  
              Started by mgco4you, Today, 09:46 PM
              1 response
              7 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by wzgy0920, Today, 09:53 PM
              0 responses
              9 views
              0 likes
              Last Post wzgy0920  
              Started by Rapine Heihei, Today, 08:19 PM
              1 response
              10 views
              0 likes
              Last Post NinjaTrader_Manfred  
              Started by Rapine Heihei, Today, 08:25 PM
              0 responses
              10 views
              0 likes
              Last Post Rapine Heihei  
              Working...
              X