Modified All In One Trading System

Modified All In One Trading System
Modified All In One Trading System

//www.aflcode.com
_SECTION_BEGIN("HLCby3");

pivot = (H +L+C)/3; 
piv = EMA (pivot,Param("short ema",5,1,20,1));
piv2 = EMA (pivot,Param("fast ema",10,1,50,1));
Buy = Cross (piv, piv2);
Short = Cross (piv2,piv);
pivot_col =  IIf (pivot > Ref(pivot,-1), colorBlue,colorRed);
piv_col = IIf (piv > Ref(piv,-1), colorBlue,colorRed);
piv2_col = IIf (piv2 > Ref(piv2,-1),colorBlue, colorRed);
//Plot (pivot , "pivot", piv_col, styleThick);

bar_col = IIf (MACD( 4, 34 ) > Signal( 4, 34, 10 ), colorBlue, colorRed);
//Plot (pivot , "pivot", pivot_col, styleThick);
Plot (piv , "piv", piv_col, styleThick);
Plot (piv2 , "piv2", piv2_col, styleThick);                
Col = IIf (H > Ref(H,-1) AND L > Ref(L,-1), colorBlue, IIf (Low < Ref(L,-1) AND High < Ref(H,-1),colorRed, colorYellow));
Plot( C, "Close", bar_Col, styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
PlotShapes (shapeUpArrow*Buy, colorGreen);
PlotShapes (shapeDownArrow*Short, colorRed);

//pv_col = IIf ( ADX(9) > Ref(ADX(9),-1) AND PDI( 9 ) > MDI( 9 ),colorBlue,IIf (ADX(9) > Ref(ADX(9),-1) AND PDI( 9 ) < MDI( 9 ),colorRed, colorYellow));
pv_col = IIf (  piv_col == colorBlue AND piv2_col ==colorBlue,colorBlue,IIf ( piv_col == colorRed AND piv2_col ==colorRed,colorRed,colorYellow));

Plot(3, "ribbon", piv_col, styleOwnScale| styleArea|styleNoLabel,-0.5,100); 
_SECTION_END();

_SECTION_BEGIN("Auto trendline1");
/*

trend channel development 
Edward Pottasch, nov 2004

*/


per = 15; per = Param( "period", 15, 1, 500, 1);

mm = C;

x = Cum(1);
lastx = LastValue(x); 
selv = SelectedValue(x);

aaa = LinRegIntercept(mm, per);
bbb = LinRegSlope(mm, per);

daa = SelectedValue(ValueWhen(x, aaa, 1));
dbb = SelectedValue(ValueWhen(x, bbb, 1));

xx = IIf(x > selv - per AND x <= selv, x - (selv - per),Null);

yy = daa + dbb * xx;

dhh = abs(H - yy);
dll = abs(L - yy);
dtt = Max(dhh,dll);

wd = SelectedValue(HHV(dtt,per));

SetChartOptions(0, chartShowDates);
GraphXSpace = 5;

//Plot(C,"",colorWhite,64);
//Plot(yy, "LinReg", colorBlue );
Plot(yy + wd, "Upper Boundary", colorRed, 4 );
Plot(yy - wd, "Lower Boundary", colorBrightGreen, 4 );
_SECTION_END();

_SECTION_BEGIN("macd rsi");
EMA3 = EMA(RSI(14),3);
ema27 = EMA(RSI(14),27); 

diff = ema3-EMA27;
ema_short = EMA(diff,Param("short ema",3,1,20,1));
EMA_Long = EMA(diff,Param("long ema",5,1,20,1));

Col_rsi = IIf (EMA_long > Ref(EMA_long,-1),colorBlue,colorRed);
//Plot (EMA_short,"diff in rsi1",colorYellow,styleThick);
//Plot (EMA_long,"diff in rsi5",Col_rsi,styleThick);
//Plot (0,"",colorWhite,styleThick);

Buy = Cross (EMA_short,EMA_long);
Sell = Cross (EMA_long, EMA_short);
Short = Sell;
Cover = Buy;

PlotShapes (shapeUpTriangle*Buy,colorYellow);
PlotShapes (shapeDownTriangle*Sell,colorYellow);
_SECTION_END();
Previous
Next Post »