Fwd: Candlestick charts

6 views
Skip to first unread message

Malcolm Wallace

unread,
Oct 8, 2010, 6:14:50 AM10/8/10
to Haskell Chart List
I don't think this patch email got through to the Haskell-Chart list
before (I sent it from the wrong account), so here it is again.

Begin forwarded message:
>>> What are the libraries to use in Haskell to generate a stock
>>> candlestick chart like
>>> http://stockcharts.com/h-sc/ui?s=SPY&p=D&b=5&g=5&id=p05007254056
>
>> The chart library:
>> http://hackage.haskell.org/package/Chart
>> doesn't currently have support for candlestick charts, but adding
>> support would be straightforward - a patch would be most welcome
>> (hint, hint!).
>
> I have a patch for Chart, adding candles as a new plot type. Patch
> attached, together with a PNG of some demo output. (patch
> containing demo/test to follow.)
>
> Regards,
> Malcolm
>

candle.dpatch
aapl4.png

Tim Docker

unread,
Oct 8, 2010, 6:54:28 AM10/8/10
to haskell...@googlegroups.com
Wow - ask and yea shall receive :-)

I'll push this in the next couple of days. A release is overdue, so
I'll make that happen next week. I was hoping to sort out unicode
support before, but perhaps that can wait for now.

Thanks!

Tim

> <candle.dpatch><aapl4.png>--
> You received this message because you are subscribed to the Google
> Groups "Haskell Charts" group.
> To post to this group, send email to haskell...@googlegroups.com.
> To unsubscribe from this group, send email to haskell-chart...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/haskell-charts?hl=en
> .
>

Tim Docker

unread,
Oct 10, 2010, 12:06:57 AM10/10/10
to haskell...@googlegroups.com
Hi Malcolm,

>> I have a patch for Chart, adding candles as a new plot type. Patch
>> attached, together with a PNG of some demo output. (patch containing
>> demo/test to follow.)

Thanks for this. I've not dealt much with candlestick charts before. A
few questions:

* Taking a look at http://en.wikipedia.org/wiki/Candlestick_chart I see
that what you refer to as the q1 and q3 levels are generally the open
and closing stock prices. I'm wondering why you called them this? It
seems that often the fill depends on whether the open was greater than
the close, or otherwise. This would be less clear with the variables
named q1 and q3.

* What does the candle_y value represent?

* I think you are missing a fill style? But as referred to above,
perhaps there should be two fill styles?

Tim


Malcolm Wallace

unread,
Oct 9, 2010, 10:06:26 AM10/9/10
to haskell...@googlegroups.com

Drat! You did some research on the semantics of the things, whereas I
just copied some pictures I had seen. :-)

> I see that what you refer to as the q1 and q3 levels are generally
> the open and closing stock prices.

I had fondly imagined these candlesticks were used to represent
statistical spreads (minimum, first quartile, median, second quartile,
maximum), hence the names I chose for the levels. It appears their
intended application is more restricted.

> It seems that often the fill depends on whether the open was greater
> than the close, or otherwise.

Yeah, you are right. According to that page, there should be a fill
style, and it should only apply when the close price is lower than the
opening.

> * What does the candle_y value represent?

That was intended to be the median point (i.e. the centre of the
statistical distribution). It should not be needed, according to
wikipedia.

I'll roll an additional patch.

Regards,
Malcolm

Tim Docker

unread,
Oct 10, 2010, 1:25:39 AM10/10/10
to haskell...@googlegroups.com
On 09/10/10 09:06, Malcolm Wallace wrote:
> I'll roll an additional patch.

Thanks. A test would be good also :-)

Tim

Malcolm Wallace

unread,
Oct 11, 2010, 4:13:36 PM10/11/10
to Haskell Chart List
> I'll roll an additional patch.

Additional patch attached (together with the original one).

I have also bundled a couple of fresh patches to allow the
PlotAnnotation style to render a multi-line textual annotation.
Previously, newlines were simply turned into spaces.

Regards,
Malcolm

Malcolm Wallace

unread,
Oct 11, 2010, 4:14:28 PM10/11/10
to Haskell Chart List
> Additional patch attached (together with the original one).

This time, with attachment.

fresh.patches

Malcolm Wallace

unread,
Oct 12, 2010, 3:38:14 PM10/12/10
to Haskell Chart List

On 11 Oct 2010, at 21:14, Malcolm Wallace wrote:

>> Additional patch attached (together with the original one).
>
> This time, with attachment.

And here is a patch containing a test (Test17) for candle plots.

Regards,
Malcolm

candletest.dpatch

Tim Docker

unread,
Oct 15, 2010, 8:25:16 AM10/15/10
to haskell...@googlegroups.com

> And here is a patch containing a test (Test17) for candle plots.
>

All pushed - the candlestick charts look nice. Thanks Malcolm. I am
currently doing the file reorganisation to split the growing Plot and
Axis files. Once this is done I'll do a new release to hackage.

Tim

Reply all
Reply to author
Forward
0 new messages