Page 1 of 1
Drawing special symbols on Candlestick chart
Posted: Wed Jan 26, 2022 4:19 am
by 16492601
I am displaying a Candle series in a Chart window. Based on some algorithm, I would like to display some special symbol (say, up triangle, down triangle, arrow, etc.) on some elements of the series. The symbol may have to be displayed either above the candlestick or below it. How can I do this? Obviously, because the symbol is logically "tied" to certain candlesticks, they should not vanish when I zoom or scroll the chart.
- Rangarajan
Re: Drawing special symbols on Candlestick chart
Posted: Wed Jan 26, 2022 11:15 am
by yeray
Hello Rangarajan,
You could use a
TPointSeries
and use
OnGetPointerStyle
to modify its pointers as you wish. Ie:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
//...
with TPointSeries(Chart1.AddSeries(TPointSeries)) do
begin
Pointer.Size:=6;
AddXY(candleSeries.XValue[2], candleSeries.HighValues[2]);
AddXY(candleSeries.XValue[6], candleSeries.LowValues[6]);
OnGetPointerStyle:=SeriesGetPointerStyle;
end;
end;
function TForm1.SeriesGetPointerStyle(Sender: TChartSeries;
ValueIndex: Integer): TSeriesPointerStyle;
begin
case ValueIndex of
0: Result:=psTriangle;
1: Result:=psDownTriangle;
end;
end;
- Project1_2022-01-26_12-08-04.png (13.17 KiB) Viewed 8639 times
Re: Drawing special symbols on Candlestick chart
Posted: Wed Jan 26, 2022 12:33 pm
by 16492601
Looks good, thanks. Let me try this.
- Rangarajan
Re: Drawing special symbols on Candlestick chart
Posted: Thu Feb 03, 2022 11:50 am
by 16492601
Thanks again. It works as expected.
1) How would I handle the case where I need to draw vertical lines (in different colours) on candlestick chart, instead of symbols? The vertical lines need to span the entire height of the chart window without any specific Y values.
2) Is it possible to display arbitrary information when moving the mouse over each candlestick element? Or when clicking on a specific element?
- Rangarajan
Re: Drawing special symbols on Candlestick chart
Posted: Thu Feb 03, 2022 12:02 pm
by yeray
Hello Rangarajan,
Rangarajan wrote: ↑Thu Feb 03, 2022 11:50 am
1) How would I handle the case where I need to draw vertical lines (in different colours) on candlestick chart, instead of symbols? The vertical lines need to span the entire height of the chart window without any specific Y values.
This sounds like the
TColorLineTool
. Take a look at the ColorLine example in the Features Demo shipped with the installation.
- Tee9new_2022-02-03_12-58-42.png (250.87 KiB) Viewed 8557 times
Rangarajan wrote: ↑Thu Feb 03, 2022 11:50 am
2) Is it possible to display arbitrary information when moving the mouse over each candlestick element? Or when clicking on a specific element?
Have you seen the
MarksTipTool
?
- Tee9new_2022-02-03_13-01-18.png (278.68 KiB) Viewed 8557 times
Re: Drawing special symbols on Candlestick chart
Posted: Thu Feb 03, 2022 2:03 pm
by 16492601
Super! Thanks.
- Rangarajan