A problem with candle series

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
SSWang
Newbie
Newbie
Posts: 10
Joined: Mon Mar 14, 2011 12:00 am

A problem with candle series

Post by SSWang » Tue Mar 06, 2012 6:32 am

Hi,

There is a problem in the attached image. The first data should be charted as a solid T shape, but the resulting vertical line turned out to shift 1 pixel downward that creates a disconnected gap. How can I fix that? thanks. (this one pixel gap gets even worse if I set Border.Visible := False)
Attachments
candle1.png
candle1.png (9.32 KiB) Viewed 8879 times

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: A problem with candle series

Post by Narcís » Wed Mar 07, 2012 1:09 pm

Hi SSWang,

Could you please attach a simple example project we can run "as-is" to reproduce the problem here and let us know the exact TeeChart version you are using?

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

SSWang
Newbie
Newbie
Posts: 10
Joined: Mon Mar 14, 2011 12:00 am

Re: A problem with candle series

Post by SSWang » Thu Mar 08, 2012 6:34 am

Narcís wrote:Hi SSWang,

Could you please attach a simple example project we can run "as-is" to reproduce the problem here and let us know the exact TeeChart version you are using?

Thanks in advance.
I'm using following version with D2010:
===============================================
Release Notes 17th November 2011
TeeChart VCL version 2011
Build 2011.04.41118
===============================================

Please check the project's first data, thanks.
Attachments
CandleProblem.png
CandleProblem.png (55.09 KiB) Viewed 8761 times
CandleProblem.zip
(66.25 KiB) Downloaded 565 times

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: A problem with candle series

Post by Yeray » Fri Mar 09, 2012 5:09 pm

Hi,

The Candle series basically draws a line from High to Low values and a rectangle from Open to Close values. It assumes having a High&Low values both greater or smaller than both Open&Close has no sense.
https://en.wikipedia.org/wiki/Candlestick_chart
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

SSWang
Newbie
Newbie
Posts: 10
Joined: Mon Mar 14, 2011 12:00 am

Re: A problem with candle series

Post by SSWang » Mon Mar 12, 2012 3:12 am

Yeray wrote:Hi,

The Candle series basically draws a line from High to Low values and a rectangle from Open to Close values. It assumes having a High&Low values both greater or smaller than both Open&Close has no sense.
https://en.wikipedia.org/wiki/Candlestick_chart
Yes, but what you have mentioned is not the case that I reported. Allow me to explain this by taking the first attached image from top of this thread for example. First, the "Open value"=637 equals to "Close value", which is quite common in stock pricing, makes the rectangle part of OHLC look like a horizontal line. Second, the "High value" is also 637, which indicates that the "Open value" is also the highest among its period. This is again, frequently seen in stock pricing. Now the problem comes: If the top end of vertical line of OHLC, which is "High value", is disconnected to horizontal line and leaving a gap, it tells a story that the Open and Close values are even higher than defined "High value". That makes no sense to OHLC. So the chart must draw a perfect T in this case (and a perfect vertical inverted T for opposit case). Please correct me if there are mistakes, thanks.

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: A problem with candle series

Post by Yeray » Wed Mar 14, 2012 10:01 am

Hi SSWang,

You are right. I misunderstood it.

A Candle with the same Open, Close and High values should be drawn as a perfect "T". But right now the is a pixel separating the horizontal and the vertical lines.
A Candle with the same Open, Close and Low values should be drawn as a perfect inverted "T". But right now the is an extra pixel drawn below the horizontal line.

I've added it to the defect list to be fixed asap (TV52016086). I've actually found a possible fix, but it should be studied if it could break something else.
However, feel free to apply the change to the sources if you are a source code customer.
In CandleCh.pas, in the TCandleSeries.DrawValue method, change this:

Code: Select all

           if View3D then
              VertLine3D(tmpX,yLow,yHigh,MiddleZ)
           else
              DoVertLine(tmpX,yLow,yHigh);
For this:

Code: Select all

           if View3D then
              VertLine3D(tmpX,yHigh,yLow,MiddleZ)
           else
              DoVertLine(tmpX,yHigh,yLow);
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: A problem with candle series

Post by Narcís » Thu Jun 07, 2012 9:54 am

Hi SSWang,

We decided to implement Yeray's fix suggestion for the next TeeChart VCL maintenance release.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply