Plot buy and sell points in an excel chart using two moving averages
Below is an animated gif demonstrating a stock chart with monthly prices. Two moving averages #1, #2, buy and sell points are plotted in this chart.
When the moving averages intersects a buy or sell point is created. If you use the value 7 in cell C1, moving average #1 uses the average of 7 months.
As you can see using a 15 month average (#1) returns better and fewer buy and sell points.
S&P500
Extracting buy and sell points
Not only is the chart refreshed as you type new values in cell C1 and C2, the data below the chart is also instantly refreshed.
Array formula in cell B25:
Array formula in cell C25:
Array formula in cell D25:
How to create an array formula
- Copy array formula
- Select cell B25
- Paste formula
- Press and hold Ctrl+ Shift
- Press Enter
How to copy array formula
- Select cell B25
- Copy cell (not formula in formula bar)
- Select cell range B26:B50
- Paste
Calculating buy and sell points
Sheet: Calculation
Array formula in cell K2:
Array formula in cell L2:
Formula in cell M2:
Formula in cell N2:
Copy cells and paste down as far as needed.
The calculation sheet imports historical prices using this user defined function:
Excel udf: Import historical stock prices from yahoo – added features
Further reading
If you want to know how to plot buy and sell points in an excel stock chart, read this post:
Add buy and sell points to a stock chart
Download excel *.xlsm file
excel stock chart - two moving averages.xlsm
Related posts:
Add buy and sell points to a stock chart
Tracking a stock portfolio #2 in excel
Dynamic stock chart in excel – Add date ranges


















