Saturday 24 January 2015

Previous Pivots for Amibroker (AFL)


Previous Pivots for Amibroker (AFL)

i have found in technical stories, most of the peoples are working with todays and tomorrows pivots. but yesterdays pivots are working very good most of the times…….Enjoy…….



ppl = ParamToggle("","Off|On",1);
numbars = LastValue(Cum(Status("barvisible")));
fraction= IIf(StrRight(Name(),3) == "", 3.2, 3.2);
hts = -33.5;

PO=TimeFrameGetPrice( "O", inDaily, -1 );
PL=TimeFrameGetPrice( "L", inDaily, -1 );
PH=TimeFrameGetPrice( "H", inDaily, -1 );
PC=TimeFrameGetPrice( "C", inDaily, -1 );

P=((PH+PL+PC)/3);PI=LastValue(P,1);
R1=((2*P)-PL);R1I=LastValue(R1,1);
S1=((2*P)-PH);S1I=LastValue(S1,1);
R2=((P-S1)+R1);R2I=LastValue(R2,1);
S2=(P-(R1-S1));S2I=LastValue(S2,1);
R3=PH+(2*(P-PL));R3I=LastValue(R3,1);
S3=PL-(2*(PH-P));S3I=LastValue(S3,1);
if(ppl==1) {
Plot(R1,"Resistance 1",colorRed,styleDashed);
Plot(R2,"Resistance 1",colorRed,styleDashed);
Plot(R3,"Resistance 1",colorRed,styleDashed);
Plot(S1,"Support 1",colorBrightGreen,styleDashed);
Plot(S2,"support 2",colorBrightGreen,styleDashed);
Plot(S3,"Support 3",colorBrightGreen,styleDashed);
Plot(P,"Resistance 1",colorWhite,styleDashed);
PlotText(" Y Day Pivot = " + WriteVal(P,fraction), LastValue(BarIndex())-(numbars/Hts), PI +0.05, colorWhite);
PlotText(" Y Day Resistance 1 = " + WriteVal(R1,fraction), LastValue(BarIndex())-(numbars/Hts), R1I +0.05, colorRed);
PlotText(" Y Day Resistance 2 = " + WriteVal(R2,fraction), LastValue(BarIndex())-(numbars/Hts), R2I +0.05, colorRed);
PlotText(" Y Day Resistance 3 = " + WriteVal(R3,fraction), LastValue(BarIndex())-(numbars/Hts), R3I +0.05, colorRed);
PlotText(" Y Day Support 1 = " + WriteVal(S1,fraction), LastValue(BarIndex())-(numbars/Hts), S1I +0.05, colorBrightGreen);
PlotText(" Y Day Support 2 = " + WriteVal(S2,fraction), LastValue(BarIndex())-(numbars/Hts), S2I +0.05, colorBrightGreen);
PlotText(" Y Day Support 3 = " + WriteVal(S3,fraction), LastValue(BarIndex())-(numbars/Hts), S3I +0.05, colorBrightGreen);
}

_SECTION_BEGIN("@Candle great");
A=(H+L)/2;
var1=Wilders(A,34);
var2=Wilders(A,5);
var3=var2-var1;
var4=var3-Wilders(var3,5);
Var5=(H-L)/V;
AO=Var3;
AC=Var4;



barcolor=IIf(AO>Ref(AO,-1) AND AC>Ref(AC,-1),colorGreen,IIf(AO<Ref(AO,-1) AND AC<Ref(AC,-1),colorRed,IIf(V>0 AND Var5<Ref(Var5,-1) AND V>Ref(V,-1),colorGold,colorBrown)));

Plot(C,"Close",barcolor,64+styleNoTitle );
_SECTION_END();

_SECTION_BEGIN("Background text");
SetChartBkColor(colorBlack);
strWeekday = StrMid("---SUNDAY---MONDAY--TUESDAYWEDNESDAY-THURSDAY--FRIDAY--SATURDAY", SelectedValue(DayOfWeek())*9,9);
GraphXSpace=Param("GraphXSpace",10,-55,200,1);
C13=Param("fonts",20,10,30,1 );
C14=Param("left-right",2.1,1.0,5.0,0.1 );
C15=Param("up-down",12,1,20,1 );
Miny = Status("axisminy");
Maxy = Status("axismaxy");
lvb = Status("lastvisiblebar");
fvb = Status("firstvisiblebar");
pxwidth = Status("pxwidth");
pxheight = Status("pxheight");
YC=TimeFrameGetPrice("C",inDaily,-1);
DD=Prec(C-YC,2);
xx=Prec((DD/YC)*100,2);
GfxSetBkMode(transparent=1);
GfxSetOverlayMode(1);
GfxSelectFont("Candara", Status("pxheight")/C13 );
GfxSetTextAlign( 6 );
GfxSetTextColor(   ColorRGB (217,217,213));
GfxTextOut( Name(), Status("pxwidth")/C14, Status("pxheight")/C15 );
GfxSelectFont("Tahoma", Status("pxheight")/C13*0.5 );
GfxSetTextColor( ColorRGB (217,217,213));
GfxTextOut( "L.T.P. : "+ C +"", Status("pxwidth")/C14, Status("pxheight")/C15*2 );
GfxSelectFont("Candara", Status("pxheight")/C13*0.5 );
GfxSetTextColor(  ColorRGB (217,217,213));
GfxTextOut( ""+DD+ " ( "+xx+"%)", Status("pxwidth")/C14, Status("pxheight")/C15*2.5 );

_SECTION_BEGIN("Title");

DODay = TimeFrameGetPrice("O", inDaily);
DHiDay = TimeFrameGetPrice("H", inDaily);
DLoDay = TimeFrameGetPrice("L", inDaily);

Title = EncodeColor(colorWhite)+"   "+EncodeColor(colorWhite)+ Name() + ", " + Interval(2) + ", " + Date() + "   -  "+strWeekday + "  - " +
EncodeColor(colorWhite)   +  "\nO " + EncodeColor(colorWhite) + O +

 ",   H :  "   + H +
 ",   L  :  " + L +
 ",   C  :  "  + C +
EncodeColor(colorWhite)+ "\n Day-Open : " +DODay + "  Day-High : " +DHiDay + "  Day-Low : " + DLoDay
;

No comments:

Post a Comment

Thanks