Display MACD, its signal line and histogram in Excel with MarketXLS India. Connect a broker and enter the MACD formula to return the three outputs beside a stock symbol.
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.MACD("INFY", "1h")
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.
Leave three adjacent cells empty for the result. Label them MACD, Signal and Histogram. Use the same interval across your watchlist so that an hourly calculation is not compared with a daily calculation.
Build the working example
For a transparent screen, calculate whether MACD exceeds its signal line using an ordinary Excel comparison and filter the rows. A positive histogram means MACD is above its signal; it does not necessarily mean MACD is above zero. Keep those conditions in separate columns when you need both.
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.
MACD
MACD on live broker candles. Leave output blank to spill MACD, Signal and Histogram across three cells.
Syntax:
MXLSIN.MACD(symbol, [interval], [fast], [slow], [signal], [output], [mode], [broker])
Example:
=MXLSIN.MACD("INFY", "1h")
Indicator
Calculates any supported technical indicator on live broker candles. Pick the indicator, interval, settings and output line.
Syntax:
MXLSIN.Indicator(symbol, indicator, [interval], [params], [output], [mode], [broker])
Example:
=MXLSIN.Indicator("INFY", "MACD", "1h", "12,26,9", "signal")
Candles
Spills the last N candles (Date, Open, High, Low, Close, Volume, OI) from your connected broker and keeps them updating.
Syntax:
MXLSIN.Candles(symbol, [interval], [bars], [mode], [broker])
Example:
=MXLSIN.Candles("INFY", "15m", 50)
Check the result
A current state and a new crossover are different observations. Inspect previous completed observations when your process specifically requires a crossing event. The general Indicator function can retrieve a selected output line when you do not need the whole table.
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 return just the signal line?
Yes. The Indicator example below selects the MACD signal output explicitly. Use the same parameters and interval when comparing it with another MACD formula.
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.

