I have found the indicator shown below:
pr:=Input("ZigZag reversal amount",
0.001,100000,5);
choose:=Input("[1]Hi/Lo ZigZag, [2]Close ZZ, [3]Peaks/Troughs",1,3,1);
pk:=PeakBars(1,H,pr)=0;
tr:=TroughBars(1,L,pr)=0;
pktr:=pk-tr;
zz:=Zig(C,pr,%);
zzHi:=Zig(H,pr,%);
zzLo:=Zig(L,pr,%);
avg:=(zzHi+zzLo)/2;
x:=
If(pk,zzHi,If(tr,zzLo,If(avg>Ref(avg,-1),H,L)));
zzHiLo:=Zig(x,pr,%);
If(choose=1,zzHiLo,If(choose=2,zz,pktr));
And I want to add some features to this. I want the formula to take 3 last peaks/troughs (besides the last one, which is always changing in zigzag), and I want the indicator to make this operation:
2nd-1st+3rd (peak/or trough >because the values will be used in order of appearance - so there maybe P-T-P or T-P-T). As I am beginner to MS formulas I wanted to ask You for your assistance ;)