Stock Portfolio Organizer

The ultimate porfolio management solution.

Shares, Margin, CFD's, Futures and Forex
EOD and Realtime
Dividends and Trust Distributions
And Much More ....
For Portfolio Manager Click Here

WiseTrader Toolbox

#1 Selling Amibroker Plugin featuring:

Advanced Adaptive Indicators
Advanced Pattern Exploration
Neural Networks
And Much More ....
Find Out More Here

McGinley Dynamic Trading System for Amibroker (AFL)

Rating:
3 / 5 (Votes 5)
Tags:
trading system, amibroker

McGinely Dynamic indicator devised by John R.McGinley has been stated as the most reliable indicator at Investopedia. This indicator is more responsive to raw data as compared to simple moving average or exponential moving average. McGinely dynamic is supposed to avoid whipsaws when compared with any moving averages. It looks like a moving average line yet it is a smoothing mechanism for prices that turns out to track far better than any moving average. It minimizes price separation, price whipsaws and hugs prices much more closely.

Read more about this system and download the backtest report here.

Screenshots

Indicator / Formula

Copy & Paste Friendly
//------------------------------------------------------
//
//  Formula Name:    McGinley Dynamic Indicator
//  Original Author: Karthik Marar
//  Modified By:     Trading Tuitions
//  E-mail:          support@tradingtuitions.com
//  Website:         www.tradingtuitions.com
//------------------------------------------------------

_SECTION_BEGIN("McGinley Dynamic Indicator");

SetBarsRequired( sbrAll );
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( 1,1,1, 1 );
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 );


N = Param("McGinley Dynamic N ",25,5,40,5);
MD[0] = C[0];

for( i = 1; i < BarCount; i++ )
{
MD[ i ] = MD[ i - 1 ] + (C[i]-MD[i-1])/( N*(C[i] / MD[i-1])^4)  ;
}

Plot( Close, "Price",colorWhite, styleCandle );
Plot(MD,"McGinley Dynamic",colorYellow,1|styleThick);

Buy=C>MD AND C>Ref(C,-1) AND Ref(C,-1)>Ref(C,-2);
Short=C<MD AND C<Ref(C,-1) AND Ref(C,-1)<Ref(C,-2);;
Sell=Short;
Cover=Buy;

BuyPrice=Open;
SellPrice=Open;
ShortPrice=Open;
CoverPrice=Open;

Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);

printf("\nBuy : " + Buy );  
printf("\nSell : " + Sell );  
printf("\nShort : " + Short );  
printf("\nCover : " + Cover );  

StopLoss=Param("SL",10,1,10,1);
Target=Param("Target",40,5,40,5);
ApplyStop(Type=0,Mode=1,Amount=StopLoss);
ApplyStop(Type=1,Mode=1,Amount=Target);

/* Plot Buy and Sell Signal Arrows */
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Buy, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Buy, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorGreen, 0, L, Offset=-40);
PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorLime, 0,L, Offset=-50);
PlotShapes(IIf(Cover, shapeUpArrow, shapeNone),colorWhite, 0,L, Offset=-45);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Sell, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Sell, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorRed, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorOrange, 0,H, Offset=50);
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

_SECTION_END();

4 comments

1. mdsayeem

error error error, please make correction

2. hotaro3

no error in my amibroker ver 5.70

3. davidalan

(%.1f%%) get rid of this

4. somanathdas

Good moving average. .236 deviation can be used to handle range bound market.

Leave Comment

Please login here to leave a comment.

Back