Page 1 of 1

Changing candle series open tick color

Posted: Fri Mar 13, 2009 4:33 pm
by 9339638
Is there a way that I could just change the open tick color on an entire candle series and leave the high, low, close color unchanged? I am using version 7.07

Thanks,
David

Posted: Fri Mar 13, 2009 4:51 pm
by narcis
Hi David,

I'm afraid this is not possible for now. The only solution I can think of is overwritting your current series with a second series with different colors and high and close values being the same, for example.

However, I'm not sure about what would you like to get exactly. Would you like to paint the line going from the open value to high or low value in a different color? If not, please send us an image of what you'd expect. We will add your request to the wish-list to be considered for inclusion in future releases.

You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Thanks in advance.

Posted: Fri Mar 13, 2009 5:50 pm
by 9339638
Yes, I am only interested in changing the opening tick color which is the small horizontal line to the left of the vertical high / low line on a OHLC bar. Even better would be the ability to change the open tick color on each individual bar, not just globally for the entire series.

Thanks,
David

Posted: Fri Mar 13, 2009 6:09 pm
by 9339638
also, if you do end up adding it to a future release, other might also find it useful to be able to change the color of the close tick as well.

Posted: Mon Mar 16, 2009 9:24 am
by yeray
Hi David,

In the meanwhile, you always could draw lines directly to the canvas to achieve this. This could be a simple example you could extend:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues(25);
  Series1.CandleStyle := csCandleBar;
end;

procedure TForm1.Series1AfterDrawValues(Sender: TObject);
var i, XPos, YPos: Integer;
begin
  for i:=0 to Series1.Count-1 do
  begin
    XPos := Series1.CalcXPos(i);
    YPos := Chart1.Axes.Left.CalcPosValue(Series1.OpenValues.Items[i]);

    with Chart1.Canvas do
    begin
      Pen.Color := clRed;
      Line(XPos, YPos, XPos-(Series1.CandleWidth div 2)-1, YPos);
    end;
  end;
end;
Note that I supposed that you are working with CandleStyle as csCandleBar.

Posted: Mon Mar 16, 2009 1:24 pm
by 9339638
Thanks for the thinking. Although I am working with OHLC bars and decided on a more direct approach, I modified the source code with a few AssignVisiblePenColor calls in the right places and it works a treat.