Raindrop charts are one of the latest chart types to appear in the financial industry. Brought forward by TrendSpider in a 2019 whitepaper, they offer a compelling alternative to traditional Japanese Candlestick charts.
Why should I use Raindrop charts?
When it comes to analyzing a stock’s price action, Japanese candlesticks are the go-to chart type. But they suffer from a significant drawback: they do not depict trading volumes. For this reason, they are often shown with a volume bar chart beneath them.
However, this still doesn’t give us a complete picture of the price action. The candlesticks do not illustrate how a stock was trading inside of a single candlestick. OHLC (open-high-low-close) prices do not necessarily reflect most trades. A typical example can be found in the presence of long legged Doji patterns. The Open and the Close are very similar but the price has moved heavily between the High and the Low. The candlestick chart just does not indicate if most trades were happening above or below the Open-Close line.
On the other hand, raindrop charts depict the volume profiles for the first and second half of each interval. The VWAP (volume-weighted average price) is usually shown using a horizontal line. Like this, we get a clearer picture of where most of the volume was trading and in what direction the market was moving.
So without further ado, let’s make our raindrop charts using Yfinance, Pandas, and Plotly.
With your anaconda prompt or terminal open, let’s type:
pip install yfinance plotly
Note: Pandas is included in yfinance.
To make raindrop plots, we need to group multiple data points into a single interval. For this reason, it is important to download the data in an interval that is smaller than the interval in which we want to plot. The smaller the interval, the more representative our charts will be of the true price action. In our example, we collect OHLC data for Apple in a 1 minute interval for a period of 3 days and we display the data in raindrops of 30min.
For our plot, we first need the typical price and the Price x Quantity values.
We then split the data into a Left or Right side of a raindrop and attribute the data to a particular raindrop by rounding down the Datetime
column using our plotting_interval
.
We first define what we consider to be a significant change in the VWAP using the margin
parameter (in our case 0.1).
Starting with an empty figure, we go through each raindrop period as such:
volume_divider
such that the interval with the highest volume only gets multiplied by 1000.More information on how to make/customize split-violin plots in Plotly can be found here: https://plotly.com/python/violin/#split-violin-plot
To make the graph more appealing, we give our figure a title, labels, and a few more touches. Note: We are hiding the hours during which the markets are closed to avoid having too many empty intervals.
Inthis tutorial, we have seen why and how to recreate raindrop charts in Python. If you liked this tutorial, then why not check out the live demo I made using Streamlit and Streamlit Cloud: https://share.streamlit.io/lucasjamar/raindrop-charts/main/app.py. It gives an interesting comparison between raindrops and candlesticks as they sometimes point in different directions🤔. The full code behind the app can be found on Github: https://github.com/lucasjamar/raindrop-charts
Otherwise, please let me know if you have any questions or feedback in the comment section below.
If you are interested in more amazing visualizations of financial data, why not have a look at my article on creating professional candlestick charts.