📊

Trading Strategy with Donchian Channel and EMA

Jul 7, 2024

Trading Strategy with Donchian Channel and EMA

Introduction

  • Presenter: Pranit
  • Topic: Building and backtesting a trading strategy with the Donchian Channel indicator
  • Key Metrics:
    • Net profit: 25%
    • Total closed trades: 388
    • Profit factor: 1.3
    • Max drawdown: 15%

Membership Offer

  • Benefits: Lifetime access to:
    • All courses
    • Advanced trading indicators
    • Backtested trading strategies
    • 4 Bonuses:
      • Trading filters
      • Codex for easy coding
      • Exclusive trading insights with backtest evidence
      • Various strategy templates to facilitate backtesting
  • Cost: Originally $120,000, now $4,999
  • Link: Provided in the description

Strategy Development

Indicators Used

  • Donchian Channel
  • EMA (Exponential Moving Average)

User Inputs

  • Donchian Channel Length (DCL): Default value - 21
  • EMA Lengths: Short (13), Medium (34), Long (100)

Coding the Indicators

  1. Donchian Channel
    • Upper Band: ta.highest(high, DCL)
    • Lower Band: ta.lowest(low, DCL)
    • Middle Line: Average of the Upper and Lower Bands
  2. EMA
    • ema(close, length), with lengths of 13, 34, and 100

Buy and Sell Rules

  • Buy Rule: `ta.crossover(close, upperBand)
  • Short Rule: `ta.crossunder(close, lowerBand)
  • Sell Rule - Exit using EMA:
    • Buy exit: ta.crossunder(EMA 13, EMA 34) and close > EMA 100
    • Short exit: ta.crossover(EMA 13, EMA 34) and close < EMA 100

Strategy Implementation

  • Strategy Functions
    • strategy.entry() for long and short positions
    • strategy.close() for exiting positions

Plotting the Indicators

  • Plot Donchian Channel
    • Upper Band
    • Lower Band
    • Middle Line
    • Colors: Upper (Green), Lower (Red), Middle (White)
  • Plot EMAs
    • EMA 13: Orange
    • EMA 34: Lime
    • EMA 100: Aqua

Example Trades

  • Long Example:
    • Enter: Price breaks upper Donchian Channel
    • Exit: EMA 13 crosses below EMA 34
  • Short Example:
    • Enter: Price breaks lower Donchian Channel
    • Exit: EMA 13 crosses above EMA 34

Strategy Tester Results

  • Initial Capital: Set to 2L
  • Commission: Set to 0.02
  • Performance:
    • Net profit: 245%
    • Drawdown: ~15%
    • Long returns: 185%
    • Short returns: 60%
    • Equity curve and performance summary
  • Adjustments:
    • Option to filter out shorts for smoother equity curve, resulting in a 22% drawdown

Conclusion

  • Verification: Strategy tested, verified signals
  • Resources: Pine script course link in description
  • Contact: WhatsApp Business number for queries
  • Additional Videos: Links to other coded strategies in description
  • Call to Action: Subscribe and comment for more content and feedback

Thank you for watching! See you in the next video.