RicardoSantos

[RS]Kaufman Adaptive Moving Average V0

Request for coondawg71.
Remove from Favorite Scripts Add to Favorite Scripts
study(title="[RS]Kaufman Adaptive Moving Average", shorttitle="[RS]KAMA.V0", overlay=true)
//
length0 = input(4)
src0 = input(close)
//  ||----------------------------------------------------------------------------------------------------------------------------||
//  ||---    Kaufman Adaptive Moving Average Function:   -------------------------------------------------------------------------||
kama(src, length)=>
    _ER = abs(change(src, length) / sum(abs(src-src[1]), length))
    _alpha = pow((_ER * 0.6015 + 0.0645), 2)
    _previous = nz(_return[1], src)
    _return = (_alpha * src) + (1-_alpha) * _previous
    _return
//  ||----------------------------------------------------------------------------------------------------------------------------||
plot(kama(src0, length0))

Related Ideas

Thank you kind Sir!
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out