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

Alternative graphics to conserve CPU

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

    Alternative graphics to conserve CPU

    I have several drawing issues related to speed. These are NT7 based.

    1) I currently use DrawRectangle with a low opacity fill to outline Higher time frame Bars on a lower time frame chart. I am finding it is almost 30 % of my cpu load. Can anyone comment on whether using graphics.FillRectangle with a low opacity color is a faster alternative. The first issue I see is translating the price co-ordinates to pixels so I am not sure this is viable.

    2) I have some text markers which are fixed text values with background that I use to mark bars. This chews up CPU as well. I wondering whether there is a way to make a pic of the text and some how position that like the built in DrawArrow rather than have the system write the text with a font. I am thinking it might be faster. If the image of an arrow of diamond could be replaced maybe that is an option.

    I am open to suggestions

    Thanks
    Jerry
    Last edited by JerryWar; 10-10-2016, 05:20 PM.

    #2
    System specs?

    Are you in a VM of some sorts?

    Comment


      #3
      I7 QuadCore running Win7

      No VM

      Comment


        #4
        Video? Monitor resolution?

        Do you have some sample code that reproduces the problem?

        Comment


          #5
          Originally posted by sledge View Post
          Video? Monitor resolution?

          Do you have some sample code that reproduces the problem?
          video
          1920 x 1080

          the code is simple. based on higher time frame bar being built i.e. Rh - High and Rl - low

          IRectangle irRect = DrawRectangle(RrctTag, false, CurrentBars[0]-l[1],Rh, 0, Rl, RoutlineColor, RareaColor, RareaOpacity);
          if (irRect != null) irRect.Pen.Width=TradeOutlinePen;
          if (irRect != null) irRect.Pen.DashStyle=DashStyle.Dash;
          Last edited by JerryWar; 10-11-2016, 06:30 AM.

          Comment


            #6
            Hello JerryWar,

            I am having trouble getting drawing elements to use up a significant portion of my processor. It would help me in my investigation if I had some hard numbers to shoot for. Would it be possible for you to take a screen shot of your Windows System control panel screen? I have attached an example of mine.

            To send a screenshot with Windows 7 or newer I would recommend using Window's Snipping Tool.
            Click here for instructions
            Alternatively to send a screenshot press Alt + PRINT SCREEN to take a screenshot of the selected window. Then go to Start--> Accessories--> Paint, and press CTRL + V to paste the image. Lastly, save as a jpeg file and send the file as an attachment.
            Click here for detailed instruction
            Attached Files
            Jessica P.NinjaTrader Customer Service

            Comment


              #7
              Jessica - See attached.
              The way I am judging the relative system load is by Measuring the time to reload the screen
              All my features have enables/disables so I measure the load time with certain features enabled and have found that it increases load time by about 30%. I have what appears to be my CPU pegging during fast market periods on just one symbol. ( i.e going to 13% ) Quadcore with Hyperthreading ( 8 CPUs)

              Jerry
              Attached Files
              Last edited by JerryWar; 10-11-2016, 07:08 AM.

              Comment


                #8
                Thank you JerryWar, I am performing some benchmarking and profiling on my end and will return to this thread when I have more information.
                Jessica P.NinjaTrader Customer Service

                Comment


                  #9
                  Sledge
                  Your Question about monitor resoulution raised several thoughts.
                  Have you found that the monitor resolution has a significant impact on the CPU load ?

                  thanks
                  Jerry

                  Comment


                    #10
                    Originally posted by JerryWar View Post
                    Sledge
                    Your Question about monitor resoulution raised several thoughts.
                    Have you found that the monitor resolution has a significant impact on the CPU load ?

                    thanks
                    Jerry
                    Lots of people using 4k screens. I have a 3440x1440 ultra wide dell. So potentially more area to cover.

                    Is the chart maximized? Full screen? Do you have cross hairs enabled?

                    Comment


                      #11
                      Thank you again for your report JerryWar. I was unable to reproduce any measurable CPU or memory load increase using the attached script, and each rectangle drew very quickly. I am attaching a summary of my output window below.

                      Could I ask you to attempt to use this script on your system, and let us know if it generates an appreciable CPU load increase on your end?

                      I can not advice on System.Drawing.Graphics methods except to say that they rely on a .dll file which may not be available in future versions of Ninja. I would like to recommend using only documented methods for drawing on charts, as Ninja's underlying engine could change and break your code otherwise.
                      Attached Files
                      Jessica P.NinjaTrader Customer Service

                      Comment


                        #12
                        Jessica
                        I was in process of completely cutting the code section out and placing it in a separate indicator such that I could easily share it. At quick glance your method looks better for testing purposes. I will give it a try and let you know.

                        Thanks
                        Jerry

                        Comment


                          #13
                          I am going to need to go to a 4k display at some point. I am using Two 27in HD on this machine But chart is not maximized. and I do use crosshairs.
                          I could not trade without it.

                          Thanks
                          Jerry

                          Comment


                            #14
                            Jessica,

                            Did you write this in NT8? I am running NT7

                            Jerry

                            Comment


                              #15
                              Originally posted by JerryWar View Post
                              Jessica,

                              Did you write this in NT8? I am running NT7

                              Jerry
                              I missed that too in the original post. Yes, that is in NT8 from NT_JP.

                              Everyone complaining/having issues with NT8 graphics, we simply assumed it.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Waxavi, Today, 02:10 AM
                              0 responses
                              6 views
                              0 likes
                              Last Post Waxavi
                              by Waxavi
                               
                              Started by TradeForge, Today, 02:09 AM
                              0 responses
                              11 views
                              0 likes
                              Last Post TradeForge  
                              Started by Waxavi, Today, 02:00 AM
                              0 responses
                              2 views
                              0 likes
                              Last Post Waxavi
                              by Waxavi
                               
                              Started by elirion, Today, 01:36 AM
                              0 responses
                              4 views
                              0 likes
                              Last Post elirion
                              by elirion
                               
                              Started by gentlebenthebear, Today, 01:30 AM
                              0 responses
                              5 views
                              0 likes
                              Last Post gentlebenthebear  
                              Working...
                              X