Adaptive moving average

Has anyone had luck with adaptive moving averages in P123? I was trying to work through Kaufman’s adaptive moving average, but can’t seem to work out the last step. I can get through the following:

Efficiency Ratio = Change/Volatility
Change = ABS(Close - Close (@d periods ago))
Volatility = Sum@d(ABS(Close - Prior Close))

So in P123…
Efficiency Ratio = Abs(BenchClose(0)-BenchClose(@d))/LoopSum(“Abs(BenchClose(CTR)-BenchClose(CTR+1))”,@d,0,1)

@d = efficiency ratio lookback

Then…
Smoothing Constant = [ER x (fastest SC - slowest SC) + slowest SC]2
Smoothing Constant = [ER x (2/(@s+1) - 2/(@l+1)) + 2/(@l+1)]2

So in P123…
Smooting Constant = ((Abs(BenchClose(0)-BenchClose(@d))/LoopSum(“Abs(BenchClose(CTR)-BenchClose(CTR+1))”,@d,0,1) * (2/(@s+1) - 2/(@l+1)) + 2/(@l+1))^2)

@s = short EMA
@l = long EMA

But can’t seem to get past this…
Current KAMA = Prior KAMA + SC x (Price - Prior KAMA)

Any insights on how to proceed?

Thanks,
Cameron