Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
Donchian Channel Trend following System for Amibroker (AFL)
Donchian Channel is a very powerful indicator to develop Trend following systems. It works extremely well in Trending markets both in Intraday and Daily timeframe. Donchian Channel is derived by calculating Highest High and Lowest Low for a pre-defined period. Any breakout of Donchian channel upper or lower band is considered as the starting of new trend. The Donchian channel is also useful for studying the volatility of price. If the price is stable Donchian channel will be relatively narrow. If the price fluctuates often the Donchian channel will be wider.
This strategy is based on the breakout of 5 Days Donchian Channel. The upper band of channel is formed by considering the Highest High value of last 5 days, while Lower band is formed by considering the Lowest Low of last 5 days. An additional middle band is formed by taking mean of upper and lower band. This middle band would be utilized to exit Long or Short positions. Additionally, Trailing stop loss has been introduced into the system for risk management. This stop loss is based on 25 Periods of Average True Range (ATR).
Read more about this strategy and download the detailed backtest report here
Screenshots
Indicator / Formula
//------------------------------------------------------ // // Formula Name: Donchian Channel trading System // Author/Uploader: Trading Tuitions // E-mail: support@tradingtuitions.com // Website: www.tradingtuitions.com //------------------------------------------------------ _SECTION_BEGIN("Donchian Channel trading System"); SetChartOptions(0,chartShowArrows|chartShowDates); _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C )); //Initial Parameters SetTradeDelays( 0,0,0, 0 ); SetOption( "InitialEquity", 200000); SetOption("FuturesMode" ,True); SetOption("MinShares",1); SetOption("CommissionMode",2); SetOption("CommissionAmount",100); SetOption("AccountMargin",10); SetOption("RefreshWhenCompleted",True); SetPositionSize(150,spsShares); SetOption( "AllowPositionShrinking", True ); Plot( Close, "Price", colorWhite, styleCandle ); pds=Param("DonchianPeriods",5,5,100,5); DonchianUpper =HHV(Ref(H,-1),pds); DonchianLower = LLV(Ref(L,-1),pds); DonchianMiddle = (DonchianUpper+DonchianLower)/2; printf("\nDonchianUpper : " + DonchianUpper ); printf("\nDonchianLower : " + DonchianLower ); printf("\nDonchianMiddle : " + DonchianMiddle ); Plot(DonchianUpper,"DU",colorBlue,styleLine); Plot(DonchianMiddle,"DM",colorGreen,styleLine); Plot(DonchianLower,"DL",colorRed,styleLine); ATRMultiplier=Param("ATRMultiplier",5,1,5,1); ATRPeriods=Param("ATRPeriods",25,5,25,1); Buy=Cross(High,DonchianUpper); Short=Cross(DonchianLower,Low); Sell=Cross(DonchianMiddle,Low); Cover=Cross(High,DonchianMiddle); BuyPrice=DonchianUpper; SellPrice=DonchianMiddle; ShortPrice=DonchianLower; CoverPrice=DonchianMiddle; Buy = ExRem(Buy,Sell); Sell = ExRem(Sell,Buy); Short=ExRem(Short,Cover); Cover=ExRem(Cover,Short); ApplyStop(stopTypeTrailing, stopModePoint, ATRMultiplier*ATR(ATRPeriods), True, True ); printf("\nBuy : " + Buy ); printf("\nSell : " + Sell ); printf("\nShort : " + Short ); printf("\nCover : " + Cover ); /* Plot Buy and Sell Signal Arrows */ PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-25); PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-35); PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-30); PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=25); PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=35); PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-30); PlotShapes(IIf(Sell, shapeStar, shapeNone),colorGold, 0, L, Offset=-15); PlotShapes(IIf(Cover, shapeStar, shapeNone),colorGold, 0,L, Offset=-15); _SECTION_END();
2 comments
Leave Comment
Please login here to leave a comment.
Back
not work?
How to correct it?
_N(Title = StrFormat(“{{NAME}} – {{INTERVAL}} {{DATE}} Open g, Hi %g, Lo %g, Close %g (.1f%%) {{VALUES}}”, O, H, L, C ));
try this :
_N(Title = StrFormat(“{{NAME}} – {{INTERVAL}} {{DATE}} Open g, Hi %g, Lo %g, Close %g (.1f%%) {{VALUES}}”, O, H, L, C, SelectedValue( ROC ) ));