Skip to content

Instantly share code, notes, and snippets.

@korayguclu
Last active December 19, 2016 22:04
Show Gist options
  • Save korayguclu/0ca11b8120645f37633bd5c16e5328f0 to your computer and use it in GitHub Desktop.
Save korayguclu/0ca11b8120645f37633bd5c16e5328f0 to your computer and use it in GitHub Desktop.
Metastock for Autoenvelopes as discussed in Alexander Elder's books
Below is formula in Metastock for Autoenvelopes as discussed in Alexander Elder's books. Is it possible to convert them to bullscript?
thanks
Got this MS formula for the same thing from another web source. The parameters of this
look more closer to description in the book
EMA:=input("Base EMA", 22, 1, 100);
Factor:=input("Factor", 27, 1, 50);
avg:=ma(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)); { This pegs the Stdev to last bar of week and only changes once per week}
csize:=LastValue(csize); {fix to constant using last value}
channel:=csize*avg;
avg+channel/2;
avg-channel/2;
avg;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment