• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 benjamind10, Today, 07:27 PM
              0 responses
              4 views
              0 likes
              Last Post benjamind10  
              Started by YevhenShynkarenko, Today, 06:07 PM
              0 responses
              4 views
              0 likes
              Last Post YevhenShynkarenko  
              Started by StevenNelson, Today, 04:07 PM
              3 responses
              11 views
              0 likes
              Last Post NinjaTrader_ShawnB  
              Started by Matthew Spositi, Today, 03:28 PM
              2 responses
              8 views
              0 likes
              Last Post Matthew Spositi  
              Started by faisamtrader, Today, 01:30 PM
              2 responses
              21 views
              0 likes
              Last Post NinjaTrader_ChrisL  
              Working...
              X