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

Select Moving Average Crossover Trading System for Amibroker (AFL)

Rating:
3 / 5 (Votes 6)
Tags:
trading system, amibroker, moving average, optimize

Amibroker AFL for Moving Average trading with buy sell signal

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("MA_CROSS");
p = Optimize("PERIOD 1",Param("PERIOD 1",10,2,30,1),2,20,2);
q = Optimize("PERIOD 2",Param("PERIOD 2",90,10,200,10),10,100,10);
y = Optimize("MAType 1",Param("MAType 1",2,1,8,1),1,8,1);
z = Optimize("MAType 2",Param("MAType 2",2,1,8,1),1,8,1);

m=0;    if (y==1) m    =    MA(C,p);  
else    if (y==2) m    =    EMA(C,p);  
else    if (y==3) m    =    DEMA(C,p);  
else    if (y==4) m    =    TEMA(C,p);  
else    if (y==5) m    =    WMA(C,p);  
else    if (y==6) m    =    HMA(C,p);  
else    if (y==7) m    =    Wilders(C,p);  
else    if (y==8) m    =    LinearReg(C,p);

n=0;    if (z==1) n    =    MA(C,q);  
else    if (z==2) n    =    EMA(C,q);  
else    if (z==3) n    =    DEMA(C,q);  
else    if (z==4) n    =    TEMA(C,q);  
else    if (z==5) n    =    WMA(C,q);  
else    if (z==6) n    =    HMA(C,q);  
else    if (z==7) n    =    Wilders(C,q);  
else    if (z==8) n    =    LinearReg(C,q);
Plot(m," MA",IIf(m < Ref(m,-1),colorBlue,colorRed),styleThick);
Plot(n," MA",IIf(n < Ref(n,-1),colorBlue,colorRed),styleThick);

Buy  = Cross(m,n);
Sell = Cross(n,m);
Buy = ExRem(Buy,Sell);
Sell = ExRem(Sell,Buy);
Short = Sell; Cover = Buy;
PlotShapes(Buy+2*Sell,colorWhite,0,IIf(Buy,L,H));
SetPositionSize(1,4);
_SECTION_END();

1 comments

1. farat

Very niec Moving Average trading with buy sell signal.

Leave Comment

Please login here to leave a comment.

Back