Donchian Channel
The classic Donchian channel breakout strategy. The upper channel border is the high of N candles, the lower one is the low of N candles, the center is midway between them.
Entry: a stop buy order at the upper border and a stop sell order at the lower one. Entry orders are placed only after the price has returned to the channel center.
This protects against entering an already stretched move right after the previous trade.
Exit: stop-loss - a stop order at the channel center, take-profit - a limit order a set % beyond the channel border. The stop and take levels move together with the channel.
⚠️ Like any breakout strategy, it loses in a sideways market: the price touches the border and returns to the center.
Order type used: Market Stop order (entry and stop) and Limit (take-profit).
Parameters
channel_len- channel length in candles (default 25)use_tp,tp- enable the take-profit and its offset in % from the channel border (default 10%)- If the price has moved beyond the opposite channel border by more than 1%, the position is closed with a market order (protection against gaps)
Backtest
Test in the built-in backtester
The script code (PineScript) for the TradingView strategy tester "[TV] Donchian Channel" is available in the bot interface on the strategy page.
Backtest the strategy on historical data in the tester and run it in hamster-bot.