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!
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
NinjaTrader
Add-on Development with Market Depth
Collapse
X
-
Add-on Development with Market Depth
I am working on a new add-on, but running in to a strange error. The add-on works properly on my computer, but when I install it on a customers computer it does not. If you look in the OnInstrumentChanged() method of the Tab Page, you will see the program is subscribing to market data and market depth. If I do not subscribe to market depth, this test program will work properly on the customers computer. When I add the code to subscribe to market depth, the customers entire data feed goes down when the method is called (all charts stop receiving data). Am I doing something wrong with my market depth subscription?Tags: None
-
-
Hello SystemTrading,
Thanks for confirming that.
I think the issue might be the amount of market data updates that are being processed. These values change very rapidly and there are a large amount of updates.
I believe the script is invoking into the UI thread on line 298 for every one of these updates which is locking up the UI thread.
If you plan to use the data to update the UI, it may be wise to save these values to variables from the market depth event handler method (instrument thread) and update the UI using the values saved to variables from a timer that runs every second or half second.
If you were using the instrument.MarketDepth.Asks collection from the timer event handler method this would have all of this information prepared for you, and the OnMarketData / OnMarketDepth event handler methods would not be necessary.Chelsea B.NinjaTrader Customer Service
Comment
-
That was my initial suspicion, but I have not been able to confirm that. What is odd to me is that everything works fine when I do not subscribe to market depth. My market depth handler is doing nothing, so it seems odd that it overload the UI thread? Were you able to test the program on your end?
Comment
-
Hello SystemTrading,
I tested on my end and after the script runs for a while and then the SuperDOM starts having delayed updates.
I commented out line 298, compiled, closed and re-launched the window, and the behavior stopped.
I did not remove the event handler method for MarketDepth.Chelsea B.NinjaTrader Customer Service
Comment
-
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by rbeckmann05, Yesterday, 06:48 PM
|
1 response
12 views
0 likes
|
Last Post
by bltdavid
Today, 05:43 AM
|
||
Started by llanqui, Today, 03:53 AM
|
0 responses
6 views
0 likes
|
Last Post
by llanqui
Today, 03:53 AM
|
||
Started by burtoninlondon, Today, 12:38 AM
|
0 responses
10 views
0 likes
|
Last Post Today, 12:38 AM | ||
Started by AaronKoRn, Yesterday, 09:49 PM
|
0 responses
15 views
0 likes
|
Last Post
by AaronKoRn
Yesterday, 09:49 PM
|
||
Started by carnitron, Yesterday, 08:42 PM
|
0 responses
11 views
0 likes
|
Last Post
by carnitron
Yesterday, 08:42 PM
|
Comment