I modified as below. It is easier to see what the variable are up to.
{DOUBLE TOPS}
PK:=Zig(C,10,%)<Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)>Ref(Zig(C,10,%),-2);
TR:=Zig(C,10,%)>Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)<Ref(Zig(C,10,%),-2);
PK1:=PeakBars(1,C,10);
PK2:=PeakBars(2,C,10);
a1:=ValueWhen(1,PK,Ref(C,-1))/ValueWhen(2,PK,Ref(C,-1))>.96;
a2:=ValueWhen(1,PK,Ref(C,-1))/ValueWhen(2,PK,Ref(C,-1))<1.04;
a3:=PK2-PK1>=10;
a4:=Cross(ValueWhen(1,TR,Ref(C,-1)),C);
a1+a2+a3{+a4};
{--------------------------------}
{DOUBLE BOTTOMS}
PK:=Zig(C,10,%)<Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)>Ref(Zig(C,10,%),-2);
TR:=Zig(C,10,%)>Ref(Zig(C,10,%),-1) AND Ref(Zig(C,10,%),-1)<Ref(Zig(C,10,%),-2);
TR1:=TroughBars(1,C,10);
TR2:=TroughBars(2,C,10);
b1:=ValueWhen(1,TR,Ref(C,-1))/ValueWhen(2,TR,Ref(C,-1))>.96;
b2:=ValueWhen(1,TR,Ref(C,-1))/ValueWhen(2,TR,Ref(C,-1))<1.04;
b3:=TR2-TR1>=10;
b4:=Cross(C,ValueWhen(1,PK,Ref(C,-1)));
b1+b2+b3{+b4}
{------------------------------------}