Exponentially Weighted Moving Average (EWMA)
- Definition: An EWMA is a type of moving average that applies exponentially decreasing weights to older observations. This means more recent data points contribute more strongly to the average than older data points.
 - Alpha (α): The smoothing factor (sometimes denoted alpha)
        determines how quickly the influence of older observations decreases.
        
- If 
αis close to 1 (e.g., 0.9), the EWMA reacts quickly to recent changes and discounts older data more heavily. - If 
αis smaller (e.g., 0.1), the EWMA reacts more slowly, retaining more memory of older observations. 
 - If 
 - Using EWMA in Pandas:
        
- Import pandas and load your time series data into a 
DataFrameorSeries. - Use the 
ewm()method to specify thealphaorspan,com,halflife, etc. - Then chain the 
mean()function to compute the EWMA. 
 - Import pandas and load your time series data into a 
 
Example Code in Pandas
import pandas as pd # Suppose 'df' is your pandas DataFrame with a 'close' column for prices # Set alpha to 0.3 as an example alpha_value = 0.3 df['ewma'] = df['close'].ewm(alpha=alpha_value, adjust=False).mean() print(df.head())
    In this example, each new EWMA value is computed using a fraction 
    α=0.3 of the current observation and 1 - α 
    of the previous EWMA value.