In Defense of Very Long Novels

Why long and flash fiction both deserve our attention.

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Creating Equity Curves in Python to Visualise Trading Strategy Performance

Sometimes a picture speaks a thousand words when it comes to evaluating trading strategy performance!

The end result of developing and backtesting any trading strategy is typically a set of statistics that indicate how well the strategy has performed in the past. However, I have found that whilst helpful, seeing raw statistics doesn’t give you the full picture.

A simple technique I have used to understand the performance of a strategy is to create simple visualisations. For example, by plotting the equity curve as a function of time and shading the regions where the strategy produces winning and losing trades.

Here is an example for a simple Moving Average Convergence Divergence strategy applied to the BTC-USD trading pair:

The equity curve of a MACD strategy applied to the BTC-USD trading pair. The green regions denote the time spent in winning trades, and the red regions for losing trades.

In my opinion, charts such as the above make it more straightforward to see the overall picture of strategy performance. For example, I can quickly see that:

And that was a super quick analysis — a longer stare will surely reveal more!

In this article I will share how these charts can be made rather easily in Python using the plotly library. I will include the base code in this article which will create the above image; you can afterwards fine-tune that code to your liking.

Side note: The excellent feature of plotly is that it creates an interactive chart in your browser, so you can zoom in, turn on/off different chart elements and download screenshots!

For the purpose of demonstration, we are going to consider a simple strategy based on the MACD technical analysis indicator.

Add a comment

Related posts:

How to hire an amazing first salesperson for your business

Dominic is the Founder and Director of Monkhouse & Company, a Business Coaching company for high-growth tech firms. If you’re passionate about growth, email him at dom@monkhouseandcompany.com. You’re…

Dr Seuss I will eat Krispy Kreme Sweatshirt

This sweatshirt is Made To Order, one by one printed so we can control the quality. We use newest DTG Technology to print on to Sweatshirt Color variant is black, gray, white , and Many More…

Adakah terdapat ubat yang boleh menyembuhkan HIV AIDS pada lelaki dan wanita?

HIV adalah pendek untuk Human Immunodeficiency Virus. Virus menyerang sistem imun. Virus ini melemahkan keupayaan tubuh untuk melawan jangkitan dan penyakit. Virus ini menyerang manusia dan menyerang…