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!
See more
See less

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.
      Paul H.NinjaTrader Customer Service

      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:

          The best futures trading community on the planet: futures trading, market news, trading charts, trading platforms, trading strategies
          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 FrancisMorro, Today, 03:24 AM
              0 responses
              1 view
              0 likes
              Last Post FrancisMorro  
              Started by Segwin, 05-07-2018, 02:15 PM
              10 responses
              1,770 views
              0 likes
              Last Post Leafcutter  
              Started by Rapine Heihei, 04-23-2024, 07:51 PM
              2 responses
              31 views
              0 likes
              Last Post Max238
              by Max238
               
              Started by Shansen, 08-30-2019, 10:18 PM
              24 responses
              944 views
              0 likes
              Last Post spwizard  
              Started by Max238, Today, 01:28 AM
              0 responses
              11 views
              0 likes
              Last Post Max238
              by Max238
               
              Working...
              X