BullCharts Forum Homepage
Forum Home Forum Home > BullCharts > BullScript
  New Posts New Posts RSS Feed: Zig Zag indicator
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Zig Zag indicator

 Post Reply Post Reply Page  <12
Author
Message / View First Unread Post
maximo View Drop Down
BullCharts Guru
BullCharts Guru
Avatar

Joined: 02 Sep 2006
Location: Australia
Posts: 232
Post Options Post Options   Quote maximo Quote  Post ReplyReply Direct Link To This Post Posted: 22 Apr 2011 at 7:07pm

Here's versions suitable for traders that prefer the labels Higher High & Lower Low.

Scan for Higher Lows also included.   Looking at AWC you can see it will find these.

ZigZag - Highs & Lows Indicator

[target=Price]
size := input("Zig zag size",5,0);
z := zigzag(Close,size,%);
ispeak := z>hist(z,1) and z>future(z,1);
istrough := z<hist(z,1) and z<future(z,1);
P1 := ValueWhen(1,ispeak,z);
P2 := ValueWhen(2,ispeak,z);
Higher := if(ispeak and P1 > P2,"Higher","Lower");
T1 := ValueWhen(1,istrough,z);
T2 := ValueWhen(2,istrough,z);
Lower := if(istrough and T1 > T2,"Higher","Lower");
[name=LowerPeak]
ScanLowerPeak := if(ispeak and P1 < P2,1,0);
[name=HigherPeak]
ScanHigherPeak := if(ispeak and P1 > P2,1,0);
[name=LowerTrough]
ScanLowerTrough := if(istrough and T1 < T2,1,0);
[name=HigherTrough]
ScanHigherTrough := if(istrough and T1 > T2,1,0);

[linestyle=Solid; color=black]
z;
[color=Blue]
[linestyle=Text; textalign=Above,Center]
if(isPeak, Higher + " High at " + z, undefined);
High;
[linestyle=Text; textalign=Below,Center]
if(isTrough, Lower + " Low at " + z, undefined);
Low;

.....................................................................

ZigZag - Higher Low signal for scanning

[Description="ZigZag Higher Low Signal"]
size:=input("ZigZag percentage",5,1);
z := zigzag(Close,size,%);
istrough:= ref(Z,-1)<z AND ref(z,-2)>ref(Z,-1);
T1:=ValueWhen(1,istrough,z);
T2:=ValueWhen(2,istrough,z);
HigherLow:=istrough and T1 > T2;
[name=HigherLow]
HigherLow



Edited by maximo - 23 Apr 2011 at 2:50am
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.69
Copyright ©2001-2010 Web Wiz