Amibroker AFL for recognizing Parabolic SAR crossover.
Credit goes to the creator of the AFL Code. No changes have been made by the Blog owner to the AFL code. The code has been obtained through online resource and is presented on as it is basis.
Please copy the code from the Code Box below. You may refer to the image posted below to look how the chart looks after applying the AFL.
There is a substantial risk of loss associated with trading in Stock Markets. Losses can and
will occur. No responsibility for loss occurred to any person acting or refraining to act as a result
of using the AFL written by their respective creators and published in this Blog for sharing of knowledge can be accepted by the Blog owner.
Credit goes to the creator of the AFL Code. No changes have been made by the Blog owner to the AFL code. The code has been obtained through online resource and is presented on as it is basis.
Please copy the code from the Code Box below. You may refer to the image posted below to look how the chart looks after applying the AFL.
_SECTION_BEGIN("Parabolic SAR Crossover"); 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);
There is a substantial risk of loss associated with trading in Stock Markets. Losses can and
will occur. No responsibility for loss occurred to any person acting or refraining to act as a result
of using the AFL written by their respective creators and published in this Blog for sharing of knowledge can be accepted by the Blog owner.
No comments:
Post a Comment