NEED afl for this metastock ATR formula

#1
hi

if any one can write afl for this
metastock formula


atrper:=Input("ATR period :",1,100,5);
atrfact:=Input("ATR multiplication :",1,10,3.5);
loss:=atrfact*ATR(atrper);
trail:=
If(C>PREV AND Ref(C,-1)>PREV,
Max(PREV,C-loss),
If(C<PREV AND Ref(C,-1)<PREV,
Min(PREV,C+loss),
If(C>PREV,C-loss,C+loss)));
Trail


thank you
 

Similar threads