Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Conditionally include OnMarketDepth / OnMarketData in an indicator.
Collapse
X
-
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.
Tags: None
-
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.
-
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
-
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.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
637 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
366 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
107 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
569 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
571 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment