I can use this code to calculate an exponential moving average in Pandas:
df['ewm_40'] = df['response'].ewm(span=40, adjust=True).mean()
When there are some volatile data points, there can be a sharp increase in the exponential moving average that is undesirable.
How would I cap the exponential moving average so no point moves more than 15% from the prior point? I want to balance stability while still reflecting new data.