ryannichols 6 posts msg #54824 - Ignore ryannichols |
9/15/2007 6:31:43 PM
Does anyone have code for Perry Kaufman's Adaptive Moving Average (KAMA) enumerated in Van Tharp's "Trade Your Way to Financial Freedom" and as well as Kaufman's books.
Formula is:
KAMA = alpha * close + (1-alpha) * KAMA[prev]
alpha = (ER * 0.6015 + 0.0645) ^ 2
abs (close[today] - close[10 days ago])
ER = --------------------------------------
Sum abs (close - close[prev])
past 10 days
|
TheRumpledOne 6,411 posts msg #54827 - Ignore TheRumpledOne modified |
9/15/2007 7:22:57 PM
A google search turns up a lot of code.
Here's TradeStation code:
Inputs: Period(Numeric);
Vars: Noise(0), Signal(0), Diff(0), efRatio(0), Smooth(1), Fastest(.6667), Slowest(.0645), AdaptMA(0);
Diff = AbsValue(Close - Close[1]);
IF CurrentBar <= Period Then AdaptMA = Close;
IF CurrentBar > Period Then Begin
Signal = AbsValue(Close - Close[Period]);
Noise = Summation(Diff, Period);
efRatio = Signal / Noise;
Smooth = Power(efRatio * (Fastest - Slowest) + Slowest, 2);
AdaptMA = AdaptMA[1] + Smooth * (Close - AdaptMA[1]);
End;
AMA = AdaptMA;
http://www.xeatrade.com/trading/14/A/460.html
Power? Do we have power?
Updated Sat Oct 13 (Sammy Hagar's Birthday - guess you know where I am...LOL!)
Ok.. we have power but ... will this code work since it references AdaptMA 1 day ago BEFORE IT IS DEFINED?? I don't think so...
|
guru_trader 485 posts msg #54833 - Ignore guru_trader |
9/16/2007 3:40:10 AM
Where's the rest TRO? :D
|
curmudgeon 103 posts msg #54844 - Ignore curmudgeon |
9/16/2007 8:34:32 PM
It's a ROYAL PITA to try and optimize the settings on that AMA. I spent literally months working with it before I gave up. Gaussian filters are the best IMO.
|
ryannichols 6 posts msg #54980 - Ignore ryannichols |
9/20/2007 9:53:46 PM
Did anyone get results from that screen?
|
ryannichols 6 posts msg #55648 - Ignore ryannichols |
10/12/2007 1:25:43 PM
Rumpled One,
Can you please reproduce the entire filter so that I may back test it with other criteria?
|
chetron 2,817 posts msg #55667 - Ignore chetron modified |
10/13/2007 6:45:57 AM
yes, we do have power, but i am not sure how to do the next variable.
|