Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

GraphicsPath vs. NT's Plot?

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

    GraphicsPath vs. NT's Plot?

    I'm dealing with some strange code, using GraphicsPath to draw a line on a chart.



    It's basically drawing a line like an NT Plot based on data points in a series.

    So I'm either dealing with super old legacy code ported to NT6.5/7, or someone who is .net/C# expert but has no idea about NT code, or an obfuscation expert.

    Is there any background I should know about with NT2/3/4/5??

    Is GraphicsPath more efficient than NT's Plot?

    #2
    Originally posted by sledge View Post
    I'm dealing with some strange code, using GraphicsPath to draw a line on a chart.



    It's basically drawing a line like an NT Plot based on data points in a series.

    So I'm either dealing with super old legacy code ported to NT6.5/7, or someone who is .net/C# expert but has no idea about NT code, or an obfuscation expert.

    Is there any background I should know about with NT2/3/4/5??

    Is GraphicsPath more efficient than NT's Plot?
    Depends. Sometimes when using a Custom Plot, the best way to draw is to use the base C# methods. Many times, as to use a GraphicsPath, all you need is a collection of points and one instruction, it can be the most efficient way to draw.

    Comment


      #3
      Originally posted by koganam View Post
      Depends. Sometimes when using a Custom Plot, the best way to draw is to use the base C# methods. Many times, as to use a GraphicsPath, all you need is a collection of points and one instruction, it can be the most efficient way to draw.
      In order to hack this up and try the simplest solution that I know to get this work -
      I've duplicated the original dataseries with a Plot class and set my Plot class with the values in order to try to make a NT Plot.


      So the NT Plot is overriden and of course NT Plot code is called.

      Code:
              public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
      So I give it the ole:
      Code:
      			base.Plot(graphics,bounds,min,max);
      Nothing happens.

      The price markers are showing in the right hand column and in the databox.. I just don't have an NT plot.

      I have added a factor of 10.00 to make sure the line isn't being affected by Z-order.

      What am I missing besides years of experience in this .net world?

      Comment


        #4
        I would guess call to the base.Plot is working, just not producing the desired effect by making a plot, because I'm not stuck in an infinite loop calling the overriden plot

        Comment


          #5
          Originally posted by sledge View Post
          In order to hack this up and try the simplest solution that I know to get this work -
          I've duplicated the original dataseries with a Plot class and set my Plot class with the values in order to try to make a NT Plot.


          So the NT Plot is overriden and of course NT Plot code is called.

          Code:
                  public override void Plot(Graphics graphics, Rectangle bounds, double min, double max)
          So I give it the ole:
          Code:
                      base.Plot(graphics,bounds,min,max);
          Nothing happens.

          The price markers are showing in the right hand column and in the databox.. I just don't have an NT plot.

          I have added a factor of 10.00 to make sure the line isn't being affected by Z-order.

          What am I missing besides years of experience in this .net world?
          Hard to say without seeing some code, but base.Plot(...) should draw any Plot class objects. Do you have any errors in the log?

          Comment


            #6
            I do not think that it is necessary to replace the NinjaTrader plots, but I use GraphicsPath for calculating polygones and to fill the area between plots. For example the chart below has all areas filled via GraphicsPath, while the seven plots are just drawn via base.Plot(graphics, bounds, min, max).

            I do not like to use DrawRegion() because it is too slow (complex indicators may take as much as 30-60 seconds to show on a chart with a longer lookback period). Furthermore some of the shaded regions disappear and reappear when you scroll back your chart hoirzontally.
            Attached Files

            Comment


              #7
              Sledge,

              Thank you for your post and to Harry and Koganam for responding.

              This kind of programming is unsupported however, you may want to try looking at the Mountain Chart Style from the Miscellaneous Section -
              http://www.ninjatrader.com/support/f...atid=6&lpage=1

              The reason for this is because it does something very similar to what you are looking for.

              Let me know if I can be of further assistance.
              Cal H.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              77 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              45 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              27 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              32 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              62 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X