Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Default Candle ChartStyle width wrong?

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

    Default Candle ChartStyle width wrong?

    After developing my own candle style I noticed something in the standard code that I often do myself when first coding a beta version of an indicator, that is, hard-coding a value that should be made adjustable/variable.

    In the NT8 candle style the code reads:

    Code:
    rect.X        = x - barWidth * 0.5f + 0.5f;
    
    rect.Width    = barWidth - 1;
    This is assuming that the Stroke.Width on the outline is always '1'. I recoded it to take into account a width larger than '1' and to also keep the total width (including outline) of the candle equaling ChartControl.GetBarPaintWidth(). I had to do this because I use a volume overlay indicator that adjusts it's width to reflect ChartControl.GetBarPaintWidth(). Please see image.

    Code:
    rect.X        = x - barWidth * 0.5f + 0.5f * Stroke.Width;
    
    rect.Width    = barWidth - Stroke.Width;
    It might not seem like much but if you increase the outline, say to 10, then the overlap becomes significant. Of course I'm sure noone will use an outline > 10 or so......but who knows?

    Thanks for your consideration.

    Simon.
    Attached Files

    #2
    Hello Sim22,

    Thank you for your post.

    We do appreciate the suggestion. I tested out the idea but I still see overlap. Please take a look at my screenshot attached.
    Attached Files

    Comment


      #3
      Thank you.

      But let me clarify.

      Overlap will still occur since there is no limiting factor to the total width. It's going to overlap regardless unless Math.Min(ChartControl.Properties.BarDistance, myTotalWidth) or something similar is used to limit it's width. That's not the issue here although please take that into consideration as well! That would be a suitable addition.

      What I am saying was when ChartControl.GetBarPaintWidth() is near equal to ChartControl.Properties.BarDistance (theoretically at this width the bars should fit nice and snug with each other) it is showing an overlap which indicates the outline is increasing the candle total width. Whereas I believe the total width of outline + candle body should be no greater than ChartControl.GetBarPaintWidth(). Please download my OnRender helper. It's rough but it works and see what I mean. Also please download my VolumeOverlay here. If you set ChartControl.GetBarPaintWidth() to near equal to ChartControl.Properties.BarDistance you will notice the volume overlay fits snug with each other but there is overlap with the NT8 candlestyle when a fat outline is used.

      Thank you.
      Attached Files

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by fx.practic, 10-15-2013, 12:53 AM
      5 responses
      5,404 views
      0 likes
      Last Post Bidder
      by Bidder
       
      Started by Shai Samuel, 07-02-2022, 02:46 PM
      4 responses
      95 views
      0 likes
      Last Post Bidder
      by Bidder
       
      Started by DJ888, Yesterday, 10:57 PM
      0 responses
      8 views
      0 likes
      Last Post DJ888
      by DJ888
       
      Started by MacDad, 02-25-2024, 11:48 PM
      7 responses
      159 views
      0 likes
      Last Post loganjarosz123  
      Started by Belfortbucks, Yesterday, 09:29 PM
      0 responses
      8 views
      0 likes
      Last Post Belfortbucks  
      Working...
      X