MIP Logo

Calculate MACD Indicator and Make Stock Market Dashboard In Tableau

This post was originally published on The Data School blog between 2018 and July 2025, before our program was renamed to MIP’s Analytics Career Accelerator. References throughout this article to “The Data School” or “DS” all refer to what is now MIP’s Analytics Career Accelerator. The program, its people, and its commitment to launching outstanding analytics careers remain the same – just under a new name.

If you are having trouble viewing this article, please report it here. 

In this blog, I will make ASX200 stocks market dashboard with the moving average convergence divergence (MACD) indicator in the tableau. The MACD indicator is a common tool used by traders to identify the stock momentum.

Data preparation

Yahoo! Finance https://au.finance.yahoo.com/australia/ is an excellent website that provides financial news, stock quotes, press releases, and financial reports. In this case study, I use the yfinance library in python to download the ASX200 stock daily historical data for the past five years.

A MACD chart includes three parts. The first part is the difference between the 12-day and 26-day exponential moving average (EMA) of the closing price; this is the MACD line. The second part is the EMA of the difference, which is known as the signal line. The third part is call histogram which is the MCAD minus the signal

MACD Formula:

  • MACD Line: (12-day EMA – 26-day EMA)
  • Signal Line: 9-day EMA of MACD Line
  • MACD Histogram: MACD Line – Signal Line

Part1 MACD Line: (12-day EMA – 26-day EMA)

(1) 12-day EMA:

(2)26-day EMA

(3)MACD line

Part2 Signal Line: 9-day EMA of MACD Line

Part 3 MACD Histogram: MACD Line – Signal Line

After making all the above calculations, drag MACD Line and Signal Line into the canvas as line chart and pull MACD Histogram as Bar chart

The ASX200 Stock Market Dashboard

I divide the stock market dashboard into two pages; The first page is the overview of the daily performance of the ASX200 index and a Treemap visualization of the stock where boxes size indicate companies’ market capital, a color incident the daily Up/Down trend. Users can also filter the date and sector to focus on a specific group of stocks in the Treemap. When the user clicks the stock in Treemap and tooltips pop up, which can direct the user to the MACD analysis page for further analysis.

Dashboard link:

https://public.tableau.com/app/profile/gary.li.j.h./viz/Asx200StockDashboardV1_0/Main

 

 

 

Share this post