The SuperTrend Indicator in Python — Coding and Back-Testing Its Strategy

How to code it, back-test it, and evaluate it on FX Trading

Sofien Kaabar, CFA
The Startup
Published in
8 min readOct 28, 2020

--

This rare gem is a trend-following indicator that can be used either as a trading system or as a way to place your stops. We will introduce the intuition of the SuperTrend indicator, code it in Python, back-test a few strategies, and present our conclusion. Of course, just like any other indicator, the SuperTrend can find its place within a bigger trading system but not take over the whole decision-making process.

I have just published a new book after the success of New Technical Indicators in Python. It features a more complete description and addition of complex trading strategies with a Github page dedicated to the continuously updated code. If you feel that this interests you, feel free to visit the below link, or if you prefer to buy the PDF version, you could contact me on Linkedin.

Building Blocks

The first concept we should understand before creating the SuperTrend indicator is volatility. We sometimes measure volatility using the Average True Range. Although the ATR is considered a lagging indicator, it gives some insights as to…

--

--