Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawRegion - CPU intensive?

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

    DrawRegion - CPU intensive?

    Hi everyone

    I may have seen - and I get the impression on the charts - that the DrawRegion method can be particularly CPU intensive.

    Is this the case ? If so, I'd greatly appreciate some tips as to how to address this, as I plan to use this method on some charts a lot more than previously.

    Thanks in advance.

    #2
    Originally posted by arbuthnot View Post
    Hi everyone

    I may have seen - and I get the impression on the charts - that the DrawRegion method can be particularly CPU intensive.

    Is this the case ? If so, I'd greatly appreciate some tips as to how to address this, as I plan to use this method on some charts a lot more than previously.

    Thanks in advance.
    I have 0 issues in NT7 and don't find it to be cpu intensive.

    Comment


      #3
      Hello arbuthnot,

      Thanks for your post.

      Like anything it is all in the coding that makes a difference. I think DrawRegion coding was well discussed here: http://ninjatrader.com/support/forum...ght=drawregion. You can search the forums for "DrawRegion" and get a lot of hits that may be worth reviewing as well.

      Also, here are the tips from the helpguide:

      1. Pass in Color.Empty to the "outlineColor" parameter if you do not want to have an outline color.

      2. If you wanted to fill a region between a value (20 period simple moving average) and the upper edge of the chart, pass in an extreme value to the "y" parameter such as 1000000.

      3. Should you be drawing regions based on DataSeries objects instead of indicator plots, be sure to create the DataSeries with the MaximumBarsLookBack.Infinite parameter if the region you are drawing would be maintained on the chart for more than 256 bars back.

      Comment


        #4
        Thanks very much, Sledge and Paul.

        Paul - the info you gave and the link are particularly helpful.

        I'll quote what Jesse stated in that thread as it does have a bearing on CPU load:

        As for performance the way you currently have it would consume a lot of CPU as it is drawing a region for every bar especially as you get more data loaded on the chart.

        Comment


          #5
          All the NinjaTrader draw methods do have a significant bearing on CPU. This applies to DrawRegion(), but also to DrawDiamond(), DrawText(), DrawArrowUp() etc. In particular such methods will increase chart loading times for high resolution charts with extended lookback periods.

          Example:

          I open a default 1-min chart in NinjaTrader with a lookback of 365 days. The anaCurrentDayVWAPV37, which still uses DrawRegion() to fill the areas between the standard deviation bands takes 30 seconds to load.

          The latest version of the indicator anaCurrentDayVWAPV43, which has DrawRegion() replaced with a custom plot, only takes 2 seconds to load.

          Between the two versions there are no other major changes that affect the loading times on a chart. The difference of 28 seconds can be attributed to DrawRegion() which is used 6 times by the old indicator.

          The new indicator is available open source:

          Reviews, Strategies, Indicators & more | NexusFi community forum
          Attached Files
          Last edited by Harry; 08-25-2015, 09:31 AM.

          Comment


            #6
            Ok i haven't used draw region at that detail. I was using based in the example in the indicator section nt7 for colorzones.

            Comment


              #7
              Much obliged as ever, Harry.That's extremely helpful and I've downloaded the indicator.

              Cheers!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              600 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              347 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              103 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              558 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              558 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X