Rank: Advanced Member
Groups: Registered, Registered Users Joined: 3/19/2005(UTC) Posts: 2,995
Was thanked: 14 time(s) in 10 post(s)
|
I've been checking out the APE article in TASC Apr 2006. It's pretty interesting. Here's a combination of the first 3 indicators mentioned. I can't figure out how to correct the Alpha reading to truly return a value between 0-1. I tried using a couple of different methods (including an external dll), but no success. So, what I wound up doing was normalizing the original method and plotting that instead. Here's what I came up with.
Original
[code:1:a0f0183825]{ User Input }
i1:=Input("APE periods",2,252,20);
i2:=Input("Plot smoothing periods",1,100,1);
i3:=Input("Plot (APE=1 Ratio=2 Alpha=3)",1,3,1);
{ Calculations }
APE1:=Max(Abs(H-O),Abs(L-O));
APEn:=Max(Abs(HHV(H,i1)-Ref(O,-(i1-1))),Abs(LLV(L,i1)-Ref(O,-(i1-1))));
APEratio:=APEn/APE1;
APEalpha:=Log(APEratio)/Log(i1);
{ Plot }
If(i3=1,Mov(APEn,i2,E),
If(i3=2,APEratio,
If(i3=3,APEalpha,0)));[/code:1:a0f0183825]
Normalized
[code:1:a0f0183825]{ User Input }
i1:=Input("APE periods",2,252,20);
i2:=Input("Plot smoothing periods",1,100,1);
i3:=Input("Plot (APE=1 Ratio=2 Alpha=3)",1,3,1);
i4:=Input("Normalize Alpha (No=1 Yes=2)",1,2,2);
{ Calculations }
APE1:=Max(Abs(H-O),Abs(L-O));
APEn:=Max(Abs(HHV(H,i1)-Ref(O,-(i1-1))),Abs(LLV(L,i1)-Ref(O,-(i1-1))));
APEratio:=APEn/APE1;
APEalpha:=Log(APEratio)/Log(i1);
APEalphaN:=(APEalpha-Lowest(APEalpha))/Max(Highest(APEalpha)-Lowest(APEalpha),0.0001);
{ Plot }
If(i3=1,Mov(APEn,i2,E),
If(i3=2,APEratio,
If(i4=1,APEalpha,APEalphaN)));[/code:1:a0f0183825]
|