Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
OnRender optimizations
Collapse
X
-
OnRender optimizations
Hey, so currently I'm looping through chartBars in my Onrender function to draw a bunch of stuff. When I turn up the "days to load" it becomes quite slow, and I can see that it's the OnRender() causing this. So is there a way to only get the bars that are displayed? And are there any other tips for optimizing OnREnder type drawing?Tags: None
-
Well, first of all, you should only be looping from ChartBars.FromIndex to ChartBars.ToIndex. Second, you should ensure that you are not doing any "calculations" in OnRender - that should be pre-staged in OnBarUpdate or perhaps OnMarketData if that's truly necessary, and OnRender should only be displaying the final results. Those are the "lowest hanging fruit" - if you do those things, you're down to smaller things like re-using rather than re-instantiating SharpDX brushes and so forth.
See also: https://ninjatrader.com//support/hel...bars.fromindex
Go through that page and study those recommendations - they're practical advice.Last edited by QuantKey_Bruce; 04-05-2023, 05:08 AM.
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by CaptainJack, 05-29-2026, 05:09 AM
|
0 responses
231 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 05:09 AM
|
||
|
Started by CaptainJack, 05-29-2026, 12:02 AM
|
0 responses
149 views
0 likes
|
Last Post
by CaptainJack
05-29-2026, 12:02 AM
|
||
|
Started by charlesugo_1, 05-26-2026, 05:03 PM
|
0 responses
161 views
1 like
|
Last Post
by charlesugo_1
05-26-2026, 05:03 PM
|
||
|
Started by DannyP96, 05-18-2026, 02:38 PM
|
1 response
243 views
0 likes
|
Last Post
|
||
|
Started by CarlTrading, 05-11-2026, 05:56 AM
|
0 responses
198 views
0 likes
|
Last Post
by CarlTrading
05-11-2026, 05:56 AM
|

Comment