Parabolic SAR MACD Composite - Amibroker AFL Code

Click Image To Enlarge. Please Rate And Comment.

Parabolic SAR MACD Composite

_SECTION_BEGIN("ShareGuru-Auto Buy/Sell");
Plot(C,"Close",colorBlack,64);
uptrend=PDI()>MDI()AND Signal()<MACD();
downtrend=MDI()>PDI()AND Signal()>MACD();


Plot( 2, /* defines the height of the Market Trend in percent of pane width */"TREND",
IIf( uptrend, colorGreen, IIf( downtrend, colorRed, 6 )), /* choose color */
styleOwnScale|styleArea|styleNoLabel, -0.5, 100 );

SetChartBkColor( ParamColor( "Outer panel",colorBlack) );

SetChartOptions(0,chartShowArrows|chartShowDates);
 
NewDay = Day()!= Ref(Day(), -1);
DH = HHV( H, NewDay);
DL =  LLV(L, NewDay);
Plot(DH,"DAY HIGH",colorPaleGreen,ParamStyle("Style"),0,0,0);
Plot(DL,"DAY LOW",colorPink,ParamStyle("Style"),0,0,0);
R1=((DH-DL)*0.33)+DL;
R2=((DH-DL)*0.66)+DL;
Plot(R1,"BEARISH BELOW",colorYellow,styleDashed,0,0,0);
Plot(R2,"BULLISH ABOVE",colorBrightGreen,styleDashed,0,0,0);

accel = Param("Acceleration", 0.02, 0, 1, 0.001); 
mx = Param("Max. acceleration", 0.2, 0, 1, 0.001); 

F_SAR = SAR(accel,mx); 

colordots = IIf(F_SAR < L,colorGreen,IIf(F_SAR> H,colorRed,colorWhite)); 

Buy = Cross(C,F_SAR); Buy = Ref(Buy,-1); BuyPrice = O; 
Sell = Cross(F_SAR,C); Sell = Ref(Sell,-1); SellPrice = O; 

SetBarsRequired(-2,-2); 
SetChartOptions(0, chartShowDates); 
 Plot(F_SAR,"\nF_SAR",colordots,styleDots|styleNoLine); 

PlotShapes(IIf(Buy,shapeUpArrow,shapeNone),colorBrightGreen,0,L,-15); 
PlotShapes(IIf(Buy,shapeHollowUpArrow,shapeNone),colorBrightGreen,0,L,-15); 
PlotShapes(IIf(Buy,shapeHollowCircle,shapeNone),colorBlue,0,BuyPrice,0); 

PlotShapes(IIf(Sell,shapeDownArrow,shapeNone),colorRed,0,H,-15); 
PlotShapes(IIf(Sell,shapeHollowDownArrow,shapeNone),colorRed,0,H,-15); 
PlotShapes(IIf(Sell,shapeHollowCircle,shapeNone),colorOrange,0,SellPrice,0);
SHARE
  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment