Double Donchian Trading System – Amibroker AFL code

Double Donchian Trading system is a Breakout trading system inspired from Richard J.Dennis. Donchian channels were developed by Richard Donchian, a pioneer of mechanical trend following systems. Double Donchian trading system is a turtle trading strategy.Curtis Faith in his book Way Of The Turtle describes a variation of the Donchian system used by the legendary Turtle Traders.
Double Donchain Trading System

Long Entry Rules
Long Entry is made whenever candlestick breaks the outer upper Donchian Channel for the first time on the upper side.

Short Entry Rule
Short Entry is made whenever candlestick breaks the outer Lower Donchian Channel for the first time on the lower side.

Long Exit Rules
Long Entry is made whenever candlestick breaks the inner lower Donchian Channel for the first time on the lower side.

Short Entry Rule
Short Entry is made whenever candlestick breaks the inner upper Donchian Channel for the first time on the upper side.

The Buy and Sell Rules are represented as

Buy = H>Ref(DonchianUpper1,-1);
Short = L<Ref(DonchianLower1,-1);
Cover = H>Ref(DonchianUpper2,-1);
Sell = L<Ref(DonchianLower2,-1);

Further Exrem is used to eliminate the subsequent signals other than the first breakout signal.

The entry and exit signals on the charts are marked as follows

Long Entry – Green Arrow , Short Entry – Red Arrow, Long Exit – Green Star, Short Exit – Red Star

Double Donchain Trading System Amibroker AFL code

Which is the ideal timeframe to follow?

5min, 10min, 15min timeframes for Stocks/Indices. 10min,15min,30min for commodities

What is the Max Winning ratio i can expect?
anywhere between 40-45% across different timeframes.

Can i use the parameter for my studies in other stock/Indices
This parameter is optimized for Nifty and Bank Nifty. Do your own studies and observation with different parameters.

What is the benifit of trading this system?
It is a low risk trading system with the Max Drawdown% of 13% with 2 lots of Nifty and 2 Lakhs of capital(brokerage included)

Double Donchain Trading System Backtest Results for Nifty Spot Since March 2009 to 10th May 2014

Equity Curve
1. Portfolio Equity
Drawdown Curve
2. Underwater Equity
Profit Table
3. Profit Table

Related Readings and Observations

  • How to Plot Bid Vs Ask Dashboard in Amibroker Here is a little Bid Vs Ask Dashboard for Amibroker users which helps to monitor the Bid-Ask Spread during live trading. In a highly liquid market the Bid Ask spread difference will be […]
  • Simple Smoothed RSI Crossover Strategy Here is the simple smoothed RSI crossover strategy can be practiced on higher timeframes especially with daily timeframes with controlled risk. It catches the big trends and gets little […]
  • Intraday Gap Up and Gap Down – Amibroker Strategy Strategy is very simple. when the market open with gap up and at the same time ,it crossed the previous day high then it should be considered as strong buy. When the market open with gap […]
  • ATR Volatility Long Only Trading System Yet another ATR Volatility based Long only Trading System. ATR Volatility system a mechanical strategy for higher time-frames Written by Tudor Marcelin - Art Invest. Just modified the […]

Comments

  1. Rajiv says

    Sir,

    Thanks for the sharing the system. I am not able o backtest this code, the scan shows me the no of rows with Buy/Sell but, the backtest yields no results. I believe using a leading indicator can increase the win% and a better CAR/MDD. Can you plz help me backtest the code

  2. Rajesh R says

    Hello Rajendran,

    I could not load the Double Donchain AFL code as it throws me the following message

    “Error line 16
    Too many arguments.”

    Request you to verify the error code and upload the workable afl code for donchain.

    Regards
    Rajesh R

  3. Koushik says

    After adding following lines, this AFL gives terrible negative profits

    BuyPrice = Open;
    CoverPrice = Open;
    ShortPrice = Open;
    SellPrice = Open;
    SetTradeDelays( 1, 1, 1, 1 );

    • says

      Hi,

      SetTradeDelays( 1, 1, 1, 1 ); is more than enough condition. BuyPrice = open statement is misleading and the rest of the three variables could give you wrong picture about the system.

  4. Rajesh R says

    Can we have double donchain AFL code for the EOD. we do not have option in our office to check markets.

    Regards
    Rajesh R

Leave a Reply

Your email address will not be published. Required fields are marked *