Rajandran R Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, USDINR and High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in and Co-Creator of Algomojo (Algorithmic Trading Platform for DIY Traders)

Double Donchian Trading System – Amibroker AFL code

1 min read

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

[wp_ad_camp_5]

 
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

Rajandran R Telecom Engineer turned Full-time Derivative Trader. Mostly Trading Nifty, Banknifty, USDINR and High Liquid Stock Derivatives. Trading the Markets Since 2006 onwards. Using Market Profile and Orderflow for more than a decade. Designed and published 100+ open source trading systems on various trading tools. Strongly believe that market understanding and robust trading frameworks are the key to the trading success. Writing about Markets, Trading System Design, Market Sentiment, Trading Softwares & Trading Nuances since 2007 onwards. Author of Marketcalls.in and Co-Creator of Algomojo (Algorithmic Trading Platform for DIY Traders)

Plotting Day Wise Equity Curve using Amibroker

We know that Amibroker provides an equity curve for the whole strategy. Is there a way where we can build a simple Day Wise...
Rajandran R
1 min read

Simple Open Range Breakout Trading System with Exploration –…

Opening Range is very often a measure of security high and low generally monitored by breakout traders to gauge the sentiment of the market....
Rajandran R
5 min read

Range Filter – Trading Strategy – Amibroker – Better…

Range Filter is a non-ATR-based trend following strategy inspired by Tradingview Pinescript coder - DonovanWall. According to him, Range Filter is an experimental study...
Rajandran R
4 min read

16 Replies to “Double Donchian Trading System – Amibroker AFL code”

  1. 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. 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. After adding following lines, this AFL gives terrible negative profits

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

    1. 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. Whats the parameter for Nifty and Bank nifty Positional Trading(Daily Timeframe)

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

    Regards
    Rajesh R

  6. Dear Rajendran,
    hav u used money management while backtesting this strategy?.. like u started with 2 lots for 2 lakhs. when ur capital grows to 3lakhs, do u trade with 3 lots or 2 lots for full backtesting period??

      1. K. In ur above back testing result, which money management method u used??. Whether u have increased ur position with increase in trading capital????..

Leave a Reply

Get Notifications, Alerts on Market Updates, Trading Tools, Automation & More