Kaufman's Adaptive Moving Average (KAMA) - calculation issue
See original GitHub issueimport yfinance as yf
from pandas_ta.overlap import kama
import mplfinance as mpf
ticker = yf.Ticker("SPY")
minute_data = ticker.history(period="7d", interval="1m")
kama_results = kama(minute_data["Close"])
addplot = [
mpf.make_addplot(kama_results, color='blue')
]
mpf.plot(minute_data, volume=True, type='candle', addplot=addplot)
I tried using the Kama indicator (snippet and picture above), seems like there’s a bug with the calculate the Kama. The initial Kama value relies on the previous value which I believe from the snippet below returns zero for the first value.
This doc was referenced on a comment in the kama.py file and suggests that “the first KAMA is just a simple moving average”.
Is there anyway we can add another arg for starting_kama or generate some sma based on the “slow” length?
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Kaufman's Adaptive Moving Average (KAMA)
One of the uses of Kaufman's Adaptive Moving Average is to identify the general trend of current market price action. Basically, when the...
Read more >Kaufman's Adaptive Moving Average (KAMA) - ChartSchool
Developed by Perry Kaufman, Kaufman's Adaptive Moving Average (KAMA) is a moving average designed to account for market noise or volatility.
Read more >KAMA (Kaufman's Adaptive Moving Average)
KAMA (Kaufman's Adaptive Moving Average) is another popular and widely used moving average indicator. It was developed by Perry J. Kaufman as an...
Read more >kama - Kaufman Adaptive Moving Average - Tulip Indicators
It adapts to a fast moving average when prices are moving steadily in one direction and a slow moving average when the market...
Read more >KAMA (Kaufman adaptive moving average) - TraderEvolution
ER = [ABS (Closet - Closet-n]/ [n ∑ (ABS (Closet – Closet-1))],. n - is a selected number of days for the moving...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
😅 Thought i was going crazy for a sec.
@twopirllc seems to be working, great job and thank you!
@onachassi,
Doh! 🤦🏼♂️ Sorry. I thought I updated the development branch! Got some stuff to do right now, but I’ll let you know when I actually update it this time.
If you want to test your local copy, you can add/edit the following:
Don’t forget to also update kama in
core.py
with the newmamode
argument.Apologies, KJ