I have a code here from metastock that has never been coded into mt4 format. This is Alexander Elder's autoenvelope indicator? as mentioned in his book "Come into my trading room". I was wondering if anyone out there was able to code this into mt4 based on the code below:
{AutoEnvelope}
EMA:=Input("Base EMA",1,100,22);
Factor:=Input("Factor",1,50,27);
avg:=Mov(C,EMA,E);
csize:= Stdev(2*Max(Abs(H-avg) ,Abs(L-avg)) / avg,100)*Factor/10;
{Use 100 days for stable channel size - default is 2.7 std}
Csize:= ValueWhen(1,
DayOfWeek()<Ref(DayOfWeek() ,-1) OR (
DayOfWeek()=Ref(DayOfWeek(),-1) AND DayOfMonth() <> Ref(DayOfMonth(),-1))
,Ref(csize,-1));
csize:=LastValue(csize);
{fix to constant using last value}
channel:=csize*avg;
avg+channel/2;
avg-channel/2;
avg;
Thank you.
{AutoEnvelope}
EMA:=Input("Base EMA",1,100,22);
Factor:=Input("Factor",1,50,27);
avg:=Mov(C,EMA,E);
csize:= Stdev(2*Max(Abs(H-avg) ,Abs(L-avg)) / avg,100)*Factor/10;
{Use 100 days for stable channel size - default is 2.7 std}
Csize:= ValueWhen(1,
DayOfWeek()<Ref(DayOfWeek() ,-1) OR (
DayOfWeek()=Ref(DayOfWeek(),-1) AND DayOfMonth() <> Ref(DayOfMonth(),-1))
,Ref(csize,-1));
csize:=LastValue(csize);
{fix to constant using last value}
channel:=csize*avg;
avg+channel/2;
avg-channel/2;
avg;
Thank you.