Quoting Wikipedia:
A candlestick chart is a style of bar-chart used primarily to describe price movements of an equity over time.
It is a combination of a line-chart and a bar-chart in that each bar represents the range of price movement over a given time interval. It is most often used in technical analysis of equity price patterns.
A Candlestick diagram often displays a “candlestick” with opening, closing, minimum and maximum rates over a given time period. The opening rate will (most often) be the closing rate of the previous entry.
The candlestick show the following values:
| ID | Meaning |
|---|---|
| A | Maximum rate |
| B | Opening / Closing rate |
| C | Minimum rate |
Where B is normally show with green/white if the opening rate was less that the closing rate (i.e. the stock or exchange rate rose during the period) or red/black if the closing was less than the opening rate (i.e. a fall in rate).
There are a number of Candlestick patterns that have actual names, these are described at Wikipedia
A Candlestick chart in Image_Graph requires nothing but a special formatted dataset, where the y-values consist of an array of values (i.e. the minimum, maximum, opening and closing values).
This is done by:
$Dataset =& Image_Graph::factory('dataset'); $Dataset->addPoint( '10:00', array( 'min' => 10, 'open' => 12, 'close' => 17, 'max' => 21 ) ); $Dataset->addPoint( '10:30', array( 'min' => 15, 'open' => 17, 'close' => 19, 'max' => 29 ) );
Note: The opening value of point #2 is the same as the closing value of point #1. This is the normal behaviour, but Image_Graph currently requires this to be set explicitly. In a future version this requirement will be removed, so that it is only required to specify the opening value on the first point, the closing value the cascades through the dataset as the opening for the next candlestick.
After populating the dataset, it is simply to add the Candlestick plot to the plotarea:
$Plot =& $Plotarea->addNew('Image_Graph_Plot_CandleStick', $Dataset);