Given a time series object named price.ts with columns of "Open",
"High", "Low", "Close", "Volume"
The following line should produce a trellis plot with candlesticks
in the upper panel and volume bars in the lower panel:
trellisPlot(price.ts[,"Volume"],price.ts[,1:4],scales=list(y=list(relation="free")),
plot.type=c("stackbar","hloc"),type="c",trellis.args=(list(lwd=2,col=4,line.col=2,width=0.03)))
The width may need to be adjusted depending on density of the
data; the above setting work well for about 4 months of daily data.
Best,
-- Guy
Guy Yollin
Director of Financial Engineering
Insightful Corporation
gyollin@insightful.com
From:
s-news-owner@lists.biostat.wustl.edu
[mailto:s-news-owner@lists.biostat.wustl.edu] On
Behalf Of Olanrewaju Sanni
Sent: Monday, August 06, 2007 8:01
AM
To: s-news@wubios.wustl.edu
Subject: [S] Candlestick plot
Can any tell me how to plot candlestick chart with
s-plus finmetrics.
Park yourself in front of a world of choices in alternative vehicles.
Visit
the Yahoo! Auto Green Center.