Hi,
I was thinking about sharing this afl for a long time, it is based on SAR , modified SAR , when the close price crosses the value of SAR from below , we buy and when the close price crosses the value of SAR from above, we sell
i use this for stocks which are in 3 digits and above. Please post if you find it useful. thanks
I was thinking about sharing this afl for a long time, it is based on SAR , modified SAR , when the close price crosses the value of SAR from below , we buy and when the close price crosses the value of SAR from above, we sell
i use this for stocks which are in 3 digits and above. Please post if you find it useful. thanks
Code:
_SECTION_BEGIN("NEWSAR");
//afl done by ashokram1
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() );
x =Null;
y =Null;
for(i=0;i<6;i++)
{
y=Ref(LLV(Low,5),-1);
}
for(i=7;i<BarCount;i++)
{
x[6] = (Low[6]*0.236)+(y[5]*0.764);
x[i]=(Low[i]*0.236)+(x[i-1]*0.764);
}
Color_dt = IIf(Close>x,colorBlue,colorRed);
Highema =EMA(High,5);
Lowema = EMA(Low,5);
EMAcolor = IIf(Close>x,colorGreen,colorOrange);
Plot(x,"newsar",Color_dt,styleThick);
Plot(Highema,"highema",EMAcolor,styleNoTitle);
Plot(lowema,"lowema",EMAcolor,styleNoTitle);
Buy = Cross(Close,x) ;
Sell =Cross(x,Close) ;
ExB =Buy;
ExS = Sell;
ExB_status = WriteIf( ExB, "Buy", " " );
ExS_status = WriteIf( ExS, "Sell", " " );
ExB_Color = IIf( ExB, colorDarkGreen , colorWhite );
ExS_Color = IIf( ExS, colorRed, colorWhite );
Filter = ExB OR ExS;
AddColumn( C, "close,", 1.2, IIf( C > Ref( C, -1 ), colorDarkGreen, colorRed ) );
AddColumn(Volume,"volume");
AddColumn(x,"NEW-SAR");
AddTextColumn( ExB_status, "Buy", 1, colorWhite, ExB_color );
AddTextColumn( ExS_status, "Sell", 1, colorWhite, ExS_color );
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);
GfxSetOverlayMode( mode = 0 );
GfxSelectPen( colorOrange, 2 );
GfxSelectSolidBrush( colorBlack );
GfxRoundRect(5,20, 200,63, 16, 20 );
GfxSetBkMode(1);
GfxSelectFont( "Arial",12, 700, False );
GfxSetTextColor( colorPaleGreen );
GfxSetTextAlign(0);
GfxSetTextColor( colorWhite );
GfxTextOut(WriteIf(x, "NEW-SAR: "+(x),""), 8 ,25 );
_SECTION_END();