Code Amibroker Indicators

Fibonacci Pivot Points for Amibroker (AFL)

This indicator plots Fibonacci pivots points on an intraday chart. The pivot levels are based on the daily trading range and plotted at 38%, 62% and 99%. You can use the pivot levels to trade reversals or break-outs and fib retracements to buy dips in uptrends and sell rallies in downtrends.

In uptrends, traders should look to buy near the 38% Fibonacci Retracement level (buy on dips). In downtrends, traders look to sell near the 38% Fibonacci Retracement level (sell on rallies).

by K.Vidyasagar, vkunisetty@yahoo.com

_SECTION_BEGIN("Fibo Pivots");
 
SetChartOptions(0,chartShowDates);
GraphXSpace=5;
Plot(C,"",colorBlack,styleCandle);
 
//by K.Vidyasagar, vkunisetty@yahoo.com
PH = DayH = TimeFrameGetPrice("H", inDaily, -1);    DayHI = LastValue (DayH,1);   // yesterdays high
PL = DayL = TimeFrameGetPrice("L", inDaily, -1);    DayLI = LastValue (DayL,1); // yesterdays low
PC = DayC = TimeFrameGetPrice("C", inDaily, -1);    // yesterdays close
PR = PH - PL;
//DayO = TimeFrameGetPrice("O", inDaily);   // current day open
 
numbars = LastValue(Cum(Status("barvisible")));
hts = -33.5;
R=PH-PL;//range
P=(PH+PL+PC)/3; pI = LastValue (p,1);// Standard Pivot
fr1 = p + (R * 0.38); fr1I = LastValue (fr1,1);
fr2 = p + (R * 0.62); fr2I = LastValue (fr2,1);
fr3 = p + (R * 0.99); fr3I = LastValue (fr3,1);
fs1 = p - (R * 0.38); fs1I = LastValue (fs1,1);
fs2 = p - (R * 0.62); fs2I = LastValue (fs2,1);
fs3 = p - (R * 0.99); fs3I = LastValue (fs3,1);
 
Plot(p,"Pivot",colorBlue,styleDots|styleNoLine|styleNoRescale);
Plot(fr1,"R1",colorRed,styleDots|styleNoLine|styleNoRescale);
Plot(fr2,"R2",colorPink,styleDots|styleNoLine|styleNoRescale);
Plot(fr3,"R3",colorRose,styleDots|styleNoLine|styleNoRescale);
Plot(fs1,"S1",colorGreen,styleDots|styleNoLine|styleNoRescale);
Plot(fs2,"S2",colorLime,styleDots|styleNoLine|styleNoRescale);
Plot(fs3,"S3",colorPaleGreen,styleDots|styleNoLine|styleNoRescale);
PlotText(" Pivot ", LastValue(BarIndex())-(numbars/Hts), pI, colorBlue);
PlotText(" Fib R1 " , LastValue(BarIndex())-(numbars/Hts), fr1I, colorRed);
PlotText(" Fib R2 " , LastValue(BarIndex())-(numbars/Hts), fr2I, colorPink);
PlotText(" Fib R3 " , LastValue(BarIndex())-(numbars/Hts), fr3I, colorRose);
PlotText(" Fib S1 " , LastValue(BarIndex())-(numbars/Hts), fs1I, colorGreen);
PlotText(" Fib S2 " , LastValue(BarIndex())-(numbars/Hts), fs2I, colorLime);
PlotText(" Fib S3 " , LastValue(BarIndex())-(numbars/Hts), fs3I, colorPaleGreen);
_SECTION_END();