Type/to search

Trend Following Strategy with MACD and Donchian Channel

Cryptocurrency
Created: 2023-11-15 11:37:37
Last modified: 3 years ago
1
Follow
1779
Followers

img

Overview

This strategy combines the Donchian Channel indicator and MACD indicator to determine the trend. It belongs to a typical trend following strategy. It goes long when the price breaks out the upper band and MACD shows golden cross, and goes short when the price breaks the lower band and MACD shows death cross. The ATR indicator is used to calculate the stop loss.

Strategy Logic

  1. Calculate the MACD indicator, including fast line, slow line and histogram.

  2. Calculate the upper and lower Donchian Channel bands. The upper band is the highest price over N days, the lower band is the lowest price over N days.

  3. When the price breaks the upper band, and the MACD fast line crosses above the slow line, go long.

  4. When the price breaks the lower band, and the MACD fast line crosses below the slow line, go short.

  5. Use ATR indicator to calculate the stop loss for this strategy, which is set to ATR value multiplied by a coefficient from the current price.

  6. Close the position when a reverse signal appears.

Advantage Analysis

This strategy combines trend judgment indicators and channel indicators, which can effectively track trends. MACD indicator judges price trend and momentum. Donchian Channel judges direction. The ATR stop loss limits the loss per trade.

Advantages are:

  1. The strategy is simple with few parameters, easy to implement.

  2. It can open position along the trend, and capture trend opportunities in time.

  3. ATR stop loss controls risk.

  4. Drawdown can be controlled to some extent.

Risk Analysis

There are also some risks:

  1. Improper parameter settings of Donchian Channel may cause false signals.

  2. Improper MACD parameters may also lead to lagging signals.

  3. A too wide stop loss setting may lead to expanded loss.

  4. Sharp market reversal may lead to huge loss.

  5. The strategy tends to overtrade.

Solutions:

  1. Optimize parameters, select stocks cautiously.

  2. Strict stop loss, trailing stop loss.

  3. Adjust position sizing properly.

Optimization Directions

The strategy can be optimized in the following aspects:

  1. Optimize MACD parameters to improve sensitivity.

  2. Optimize stop loss algorithm to make it closer to price.

  3. Add position sizing mechanism according to trend strength.

  4. Add filters to avoid false signals.

  5. Add selection criteria for trading instruments.

  6. Add judgement of trading time period.

Summary

In summary, this is a typical trend following strategy. It combines Donchian Channel for trend direction and MACD for trend strength. It can follow the trend effectively and control risk. By optimizing parameters, stop loss, position sizing etc, the stability and profitability can be further improved. The strategy suits investors who require high accuracy in trend judgment.

Source
Pine
/*backtest
start: 2023-10-15 00:00:00
end: 2023-11-14 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/

// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Robrecht99

//@version=5
Strategy parameters
Strategy parameters
Fast Length
Slow Length
Source
Signal Smoothing
Oscillator MA Type
Signal Line MA Type
Color Settings
MACD Line  
Signal Line  
Histogram
Above   Grow
Fall
Below Grow
Fall
Donchian Channels Inputs
Length Upper Channel
Length Lower Channel
Fill Color
 Color Upper Channel
 Color Lower Channel
ATR Inputs
ATR Period
Risk Per Trade
ATR Multiplier
Comment
All comments (0)
No data
No data
  • 1
iPhone Download
Forums
PINE Language
© 2015 - ∞ INVENTOR PTE LTD (SG)