How to plot simple and Candlestick chart using Python – pandas matplotlib

Pandas and Matplotlib can be used to plot various types of graphs. Simple timeseries plot and candlestick are basic graphs used by technical analyst for identifying the trend.

Simple time Series Chart using Python – pandas matplotlib

Here is the simplest graph. It uses close price of HDFCBANK for last 24 months to plot normal graph

Here is the sample output

Candlestick chart using Python – pandas matplotlib

As per this link, module matplotlib.finance is deprecated in 2.0 and has been moved to a module called mpl_finance. This is still working when I have motplotlib version 2.1.2. This may stop working in any future releases, however, you can use mpl_finance module to use this feature. Please note that mpl_finance is no longer maintained.

 

Here is the output

Candlestick chart with SMA overlay using Python – pandas matplotlib

here is the output

5 Replies to “How to plot simple and Candlestick chart using Python – pandas matplotlib”

  1. hi, thanks for this post.
    if only I knew what was in ’15-06-2016-TO-14-06-2018HDFCBANKALLN.csv’ or how you got it it would be very helpful!
    cheers!

  2. Hi Pravin – Thanks for sharing. It looks wonderful. However – It would tremendously help me if we can have volume overlay at the bottom of the chart…Is that simple enough to do? Any pointer or help will be greatly appreciated. Once again Thank You for sharing

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.