Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnRender optimizations

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

    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?

    #2
    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.
    Bruce DeVault
    QuantKey Trading Vendor Services
    NinjaTrader Ecosystem Vendor - QuantKey

    Comment


      #3
      Thanks again Bruce, using the FromIndex / ToIndex did the trick!!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by SalmaTrader, 07-07-2026, 10:26 PM
      0 responses
      31 views
      0 likes
      Last Post SalmaTrader  
      Started by CarlTrading, 07-05-2026, 01:16 PM
      0 responses
      20 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 06-17-2026, 10:32 AM
      0 responses
      12 views
      0 likes
      Last Post CaptainJack  
      Started by kinfxhk, 06-17-2026, 04:15 AM
      0 responses
      18 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Started by kinfxhk, 06-17-2026, 04:06 AM
      0 responses
      20 views
      0 likes
      Last Post kinfxhk
      by kinfxhk
       
      Working...
      X