The moving average is the first indicator most people meet and the one I have seen misused most. It is drawn on every chart, quoted on every channel and described as "support" in a thousand posts. What it is, written down, is a very simple filter: the average of the last n closes. A rule built on it is among the easiest to test, because it needs one parameter and gives a clear signal. Here I define the simple and exponential averages, write two classic rules exactly (price above the 200 day average, and the 50 day average crossing the 200 day), run them on the Nifty 50 price index, count the whipsaws and then say what the result does and does not show. Spoiler for those who read ahead: on this data, over this window, they did not beat buy and hold. I will show you why that is one test and not a verdict. Education, not advice.
6By the end you can
- Compute a simple and an exponential moving average by hand and say why both lag the price.
- Write the price above 200 day rule and the 50 over 200 crossover as four line rules.
- Read the results table: CAGR, maximum drawdown, trades and time in market, against buy and hold on the same dates.
- Count whipsaws and say what share of round trips lost money after costs.
- Say what Brock, Lakonishok and LeBaron (1992) tested and why a result on a century of US data does not carry over automatically to a short Indian file.
- Explain why trying several average lengths is itself a form of data snooping.

What a moving average is
A simple moving average (SMA) of length n is the plain average of the last n closing prices. Every day the oldest close drops out and the newest comes in.
(C[t] + C[t-1] + ...
+ C[t-n+1]) / n
EMA(t) = EMA(t-1)
+ k x (C[t] - EMA(t-1))
Read 4 more paragraphs, 165 words
A worked example with real closes, the last five sessions in the file: 23,063.10 on 24 Sep 2026, then 23,140.50, 22,780.25, 22,716.20 and 22,620.45 on 30 Sep 2026. Add them and divide by five: SMA(5) is 22,864.10. The latest close is below it, which says the last five sessions slid on average.
An exponential moving average (EMA) gives the recent close more weight and lets old closes fade instead of dropping out at a cliff edge.
On 30 Sep 2026 the EMA(200) in my script moved like this: the previous value was 24,190.07, the close was 22,620.45, and the new value was 24,190.07 + 0.00995 x (22,620.45 - 24,190.07) = 24,174.46. One day of price moved it by about fifteen points. That is what a long average is: heavy, slow to be pushed.
On that same close the numbers were: SMA(200) 24,372.85, SMA(50) 23,901.58 and EMA(200) 24,174.46. The close, 22,620.45, was under all three, so on 30 Sep 2026 every rule here sat in cash.
Why every average lags
An average of the past cannot know the present. A 200 day SMA is centred about 100 days back, so when the price turns, the average turns about a hundred sessions later. The EMA lags too, though it reacts a little sooner than an SMA of the same length, since it gives the newest closes more weight. The price crossing the average is therefore a delayed signal. It is useful only if trends last long enough for the delay not to eat the gain.
Read one more paragraph, 58 words
That sets the trade off in one sentence. A short average reacts fast and gives many signals, most of them false. A long average reacts slowly and gives few, and it exits only after a good part of the fall has happened. The rest of the module is a measurement of that trade off in rupees and percent.
3 terms this section turns on
The classic test: Brock, Lakonishok and LeBaron (1992)
Before my numbers, the paper that made moving average rules a research topic. Brock, Lakonishok and LeBaron (1992), "Simple Technical Trading Rules and the Stochastic Properties of Stock Returns", Journal of Finance 47(5), pages 1731 to 1764, tested "two of the simplest and most popular trading rules": the moving average rule and the trading range break. They used Dow Jones Industrial Average data from 1897 to 1986 and compared the returns that followed signals to be long with those that followed signals to be out, using bootstrap methods. They report strong support for the technical rules: returns after the long signals were higher than after the out signals, and returns after the out signals were negative, a pattern they said was inconsistent with four standard models of how prices move (the random walk, AR(1), GARCH-M and exponential GARCH).
Read one more paragraph, 117 words
That is a careful, famous result, and it is also the reason for caution. The study found a rule that predicted something. It did not show that a trader could earn more than the market after costs, and it came from one market and period. Sullivan, Timmermann and White (1999) went back to the same idea with a larger universe of rules and 100 years of data, and measured and adjusted for the data snooping bias that comes from picking the winner among many rules (module 23.1). The lesson I take is not that moving averages work or fail. It is that a result has to be earned with a test that counts the rules tried.
Rule 1: price above the 200 day average
Out: close <= SMA(200)
Position: all in or all cash
Trade: next day's close
Cost: 0.1% each way
Every rule below is measured over the same dates, 25 Oct 2021 to 30 Sep 2026, so the 200 day average exists for all of them. Over that window buy and hold earned 4.57% a year with a maximum drawdown of -16.5%. The rule:
₹100 in Allcap became about ₹424 in the model
| Rule | CAGR | Max drawdown | Trades |
|---|---|---|---|
| Buy and hold | 4.57% | -16.5% | 1 |
| Price above SMA(200) | 2.96% | -14.6% | 36 |
| SMA(50) above SMA(200) | 2.13% | -16.9% | 8 |
| Price above EMA(200) | 1.69% | -18.3% | 42 |
| SMA(200) with 2% band | 1.72% | -16.2% | 10 |
Test script module-23-2. Nifty 50 price index, 25 Oct 2021 to 30 Sep 2026, signal at close t, trade at close t+1, 0.1% per side, cash at 0%. Dividends not included. One test on a short window, not proof.
- Buy and hold4.57%
- Price above SMA(200)2.96%
- SMA(50) above SMA(200)2.13%
- SMA(200) with 2% band1.72%
- Price above EMA(200)1.69%
Test script module-23-2, CAGR over 4.93 years. Nifty 50 price index, 0.1% per side, cash at 0%. Model test on past data, not a forecast.
| Entry | Exit | Net return |
|---|---|---|
| 25 Oct 2021 | 25 Feb 2022 | -8.3% |
| 21 Mar 2022 | 20 Apr 2022 | -0.1% |
| 22 Apr 2022 | 25 Apr 2022 | -1.5% |
| 29 Apr 2022 | 2 May 2022 | -0.4% |
| 1 Aug 2022 | 29 Sep 2022 | -3.2% |
| 13 Oct 2022 | 1 Mar 2023 | 2.4% |
| 6 Apr 2023 | 18 Nov 2024 | 33.0% |
| 13 May 2025 | 27 Jan 2026 | 2.2% |
Net return: the largest is 6 Apr 2023 at 33.0%
Eight of the 18 round trips of price above SMA(200), net of 0.1% per side. The other ten, mostly short, are in the script output. Same test as the table above.
Read 3 more paragraphs, 170 words
Read the first rule plainly. It earned 2.96% a year against 4.57% for buy and hold. That is lower. Its maximum drawdown was -14.6%, which is a smaller fall than the -16.5% of the index, and it was in the market 72.5% of the time. It made 36 trades, which is 18 round trips.
Here is where the money was made and lost. The rule's 18 round trips, from the script, entry and exit dates being trade dates (the closes at which the trade happened):
One trip, from 6 Apr 2023 to 18 Nov 2024, earned 33.0%. Nothing else came close. That is the shape of trend following that I see in most data: a few long stays pay for many short exits that cost a little each. Take that single trip out and the rule would have looked far worse. Take the long bad stretch of 2022 out and it would have looked better. With 18 round trips, one trip is more than a twentieth of the whole sample.
Whipsaws, counted
A whipsaw is a signal that reverses soon after it fires, so the trade enters, takes a small loss and exits. Traders talk about whipsaws as if they were bad luck. They are the price of the rule, and they can be counted.
| Rule | Round trips | Losing | Losing and under 30 sessions |
|---|---|---|---|
| Price above SMA(200) | 18 | 10 | 8 |
| SMA(50) above SMA(200) | 4 | 3 | 0 |
| Price above EMA(200) | 21 | 14 | 11 |
| SMA(200) with 2% band | 5 | 3 | 1 |
Test script module-23-2, whipsaw section. A losing trip is one with a net return of zero or less after 0.1% per side. Sessions are trading days.
Read 2 more paragraphs, 138 words
Of the 18 round trips of the price rule, 10 lost money after costs, and eight of those lasted fewer than 30 sessions. The average winner earned 5.6% and the average loser lost 2.5%. The average trip lasted 49.1 sessions. So the rule is right in a minority of exits and makes it up in size: this is how trend rules usually look, and it is why I never judge one by the share of profitable trades.
The EMA version was whipsawed more. It had 21 round trips, 14 of them losers, 11 of the losers under 30 sessions. Giving more weight to recent closes made the line hug the price, so the price crossed it more often. Faster is not better here: it turns small moves into trades, and each trade pays 0.2% to enter and exit.
Rule 2: the 50 over 200 crossover
Out: SMA(50) <= SMA(200)
Position: all in or all cash
Trade: next day's close
Cost: 0.1% each way

The crossover compares two averages and not the price to one. The 50 day average is itself smooth, so the signal flips much less. Over the window it made 8 trades, 4 round trips, and was in the market 70.5% of the time. CAGR was 2.13% and the maximum drawdown -16.9%, against 4.57% and -16.5% for buy and hold.
All four round trips, net of costs:
| Entry | Exit | Net return |
|---|---|---|
| 25 Oct 2021 | 19 Apr 2022 | -6.6% |
| 12 Sep 2022 | 11 Apr 2023 | -1.4% |
| 2 Jun 2023 | 20 Jan 2025 | 25.7% |
| 5 Jun 2025 | 18 Mar 2026 | -4.1% |
Test script module-23-2. Every round trip of SMA(50) above SMA(200), 25 Oct 2021 to 30 Sep 2026. The first entry is the first day the rule could trade; the average trip lasted 214.8 sessions.
Read 2 more paragraphs, 108 words
Three of four lost money, and one earned 25.7%. This is the whole sample of the rule: four events. If someone shows you a crossover rule that "has worked", ask how many times it fired. Here the number is four, and no confidence interval built on four trades should be believed, mine included.
The crossover did avoid whipsaws: none of its losing trips lasted under 30 sessions. It paid for that with delay. The first trip, entered on the first day the rule could trade, a few sessions after the index's peak close of 18 Oct 2021, lost 6.6%. A rule's result depends on the day it starts.
Variants: the EMA and a band
Two small changes people try when the first rule whipsaws.
The EMA(200). Replace the SMA with the exponential average. The result was 1.69% a year, a maximum drawdown of -18.3%, 42 trades and 75.6% of the time in the market. It did worse than the SMA version on every line. One test cannot say the EMA is worse in general; here it was.
Read 2 more paragraphs, 149 words
A band. Enter only when the close is more than 2% above the SMA(200), and exit only when it is more than 2% below. This is a filter against small crosses. It cut trades from 36 to 10 and round trips from 18 to 5, with a CAGR of 1.72% and a maximum drawdown of -16.2%. Three of the five trips lost money, and one was shorter than 30 sessions. The average winner earned 13.8% and the average loser lost 5.2%.
The band reduced the number of trades and did not reduce the damage. When the price falls, the band makes the exit later by two percent, and when it rises, the entry later by the same amount. It trades fewer whipsaws for a slower response. This is the trade off from earlier in the module. There is no setting that removes the lag and the false signals together.
Two terms to hold on to from 23.2
The same rules by calendar year
| Year | Buy and hold | Price above SMA(200) | 50 over 200 |
|---|---|---|---|
| 2021 (from 25 Oct) | -4.4% | -4.4% | -4.4% |
| 2022 | 4.3% | -2.6% | -1.6% |
| 2023 | 20.0% | 16.4% | 14.5% |
| 2024 | 8.8% | 5.5% | 8.8% |
| 2025 | 10.5% | 7.5% | 4.0% |
| 2026 (to 30 Sep) | -13.4% | -6.1% | -9.1% |
Test script module-23-2. Returns by calendar year after 0.1% per side. 2021 and 2026 are partial years. Nifty 50 price index.
The rules lost to buy and hold in 2022, 2023 and 2025. They won in 2026, when the index fell 13.4% and the rules fell less: -6.1% for the price rule and -9.1% for the crossover. In 2024 the crossover matched the index at 8.8% by sitting in the market all year. So the most any rule achieved over this window was to lose less in a bad year, and the cost was giving up part of the good years. That is what these rules are designed to do, and the one year that shows it is the last one.
Read one more paragraph, 67 words
I should be plain about what that means. One falling year is one observation. A trend rule is an insurance that pays in sustained falls, and the file has only one sustained fall that the rules caught for a while, the 2026 stretch, plus a smaller one in late 2021 and early 2022. Whether the insurance was worth its premium is a question for a longer history.
How sensitive is the result to the length?
Everybody uses 200. Why not 150, or 100? I ran the price rule with four lengths over the same window.
Where this section sits in module 23.2
| Price above SMA(n) | CAGR | Max drawdown | Trades |
|---|---|---|---|
| n = 50 | -1.20% | -19.9% | 88 |
| n = 100 | -0.55% | -18.8% | 66 |
| n = 150 | 1.65% | -16.2% | 40 |
| n = 200 | 2.96% | -14.6% | 36 |
| Buy and hold | 4.57% | -16.5% | 1 |
Test script module-23-2, sensitivity section. Same window, costs and timing as above.
Read one more paragraph, 102 words
The longer the average, the better the result in this window, and the fewer the trades. The 50 day version made 88 trades and earned -1.20%. That ordering is what costs and whipsaws predict, since a shorter average crosses the price more often. It does not mean 200 is the right length, and I tried four. If I had tried forty lengths and shown only the top one, I would be in the position described in module 23.1. The 200 was fixed before I ran anything, as the standard choice, and I report the other three so you can see the spread.
What costs took
Run the same rules with a cost of zero and the picture changes a little. From the script:
| Rule | CAGR with 0.1% per side | CAGR with no cost |
|---|---|---|
| Price above SMA(200) | 2.96% | 3.71% |
| SMA(50) above SMA(200) | 2.13% | 2.30% |
| Price above EMA(200) | 1.69% | 2.56% |
| SMA(200) with 2% band | 1.72% | 1.93% |
| Buy and hold | 4.57% | 4.60% |
Test script module-23-2, last section. The no cost column is not achievable; it shows how much of each gap is cost.
Read one more paragraph, 85 words
Even with zero cost, every rule trails buy and hold on CAGR over this window: 3.71% for the price rule against 4.60%. Costs explain part of the gap, most for the rules that trade most: the EMA rule earned 2.56% with no cost and 1.69% with it. The rest of the gap is the rule itself: time spent in cash while the index rose. I find this useful because it blocks the usual excuse. "It would have worked without costs" is not what happened here.

The same result in rupees
Percent a year is abstract, so here is the window in rupees. Put ₹10,00,000 in at the first close of the window, 25 Oct 2021, charge 0.1% per side, and read the value at the last close, 30 Sep 2026.
| Rule | Value at 30 Sep 2026 |
|---|---|
| Buy and hold | ₹12,46,749 |
| Price above SMA(200) | ₹11,54,676 |
| SMA(50) above SMA(200) | ₹11,09,716 |
| SMA(200) with 2% band | ₹10,87,850 |
| Price above EMA(200) | ₹10,86,107 |
Test script module-23-2, rupee section. Illustration on ₹10,00,000, price index, no dividends, no tax, 0.1% per side, cash at 0%. Not a forecast.
Read one more paragraph, 101 words
Same money, same dates, five outcomes. The index version finished at ₹12,46,749 and the price rule at ₹11,54,676. In a window that was weak at both ends, none of the rules turned a smaller fall into a bigger final value. I do not read that as a reason to dismiss the rules. I read it as the premium that protection cost in this sample, with all the limits that one sample has. Tax would change every line, and I have left it out on purpose, since it depends on holding periods and the instrument used, and module 1.5 covers the rules.
What this does and does not say
What the test says: on the Nifty 50 price index, from 25 Oct 2021 to 30 Sep 2026, a moving average rule held a smaller maximum drawdown in two cases (the price rule at -14.6% and the band rule at -16.2%) and a larger one in the other two, and every rule trailed buy and hold on return.
Read 2 more paragraphs, 157 words
What it does not say: that moving average rules fail. The window is 4.93 years, one rising stretch interrupted by a flat 2022 and a falling 2026. The rules are designed to lag. A rule that exits after a 10% fall and re-enters after a 10% rise does well when a fall is long and a recovery is slow, and badly when a fall is sharp and a recovery quick. This file has examples of both. Brock, Lakonishok and LeBaron used US data from 1897 to 1986. My result and theirs can both hold.
The honest summary I would give a friend: a moving average rule is a way to trade return for a bit of protection, and what you pay depends on how choppy the market is. In a choppy stretch the price pays, and the rule's whipsaw record is the bill. Before reading the return of any trend rule, I read its number of trades.

Where this meets how RupeeCase works
The rules in this path act on one index: in or out. RupeeCase strategies are not built that way. They rank stocks by factors and hold a basket, rebalancing on stated dates, and their record is shown as model, back tested with the date it was run. The cost of an average rule, whipsaws, and the question of how many versions were tried apply to any systematic idea, and module 4.5 covers how drawdowns are managed in a portfolio. Module 23.8 returns to how indicators combine into strategies.
Common mistakes
- Judging a trend rule by its win rate. The price rule lost on 10 of 18 trips and still made its return from a few long stays.
- Treating a cross as a forecast. It is a delayed fact: the 50 day average is below the 200 day because the last 50 closes were weaker.
- Reading four trades as a pattern. The crossover fired four times here.
- Tuning the length to the file. n = 200 earned 2.96% here and n = 50 earned -1.20%, but I tried four lengths and the ordering may not repeat.
- Forgetting the start date. The first trip of both rules lost money, because the window began a few sessions after a peak close.
- Comparing with a total return index. This file is a price index, so the baseline is slightly low for buy and hold.

What I'd keep from this
- SMA(n) is the plain average of n closes; EMA uses k = 2 / (n + 1) and weights recent closes more. Both lag.
- Over 25 Oct 2021 to 30 Sep 2026, buy and hold earned 4.57% with a -16.5% drawdown. Price above SMA(200) earned 2.96% with -14.6% and 36 trades; the 50 over 200 crossover earned 2.13% with -16.9% and 8 trades.
- Of 18 round trips of the price rule, 10 lost money after costs. One trip earned 33.0%.
- An EMA and a 2% band did not improve the result: 1.69% and 1.72% a year.
- With no cost, the price rule earned 3.71%, still under buy and hold at 4.60%.
- All of this is one 4.93 year test. Brock, Lakonishok and LeBaron (1992) used Dow Jones data from 1897 to 1986.
Questions readers ask
What is the difference between an SMA and an EMA?
An SMA gives every one of the last n closes the same weight and drops the oldest at a fixed point. An EMA, with k = 2 / (n + 1), gives recent closes more weight and old ones a fading weight. Both lag the price.
Did the 200 day average beat buy and hold on the Nifty 50?
Not in this test. From 25 Oct 2021 to 30 Sep 2026 the price above SMA(200) rule earned 2.96% a year against 4.57% for buy and hold, with a smaller maximum drawdown (-14.6% against -16.5%), at 0.1% per side and cash at 0%. It is one test on a short window.
What is a whipsaw?
A signal that reverses soon after it fires, so the trade enters, takes a small loss and exits. Of the 18 round trips of the price rule, 10 lost money after costs and 8 of those lasted under 30 sessions.
What did Brock, Lakonishok and LeBaron (1992) find?
Using Dow Jones data from 1897 to 1986, they tested a moving average rule and a trading range break. They reported higher returns after long signals than after out signals, a pattern inconsistent with four standard models of prices. It is US data.

Rules and figures in this module were last verified on 27 Nov 2026. Tax and regulatory rules change; check the source before acting.
