SVAPO PRICE ONLY INDICATOR for MetaStock

{calculate heikin ashi closing average haCl and get the input variables}
haO:=(Ref((O+H+L+C)/4,-1) + PREV)/2;
haCl:=((O+H+L+C)/4+haO+Max((O+H+L+C)/4,Max(H,haO))+Min((O+H+L+C)/4,Min(L,haO)))/4;
{input SVAPO period}
period:= Input("SVAPO period :", 2, 20, 8);
{input minimum per thousand price change}
cutoff:= Input("Minimum %o price change :",0.0,10,1);
{Inputs for standard deviation bands}
devH:= Input("Standard Deviation High :", 0.1, 5, 1.5);
devL:= Input("Standard Deviation Low :", 0.1, 5, 1.3);
stdevper:= Input("Standard Deviation Period :", 1, 200, 100);
{Smooth HaCl closing price}
haC:=Tema(haCl,period/1.6);
{MA divisor}
vave:=Ref(Mov(C,period*5,S),-1);
{Basic trend}
vtr:=Tema(LinRegSlope(C,period),period);
{SVAPO result of price only}
SVAPO:=Tema(Sum(If(haC>(Ref(haC,-1)*(1+cutoff/1000)) AND
Alert(vtr>=Ref(vtr,-1),2), C, If(haC<(Ref(haC,-1)*(1-cutoff/1000)) AND
Alert(vtr>Ref(vtr,-1),2),-C,0)),period)/(vave+1),period);
devH*Stdev(SVAPO,stdevper);
-devL*Stdev(SVAPO,stdevper);
zeroref:=0;
zeroref;
SVAPO