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

Death Cross and Golden Cross for Amibroker (AFL)

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

In This afl, it built the buy, sell, short, cover by three EMA (5,10 and 20 days).
There are still improvement with some others signal to set more accurate rule that I am going to study right now. Now this would be the version one.

Indicator / Formula

Copy & Paste Friendly
_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();


_SECTION_BEGIN("Cross Rules");
P1 = ParamField("Price field",-1);
Periods1 = Param("Periods1", 5, 2, 300, 1, 10 );
Plot( EMA( P1, Periods1 ), _DEFAULT_NAME(), ParamColor( "Color1", colorCycle ), ParamStyle("Style1") ); 

P2 = ParamField("Price field",-1);
Periods2 = Param("Periods2", 10, 2, 300, 1, 10 );
Plot( EMA( P2, Periods2 ), _DEFAULT_NAME(), ParamColor( "Color2", colorCycle ), ParamStyle("Style2") ); 

P3 = ParamField("Price field",-1);
Periods3 = Param("Periods3", 20, 2, 300, 1, 10 );
Plot( EMA( P3, Periods3 ), _DEFAULT_NAME(), ParamColor( "Color3", colorCycle ), ParamStyle("Style3") ); 

//diffup=(
//Cover=EMA(P1, Periods1) > EMA(P2, Periods2);
Buy = EMA(P1, Periods1) > EMA(P2, Periods2) AND EMA(P2, Periods2) > EMA(P3, Periods3);
Short = EMA(P1, Periods1) < EMA(P2, Periods2) AND EMA(P2, Periods2) < EMA(P3, Periods3);
Sell=Cross(EMA(P2, Periods2) , EMA(P1, Periods1)) AND EMA(P2, Periods2) >= EMA(P3, Periods3);;
Sell = ExRem(Sell,Buy);
Buy = ExRem(Buy,Sell);
Cover=Buy;
Short=ExRem(Short,Cover);
Cover=ExRem(Cover,Short);

Filter=Buy OR Sell OR Short;
SetOption("NoDefaultColumns", True );
AddColumn( DateTime(), "Date", formatDateTime );
AddColumn( IIf( Buy, 66, 83 ), "Signal", formatChar );
addcolumn( Close, "Close price", 1.4 );


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(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),colorWhite, 0, H, Offset=40);
PlotShapes(IIf(Short, shapeSquare, shapeNone),colorWhite, 0,H, Offset=50);                      
PlotShapes(IIf(Short, shapeDownArrow, shapeNone),colorBlack, 0,H, Offset=-45);
PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorBlue, 0, H, Offset=40);
PlotShapes(IIf(Cover, shapeSquare, shapeNone),colorBlue, 0,H, Offset=50);                      
PlotShapes(IIf(Cover, shapeDownArrow, shapeNone),colorWhite, 0,H, Offset=-45);

_SECTION_END();

0 comments

Leave Comment

Please login here to leave a comment.

Back