Book Image

Learning jqPlot

By : Scott Gottreu
Book Image

Learning jqPlot

By: Scott Gottreu

Overview of this book

Table of Contents (19 chapters)
Learning jqPlot
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Chapter 7, Stock Market Charts – OHLC and Candlestick Charts


  1. OHLC stands for open, high, low, close.

  2. A candlestick chart is composed of the body and the shadow. The shadow extending from the top of the body is called the wick, and the shadow extending from the bottom of the body is called the tail.

  3. In order to skip a value, we need to pass in the position of each value in the data array. For our OHLC chart, we have five values: date, opening price, high price, low price, and closing price. The date is in position 1, while the closing price is in position 5. If we want to show the opening price and the closing price separated by a line break, we will format our string as %2$.2f<br>%5$.2f.

  4. The cursor plugin contains the zoom functionality.

  5. The first option is fillUpBody and it needs to be set to true. This will cause all our candlesticks to be colored. Next, we set upBodyColor and downBodyColor to the colors we choose to represent prices that closed higher and lower than the opening price.

  6. If there is a stock split, it will be good to represent on the chart. A company buyout or merger will also be relevant. Really, any news that contributes to large movements of the stock will be useful.

  7. The date values for a canvas overlay line need to be converted to an epoch timestamp, which is the number of seconds since January 1, 1970.

  8. Revenue and profit will be the most obvious choices. However, there are many other options. We can graph out our expenses. We can also represent the market share of our competitors to find correlations with our stock price.