RTI_SMA for Real-Time Simple Moving Averages in Excel

The RTI_SMA function from MarketXLS helps you calculate and monitor real-time Simple Moving Averages (SMA) for any valid symbol directly in Excel. By pulling intraday data in specified minute intervals, you can seamlessly track ongoing trends for short-term or long-term trading decisions without leaving your spreadsheet.

Why Use This Function?

  • Gain real-time insights into a stock’s short-term or long-term trend by calculating moving averages on the fly.
  • Quickly adapt your trading or investment strategy based on the latest price movements.
  • Combine with other RTI functions (like RTI_RSI, RTI_EMA) for deeper technical analysis within Excel.
  • Perfect for intraday traders who rely on up-to-the-minute data in 1, 5, 15, or 60-minute intervals (or other custom intervals).
  • Streamlined workflow—no more manual data exports or complicated macros.

How to Use in Excel

=RTI_SMA(symbol, [interval], [lookback], [field], [index])
  1. Enter the formula into a cell in Excel.
  2. Replace the arguments with your desired values (or leave them blank to use defaults).
  3. Ensure you have configured a data provider (e.g., Zerodha or AngelOne) and have an active MarketXLS license.

Press Enter to view real-time SMA values for the symbol directly in your spreadsheet.

Parameters Explained

Parameter Description Example Values Notes
symbol The stock ticker symbol. "AAPL", "MSFT" Must be a valid ticker from your configured data seller. Case-insensitive.
interval The timeframe in minutes for grouping data points. (Optional) 1, 5, 15, 60 Defaults to 5 if not provided. Note that large intervals aggregate more data per period.
lookback The number of periods (candles) to be included in the SMA calculation. (Optional) 10, 20, 50 Defaults to 20 if omitted. If set to 0, it becomes 50; above 200 returns an error.
field The data field on which to calculate the SMA. (Optional) "Last", "High", "Low" Defaults to "Last". Common fields include price or volume metrics, depending on MarketXLS capabilities.
index The data point index to retrieve. (Optional) 0, 1, 2 Default is 0 (typically returns the latest computed value).

Example Usage

Basic Examples

• To return the 20-period SMA of the last-traded price for AAPL every 5 minutes:
=RTI_SMA("AAPL")
This uses all default parameters: interval=5, lookback=20, field="Last", index=0.

• To get the 20-period SMA of the “High” price of MSFT with a 1-minute interval:
=RTI_SMA("MSFT", 1, 20, "High", 0)

Advanced Scenarios

• Longer lookback with a different field:
=RTI_SMA("GOOG", 5, 50, "Low", 0)
This calculates a 50-period SMA on the Low price of GOOG, aggregated in 5-minute intervals.

• Using a custom index:
=RTI_SMA("NFLX", 15, 20, "Last", 1)
While index usage may vary based on data availability, this indicates retrieving a previous data point (e.g., one candle ago) if supported.

• Handling edge cases:
=RTI_SMA("AAPL", 0, 0)
Here, both interval=0 and lookback=0 initially, but internally, interval defaults to 5 (due to the function signature) and lookback becomes 50.

Common Questions and Troubleshooting

  1. What if I use a lookback larger than 200?
    – The function will return “Number of periods cannot be more than 200.” Adjust your lookback down.

  2. Why am I getting “No data seller is configured. Please configure at least one data seller in Settings.”?
    – You must enable a data provider like Zerodha or AngelOne in MarketXLS Settings for RTI functions to work.

  3. Can I use daily or weekly intervals instead of minutes?
    – This function is designed for minute-based intervals. While you can enter custom minute values, the function is primarily intended for intraday analysis.

  4. Why do I get “ERR” or a similar error?
    – This could be due to invalid tickers, unconfigured data providers, or an expired license. Verify each parameter to ensure everything is correct.

  5. Which fields can I use for the field parameter?
    – “Last,” “High,” “Low,” “Open,” and “Volume” are common. Other fields depend on your data seller’s available metrics.

By leveraging RTI_SMA directly in Excel, you gain precise, real-time technical analysis for your chosen stock symbols. Whether you’re a day trader monitoring short-term market swings or a swing trader following broader trends, RTI_SMA delivers actionable moving average insights right where you need them—in your Excel spreadsheets.

Get Access to 1 Billion Usable Market data points IN YOUR EXCEL SHEETS WITH EASY TO USE EXCEL FUNCTIONS

Get started today
MarketXLS Excel Add-in Tutorial - How to Use Sma and Other Financial Formulas
How does MarketXLS work?