snappyfrog 661 posts msg #160564  Ignore snappyfrog 
9/20/2023 8:26:06 AM
Would anyone like to try their hand at coding this? This is from stockcharts. I don't see that ToS offers it.
ER = Change/Volatility
Change = ABS(Close  Close (10 periods ago))
Volatility = Sum10(ABS(Close  Prior Close))
Volatility is the sum of the absolute value of the last ten price changes (Close  Prior Close).
SC = Smoothing Constant
SC = [ER x (fastest SC  slowest SC) + slowest SC]2
SC = [ER x (2/(2+1)  2/(30+1)) + 2/(30+1)]2
Current KAMA = Prior KAMA + SC x (Price  Prior KAMA)
https://school.stockcharts.com/doku.php?id=technical_indicators:kaufman_s_adaptive_moving_average

sr7 107 posts msg #160569  Ignore sr7 
9/21/2023 3:54:03 PM
Actually, I think they tried twice  2 attempts at creating a scan here on the forums, way back then.
But it didn't look lik the KAMA on Stockcharts.com, plus you couldn't overlay it on the stock price.
I think the reason was because it's Adaptive, that's why it's called the Kaufman's Adaptive Moving Average (KAMA). I could be wrong about that...
..first attempt in 2006  17 years ago:
A need for "smart" indicators
second attempt in 2007:
Adaptive Moving Average

styliten 280 posts msg #160571  Ignore styliten 
9/21/2023 8:15:32 PM
There are 3 issues with Kaufman:
Kaufman's Adaptive Moving Average (KAMA)
The values in the FAST and SLOW columns were incidentally switched:
FAST = 2 periods, = 2/(2+1) = 0.666667
SLOW = 30 periods, = 2/(30+1) = 0.064516
This is easy fix. The second issue is relatively minor:
"Step 3: KAMA
With the Efficiency Ratio (ER) and Smoothing Constant (SC), we are now ready to calculate Kaufman's Adaptive Moving Average (KAMA). Since we need an initial value to start the calculation, the first KAMA is just a simple moving average . The following calculations are based on the formula below."
The third issue is that SF filter can NOT be recursive, i.e.,
KAMA = KAMA 1 day ago + SC
is not allowed at all.
Hence, the closest thing SF would allow is this:
Due to limitation #3 above, ema(10) 1 day ago was the closest thing for KAMA 1 day ago .

Mactheriverrat 3,136 posts msg #160572  Ignore Mactheriverrat 
9/21/2023 10:18:29 PM
Thanks styliten!!!!!!

dtatu 143 posts msg #160579  Ignore dtatu modified 
9/23/2023 4:17:43 PM
Sincerely,I think the KAMA is useless in practice.The entry and exit signal can only be taken once there is a horizontal breakout from a range ( which is reflected in the horizontal KAMA), so then, one should better use a range breakout tool (Donchian ,etc)

snappyfrog 661 posts msg #160580  Ignore snappyfrog 
9/23/2023 8:57:01 PM
Thanks sr7 and styliten.

styliten 280 posts msg #160581  Ignore styliten modified 
9/23/2023 10:25:03 PM
@ all,
Made a slight modification to mimic the real KAMA more closely:
due to SF limitations, can't declare another variable for the sum(sum(KAMA, 5), 5) divided by 25 part. As a result, no filter can be written on this in SF either.
(Feel free to do your own verification and adjust the parameters in the double SUM accordingly, such as:
sum(sum(KAMA, 6), 6) divided by 36
....
sum(sum(KAMA, 5), 10) divided by 50, etc., etc. )
DOW:
SF KAMA on DOW:
HON:
SF KAMA on HON:
