Here are 2 Supertrend formulas for Metastock:
SuperTrend:
Factor:=Input("Factor",1.00,10.00,3.00);
Pd:=Input("ATR Periods",1,100,10);
Up:=MP()+(Factor*ATR(Pd));
Dn:=MP()-(Factor*ATR(Pd));
Td:=If(Cross(C,LLV(Up,13)),1,If(Cross(HHV(Dn,13),C ),-1,PREV));
Dnx:=If(Dn=HighestSince(1,Cross(Td,0),Dn),Dn,PREV) ;
Upx:=If(Up=LowestSince(1,Cross(0,Td),Up),Up,PREV);
SuperTrend:=If(Td=1,Dnx,If(Td=-1,Upx,PREV));
SuperTrend;
---------------------------------------------------------------------------------------------
SuperTrend -2:
Mult:= Input("ATR Multiplier",0.1,3,1);
Nb:= Input("NbPeriods",1,8,8);
x:= Input("Price:[1](H+L)/2 [2]Close",1,2,1);
TruRan:= Wilders(ATR(1),Nb)*Mult;
HiLimit:=If(x=1,(H+L)/2-TruRan,C-TruRan);
LoLimit:=If(x=1,(H+L)/2+TruRan,C+TruRan);
LB:=If(HiLimit>=PREV AND HiLimit<C,HiLimit,If(C<PREV,HiLimit-0.1,PREV));
UB:=If(LoLimit<PREV AND LoLimit>C,LoLimit,If(C>PREV,LoLimit+0.1,PREV));
Trend:=If(UB>Ref(UB,-1),1,If(LB<Ref(LB,-1),-1,PREV));
Super:=If((Trend=1 AND Ref(Trend,-1)=-1) OR (Trend=1 OR Trend=0),LB,UB);
Super;