MOVING AVERAGES
• A moving average is a statistic that captures the
average change in a data series over time.
• In finance, moving averages are often used by technical
analysts to keep track of price trends for specific securities.
1. Simple Moving Average (SMA)
Finance: SMA is used to smooth out short-term
fluctuations and highlight longer-term trends in stock prices.
For instance, a 30-day SMA of a stock price series is the
average of the stock prices over the last 30 days.
Weather Analysis: SMA can be used to smooth
temperature readings over a period, like a 7-day SMA of daily
temperatures to understand weekly trends.
2. Exponential Moving Average (EMA)
Stock Market Analysis: EMA gives more weight to recent
prices, making it more responsive to new information. Traders
use it to detect price trends and potential reversals.
Sales Forecasting: EMA can be applied to sales data to
quickly respond to changes in sales trends, such as a sudden
increase in demand.
3. Cumulative Moving Average (CMA)
Quality Control: CMA is used to track the average quality
measurement of products over time, where each new
measurement is averaged with all previous measurements.
Sensor Data Analysis: In environmental monitoring, CMA
helps to keep an ongoing average of pollutant levels or
temperature readings.
4. Weighted Moving Average (WMA)
Inventory Management: WMA can be used to forecast
inventory requirements by giving more importance to recent
demand patterns.
Energy Consumption: WMA is useful for smoothing daily
energy consumption data, giving more weight to recent days
to better predict short-term consumption
5. Moving Median
Noise Reduction: In signal processing, the moving median
can reduce noise more effectively than moving averages in
certain types of data, such as in audio signal processing.
Outlier Detection: Moving median is used in outlier
detection algorithms where the median is more robust to
outliers compared to the mean.
Program:
import pandas as pd
data = {'Date': pd.date_range(start='2023-01-01',periods=10,freq='D'),
'Value': [10, 12, 14, 16, 18, 20, 22, 24, 26, 28]}
df = pd.DataFrame(data)
df['SMA_3'] = df['Value'].rolling(window=3).mean()
print(df)
• OUTPUT:
THANK YOU

moving average (MA) is a stock indicator commonly used in technical analysis

  • 1.
  • 2.
    • A movingaverage is a statistic that captures the average change in a data series over time. • In finance, moving averages are often used by technical analysts to keep track of price trends for specific securities.
  • 3.
    1. Simple MovingAverage (SMA) Finance: SMA is used to smooth out short-term fluctuations and highlight longer-term trends in stock prices. For instance, a 30-day SMA of a stock price series is the average of the stock prices over the last 30 days. Weather Analysis: SMA can be used to smooth temperature readings over a period, like a 7-day SMA of daily temperatures to understand weekly trends.
  • 4.
    2. Exponential MovingAverage (EMA) Stock Market Analysis: EMA gives more weight to recent prices, making it more responsive to new information. Traders use it to detect price trends and potential reversals. Sales Forecasting: EMA can be applied to sales data to quickly respond to changes in sales trends, such as a sudden increase in demand.
  • 5.
    3. Cumulative MovingAverage (CMA) Quality Control: CMA is used to track the average quality measurement of products over time, where each new measurement is averaged with all previous measurements. Sensor Data Analysis: In environmental monitoring, CMA helps to keep an ongoing average of pollutant levels or temperature readings.
  • 6.
    4. Weighted MovingAverage (WMA) Inventory Management: WMA can be used to forecast inventory requirements by giving more importance to recent demand patterns. Energy Consumption: WMA is useful for smoothing daily energy consumption data, giving more weight to recent days to better predict short-term consumption
  • 7.
    5. Moving Median NoiseReduction: In signal processing, the moving median can reduce noise more effectively than moving averages in certain types of data, such as in audio signal processing. Outlier Detection: Moving median is used in outlier detection algorithms where the median is more robust to outliers compared to the mean.
  • 8.
    Program: import pandas aspd data = {'Date': pd.date_range(start='2023-01-01',periods=10,freq='D'), 'Value': [10, 12, 14, 16, 18, 20, 22, 24, 26, 28]} df = pd.DataFrame(data) df['SMA_3'] = df['Value'].rolling(window=3).mean() print(df)
  • 9.
  • 10.