PureBytes Links
Trading Reference Links
|
HI,
In the last couple month I wanted to plot the Fibonacci lines on the chart
so that I don't need to go to excel and calculate it. Yesterday I finally
came up with a solution using the Zig-Zag indicator. I read a lot of
unfavorable opinion about that indicator. It looks to me that in the
Fibonacci case I can use it, but I would like to know if anybody has
opposing opinion that I'm not aware of in using the Zig-zag indicator for
his purpose.
The indicator I created is:
Piv#11 - Fibonacci Levels
ZigPerc:= Input("Zig-Zag Percentage", .1, 99, 1);
{basic peak and trough level calculation}
P1 := ValueWhen(1, Peak(1, Zig(C, ZigPerc, %) , ZigPerc) , Peak(1,
Zig(H, ZigPerc, %) , ZigPerc)) ;
P2 := ValueWhen(1, Trough(1, Zig(C, ZigPerc, %) , ZigPerc) ,
Trough(1, Zig(L, ZigPerc, %) , ZigPerc));
{Fibonacci retracement levels calculation}
P3 := P2 + (P1-P2)*0.236;
P4 := P2 + (P1-P2)*0.382;
P5 := P2 + (P1-P2)*0.5;
P6 := P2 + (P1-P2)*0.618;
P7 := P2 + (P1-P2)*0.764;
{Plotting the levels}
P2; {through}
P3; {23.6% (76.4%) retracement}
P4; {38.2% (61.8%) retracement}
P5; {50.0% retracement}
P6; {61.8% (38.2%) retracement}
P7; {76.4% (23.6%) retracement}
P1; {peak}
Good trading,
***** Erika ***** :-)
|