The 21-day SImple Moving Average (SMA)

I can pull the value for the current price for any stock from the Internet in real-time. I cannot, however, pull the value for the current 21-Day SMA from the Internet in real-time. Does anyone know how I can?

To calculate the current 21-Day Simple Moving Average (SMA) for a stock in real-time, you’ll need to follow these steps:

  1. Collect the Closing Prices: Gather the closing prices of the stock for the past 21 trading days.
  2. Calculate the Sum: Add up all the closing prices from the past 21 days.
  3. Divide by 21: Divide the total sum by 21 to get the average.