Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Better Candelsticks

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

    Better Candelsticks

    I'd like to configure chart candlesticks to have outline colors that can be specified for each bar condition, one color for up bars and another for down. Presently we have that option for the fill color of the candlestick only. I'm interested to have the fill transparent and only the outline showing the colors, one color for up bars and another for down.

    In the absence of this an indicator that does custom painting would be helpful. I haven' found one so I've started to write one.

    The property settings for chart bar candlesticks have the "Candle body outline" setting that includes Color, Dash style and Width all in one property. What kind of object is this and is it serializable? I have only found support serialization support for Windows.Media.Brush. I tried the Pen type because I saw there's support for a Serialize.StringToPen. However when I try to add a Pen property to my indicator the settings dialog for the indicator shows either a blank text box or one filled with a string "System.Windows.Media.Pen", the later behavior if I have tried to use the serializer:

    Code:
            [XmlIgnore]
            [Display(ResourceType = typeof(Custom.Resource), Name = "Candle body outline up", Description = "Color for Up candlestick body.", Order = 4, GroupName = "CandleStick Bar")]
            public Pen CandleBodyOutlinePriceUpBrush
            { get; set; }
    
            [Browsable(false)]
            public string CandleBodyOutlinePriceDownUpSerialize
            {
                get { return Serialize.PenToString(CandleBodyOutlinePriceUpBrush); }
                set { CandleBodyOutlinePriceUpBrush = Serialize.StringToPen(value); }
            }
    This code doesn't work. The indicator dialog box doesn't show settings for a Pen. Instead it's a text box with:
    "System.Windows.Media.Pen" in it.

    This post has 3 parts to it:
    1. Request feature in NT to offer independent outline color for up / down candlestick bars
    2. Request for identification/location of any known indicator that offers custom candlestick bar painting with this feature.
    3. NinjaScript help to find a property setting object for my own custom indicator that encapsulates all the typical settings for customizing the drawing like that of the existing Candlestick body outline. In the absence of #3 I can offer separate properties for color, line width and dash style but I just wanted it to be more professional looking like the NT Candlestick body outline property.
    Thank you.
    Last edited by Brillo; 04-24-2020, 10:07 AM.

    #2
    Hello Brillo,

    Thank you for your reply.

    The reason there's not an independent setting for the outlines is that it's very simple to change the outline color based on which way the bar moves. I'm attaching an example indicator (ColoredOutlines) that does exactly what you're looking for - lets the user define colors for the outlines of the up, down, and doji bars (when open = close so there's no true bar direction). However, this indicator does so by using the CandleOutlineBrush and won't let you define the width of the outline or the dash style.

    I've managed to make a sort of hybrid version that uses strokes to affect the Strokes of the selected ChartStyle. The main issue is that there's not separate Strokes for up bars and down bars, so while you could change those, you'd need to change them both to the same thing for the chart to actually change to that thing. I've attached that indicator as well so you can compare the two.

    Really, it would be best to most likely get the colors, line width, and dash style separately and then assign the width and dash style to ChartBars.Properties.ChartStyle.Stroke (which is the outline for the candle body) and ChartBars.Properties.ChartStyle.Stroke2 (which is the outline for the wicks) and use CandleOutlineBrush to change the color based on what the user selects.

    Please let us know if we may be of further assistance to you.
    Attached Files

    Comment


      #3
      Thanks Kate,
      I got it working now.

      Comment

      Latest Posts

      Collapse

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