Metastock code for consolidation breakout is

Congestion Index

((HHV(C,80)-LLV(C,80))/LLV(C,80))*100

Consolidation Breakout Upside

If(Ref(Fml("Congestion Index"),-5),<,10,

{and} If(Fml("Congestion Index"),>=,10,

{and} If(CLOSE,>,Ref(HHV(C,80),-5),

{and} If(Mov(V,5,S),>=,1.5*(Ref(Mov(V,60,S),-5)),+1,0),0),0),0)

Consolidation Breakout Downside

If(Ref(Fml("Congestion Index"),-5),<,10{%},

{and} If(Fml("Congestion Index"),>=,10{%},

{and} If(CLOSE,<,Ref(LLV(C,80),-5),

{and} If(Mov(V,5,S),>=,1.5*(Ref(Mov(V,60,S),-5)),+1,0),0),0),0)