FORMULA 1 ---- DESCENDING TRIADS -----

m1:=h>Ref(h,-1) and l>ref(l,-1);

m2:=h>ref(h,-2) and l>ref(l,-2)and

h>ref(h,-1) and l<ref(l-1);

m3:=h>ref(h,-3)and l<ref(l,-3)and

h>ref(h,-2)and l<ref(l,-2)and

h>ref(h,-1)and l<ref(l,-1);

mark:=m1 or m2 or m3;

set:=lvaluewhen(1,mark,l)and h<valuewhen(1,mark,h)and

highestsince(1,ref(mark,-1),h)<valuewhen(1,mark,h);

sig:if (mark,1, if (set,0,prev);

cross(sig = 0 ,0.5);

after this i will post the formula for ascending triad

thanks