Build a moving-average crossover worksheet for NSE stocks with MarketXLS India. Use EMA or SMA for the levels and Crossover to detect when one series crosses another.
Try it in your own spreadsheet
Get the free MarketXLS sample workbook (.xlsx).
No account needed. MarketXLS live data requires a paid plan. Preview workbook
Get MarketXLS India: plans and subscription · See the India Excel add-in
Start with this formula
After connecting the required broker in the India add-in, enter:
=MXLSIN.EMA("INFY", "15m", 21)
Use the example as a starting point and replace its instrument, date range or cell references with your own inputs. Historical dates in examples are sample periods; expiry-specific symbols must refer to a valid contract.
Set up the worksheet
- Open Excel and install MarketXLS India from the add-in marketplace.
- Sign in with your MarketXLS India account. For broker data, connect Zerodha or Angel One using the add-in panel. Use the broker named by a broker-specific formula.
- Enter the formula in an empty area. Leave adjacent cells clear for any table or multi-cell output.
- Confirm the instrument and settings before extending the worksheet.
Create columns for symbol, fast average, slow average and crossover result. Use the same interval in every formula. Start with a 9/21 EMA example and keep the settings in the sheet title so the result cannot be mistaken for a daily signal.
Build the working example
Crossover returns +1 for a cross above, -1 for a cross below and 0 when no new cross occurs. A fast average can remain above a slow average for many bars while the crossover result is zero. Use a state condition when you want all stocks above a threshold, and an event condition when you want new crosses.
Functions and syntax
These examples use the India namespace, MXLSIN.. Square brackets in a syntax line indicate optional arguments; do not type the brackets into Excel. Keep text arguments in quotation marks and use cell references when you want editable inputs.
EMA
Exponential moving average on live broker candles.
Syntax:
MXLSIN.EMA(symbol, [interval], [period], [output], [mode], [broker])
Example:
=MXLSIN.EMA("INFY", "15m", 21)
SMA
Simple moving average on live broker candles.
Syntax:
MXLSIN.SMA(symbol, [interval], [period], [output], [mode], [broker])
Example:
=MXLSIN.SMA("RELIANCE", "day", 200)
Crossover
Detects a crossover of two values on the latest candle: +1 when the first crosses above the second, -1 when it crosses below, 0 otherwise.
Syntax:
MXLSIN.Crossover(symbol, fast, slow, [interval], [output], [mode], [broker])
Example:
=MXLSIN.Crossover("INFY", "EMA(9)", "EMA(21)", "15m")
Signal
Returns TRUE when your rule holds on the latest candle. Combine indicators with AND / OR.
Syntax:
MXLSIN.Signal(symbol, rule, [interval], [mode], [broker])
Example:
=MXLSIN.Signal("INFY", "RSI(14) < 30 AND CLOSE > EMA(200)", "day")
Check the result
Changing periods changes the rule. Do not select parameters solely because they make the current watchlist look attractive. Inspect the underlying values before turning a crossover into a more complex signal.
If Excel reports #NAME?, confirm the India add-in is loaded and the function name is spelled correctly. If a table reports #SPILL!, clear the cells in its output area. For missing broker data, check the connection in the add-in panel, verify the symbol, and test one request before expanding the sheet. Do not replace an error with zero when zero would change your analysis.
Can I combine RSI and a moving average?
Yes. Signal accepts supported indicator conditions joined with AND or OR. Use the documented rule syntax and verify each condition separately before combining them.
Get this working in your Excel
Choose a MarketXLS India subscription, install the India add-in, and follow the steps above. The pricing page lists the current subscription options; broker access requirements are separate from the spreadsheet formulas.
Use the India function library for the complete parameter reference, or contact the India team with the formula, instrument and error message if you need setup help. Never send broker passwords or access tokens.
Continue with the India Excel workflow series for related guides.
