Note from Towards Data Science’s editors:_ While we allow independent authors to publish articles in accordance with our rules and guidelines, we do not endorse each author’s contribution. You should not rely on an author’s works without seeking professional advice. See our Reader Terms for details._

Trading is divided into many different strategies that rely on trend-following, mean reversion, volatility, or other factors. Successful strategies rely on the current market state, for example, when markets are strongly trending, mean reversion strategies tend to fail and therefore we always have to adapt our market approach accordingly. Below is a breakout strategy that uses an indicator called the Donchian Channel. The basic idea is to make ranges as objective as we can (i.e. measurable) and then trade on the breakout (i.e. the start of a trend). The goal of the article is therefore to see whether this indicator can add value into our overall trading system or not. Does it provide good signals? Are the triggers to be taken seriously?

The Donchian Channel

Created by Richard Donchian, this simple and great indicator is used to identify breakouts and reversals. Just like the Bollinger bands, it is used in an almost similar fashion. Our goal is to determine objectively a range exit by the surpass or break of any of the barriers. The way it is formed is by first calculating the maximum of the last n-period highs and the minimum of the last n-period lows, then calculating the average of them both. This gives us three measures: The Donchian upper band, the lower band, and the middle band. Here’s the mathematical formula followed later by the Python code used on an OHLC data structure.

#finance #algorithms #trading #forex #data-science #python

A Simple Breakout Trading Strategy in Python.
34.10 GEEK