For those interested here is the variable stop EMA formula for Metastock.
Place in the indicator builder
Val:=Input("Periods",1,100,3);
Multi:=Input("Multiplier",0.5,8,2);
TS:=Mov(Mov(Mov(H-Multi*ATR(Val),4,E),4,E),4,E);
If(C<PREV,TS,Max(TS,PREV));
Call it variable stop M/A in the name EXACTLY in lower and upper case as I have here.
Then in Indicator builder the Binary trigger code
If(Fml("variable stop M/A") < Ref(Fml("variable stop M/A"),-2),1,0)
Call it variable EMA trigger.
Display the first indicator ON the chart.
and the second in a window of its own.
Let me know if you have any improvements.