Greg_007

Donchian Channels strategy with backtest

Greg_007 Updated   
Here's another trading strategy for you. This one is based on the standard Donchian Channels.

This one will - by default - wait for 2 consecutive higher highs (or lower lows) before taking a position. This can be disabled so the script will take a new trade without waiting for the 2nd high or low.
This is useful to avoid getting into a trade when market makers are aiming for a swing-failure pattern (= taking out stop/losses below the last low or above the last high)

For people who don't like to short, there's also the option to exclude shorts.

Enjoy!
Release Notes:
Code cleanup + change of backtesting with 100% of equity to 10% to meet tradingview house roules.
Release Notes:
Added buy, sell and close labels. The close label will show up when you don't want to go short.
Release Notes:
Fixed incorrect opening of the short positions.
Please rerun any backtest you have done, because this fix will affect your previous results.

Many thanks to liuqiba for pointing out this bug ;-)

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?