Book Image

Sencha Charts Essentials

By : Ajit Kumar
Book Image

Sencha Charts Essentials

By: Ajit Kumar

Overview of this book

Table of Contents (16 chapters)
Sencha Charts Essentials
About the Author
About the Reviewers

Creating a new financial chart

In this section, you will see how to create a custom stock chart—MACD—that is a momentum oscillator offering trend following and momentum. It fluctuates above and below the zero level.


You can read more about this at

What is this chart all about?

Let's derive the technical requirements for the MACD chart, which we will use as a foundation to implement our custom chart.

For the MACD chart, based on the stock data that contains open, high, low, and close values for different time instances, the following values need to be calculated:

  • 12-day Exponential Moving Average (EMA)

  • 26-day EMA

Once the preceding values are calculated, the MACD-related values will be calculated for a record, by applying the following formulae:

  • MACD line = 12-day EMA - 26-day EMA

  • Signal line = 9-day EMA of MACD line

  • MACD histogram = MACD - Signal line

After the MACD line, signal line, and histogram values have been calculated, we need to draw a chart between...