Weighted Moving Average (WMA) for Indian Markets
Weighted moving average explained: the WMA formula, a 5-number worked example, Excel SUMPRODUCT steps, WMA vs SMA vs EMA, and the Hull moving average.
Key Takeaways
- 1.A Weighted Moving Average (WMA) multiplies each price by a weight, sums them, then divides by the sum of weights. For a 5-period WMA the divisor is 15 (5+4+3+2+1).
- 2.Worked example below: a 5-day WMA of Nifty closes (24,180 to 24,520) comes out to about 24,399, above the 5-day SMA of 24,342, which is why WMA reacts faster.
- 3.WMA crossovers fire earlier than SMA crossovers. We show an example Nifty 9-WMA versus 21-WMA crossover and the resulting Nifty options trade in rupees, including STT and brokerage.
- 4.On Indian F&O, trading WMA signals is taxed as business income at your slab, not as capital gains. STCG on equity delivery is 20% and LTCG is 12.5% above Rs 1.25 lakh.
- 5.WMA is a lagging trend filter, not a crystal ball. It whipsaws in sideways Nifty ranges, so confirm with RSI, volume or price structure before risking capital. All numbers here are illustrative.
What a Weighted Moving Average Actually Is
A Weighted Moving Average (WMA) is a trend line that gives the newest prices the loudest voice. A Simple Moving Average (SMA) treats a price from 9 days ago exactly the same as today's price. A WMA refuses to do that. It multiplies the most recent close by the highest weight and the oldest close by the lowest weight, so the line hugs current price action more tightly and turns sooner when momentum shifts.
This matters in Indian markets because indices like Nifty 50 and Bank Nifty can move 1 to 2 percent in a single session around events such as RBI policy, the Union Budget or quarterly results. A slow SMA can leave you holding a losing options position while the trend has already rolled over. A WMA, by leaning on recent closes, flags that change a day or two earlier. That earlier signal is the whole reason traders accept the extra noise that comes with it.
The trade-off is simple to state. Faster signals mean more signals, and more signals mean more false starts in a choppy market. So a WMA is best treated as a trend filter and timing aid, never as a standalone buy or sell machine. The sections below show you the exact maths, a full Nifty crossover, and the rupee outcome of trading it.
The WMA Formula, Step by Step
For an N-period WMA, the newest price gets weight N, the next gets N minus 1, and so on down to the oldest price which gets weight 1. You multiply each price by its weight, add up all those products, then divide by the sum of the weights. The sum of weights for N periods is N times N plus 1, divided by 2. For a 5-period WMA that sum is 15. For a 9-period WMA it is 45. For a 21-period WMA it is 231.
- Step 1: List the last N closing prices, newest first.
- Step 2: Assign weights from N down to 1, with N going to the newest close.
- Step 3: Multiply each close by its weight to get a weighted price.
- Step 4: Add all weighted prices together.
- Step 5: Divide that total by the sum of weights (15 for a 5-period WMA).
That last division is the part the old version of this page left out. A weights table is useless until you finish the division and get a number you can plot. Let us do exactly that with example Nifty closes next.
WMA in 30 seconds: a plain-number example
Forget markets for a moment. Take five numbers in time order, oldest first: 10, 12, 11, 14 and 15. Give them weights 1, 2, 3, 4 and 5, so the newest number counts five times. Multiply each number by its weight, add the results, then divide by the sum of the weights, which is 15.
| Position | Value | Weight | Value x weight |
|---|---|---|---|
| 1 (oldest) | 10 | 1 | 10 |
| 2 | 12 | 2 | 24 |
| 3 | 11 | 3 | 33 |
| 4 | 14 | 4 | 56 |
| 5 (newest) | 15 | 5 | 75 |
| Total | 15 | 198 |
The WMA is 13.2 and the simple average is 12.4. The WMA is higher because the numbers were rising and the biggest weight sat on the biggest, newest number. If the numbers were falling, the WMA would sit below the simple average.
Worked Example: 5-Day WMA on Nifty 50
Take five recent daily closes for Nifty 50. These levels are illustrative but sit in a realistic 2024 to 2025 range. We list them oldest to newest, then apply weights 1 through 5 with the heaviest weight on the newest close.
| Day | Nifty Close | Weight | Close x Weight |
|---|---|---|---|
| Day 1 (oldest) | 24,180 | 1 | 24,180 |
| Day 2 | 24,260 | 2 | 48,520 |
| Day 3 | 24,310 | 3 | 72,930 |
| Day 4 | 24,440 | 4 | 97,760 |
| Day 5 (newest) | 24,520 | 5 | 122,600 |
| Total | 15 (weights) | 365,990 (sum) |
Now finish the maths. The sum of the weighted prices is 365,990. Divide by the sum of weights, which is 15. That gives a 5-day WMA of 24,399.3, roughly 24,400. Compare that with the plain 5-day SMA, which is just the five closes added (121,710) divided by 5, equal to 24,342.
The WMA (about 24,400) is roughly 57 points above the SMA (24,342) because price has been rising and the newest, higher closes carry more weight. In an uptrend the WMA leads the SMA. In a downtrend it sits below the SMA. That gap is the early-warning value you are paying for.
With Nifty trading near 24,520 and the 5-day WMA at about 24,400, price is comfortably above its short WMA, which is a simple bullish read. The moment a daily close prints back below roughly 24,400, the short-term up-bias is in question. That single number, not the weights table, is what you act on.
An Example Nifty WMA Crossover Signal
Most traders do not watch price versus one WMA. They watch a fast WMA cross a slow WMA. A common pair on the Nifty daily chart is the 9-period WMA against the 21-period WMA. When the 9-WMA crosses above the 21-WMA, momentum has turned up. When it crosses below, momentum has turned down.
Here is an illustrative but realistic sequence. For three sessions the 9-WMA and 21-WMA values track each other, then the faster line punches through. The crossover candle closes around Nifty 24,450.
| Session | 9-WMA | 21-WMA | Signal |
|---|---|---|---|
| T minus 2 | 24,290 | 24,330 | 9-WMA below 21-WMA (bearish bias) |
| T minus 1 | 24,360 | 24,345 | Lines converging |
| T (cross) | 24,455 | 24,360 | 9-WMA crosses ABOVE 21-WMA (bullish) |
| T plus 1 | 24,560 | 24,390 | Trend confirmed, both rising |
On session T the 9-WMA (24,455) crosses above the 21-WMA (24,360). That is your bullish trigger. A faster SMA cross on the same data would typically have fired one session later, near 24,560, costing you about 100 Nifty points of entry. That earlier entry is exactly why momentum traders prefer the WMA for crossover timing.
Trading That Crossover With Nifty Options, in Rupees
A spot signal only matters once you turn it into a position. Say the bullish 9 over 21 WMA cross prints with Nifty near 24,450, and you express the view by buying one lot of a slightly out-of-the-money weekly call. The Nifty lot size is 65. Assume you buy the 24,500 call (weekly expiry) at a premium of Rs 110.
- Entry: Buy 1 lot 24,500 CE at Rs 110. Cost = 110 x 65 = Rs 7,150.
- Two sessions later Nifty pushes to about 24,650 as the WMA trend holds. The 24,500 CE is now worth roughly Rs 185.
- Exit: Sell 1 lot at Rs 185. Proceeds = 185 x 65 = Rs 12,025.
- Gross profit = 12,025 minus 7,150 = Rs 4,875 before costs.
Now subtract real costs so the number is honest. STT on options sold is 0.15 percent of premium since 1 April 2026 (it was 0.1 percent before), which on Rs 12,025 is about Rs 18. A discount broker charges a flat fee around Rs 20 per order, so Rs 40 for entry and exit. Add exchange transaction charges, GST at 18 percent on brokerage and STT-exempt charges, SEBI fees and stamp duty, and total round-trip costs in this example land near Rs 73, with about Rs 15 of that being exchange charges, SEBI fee, GST and stamp duty.
| Item | Amount (Rs) |
|---|---|
| Gross profit | 4,875 |
| STT (0.15% of sell premium) | 18 |
| Brokerage (Rs 20 x 2) | 40 |
| Exchange, GST, SEBI, stamp (approx) | 15 |
| Net profit (illustrative) | about 4,802 |
This profit of about Rs 4,802 from Nifty options is treated as business income from F&O, not capital gains. It is added to your other income and taxed at your slab rate. You cannot apply the 20 percent STCG or 12.5 percent LTCG equity rates to F&O profits. Keep a trade log because F&O turnover and audit rules under the Income Tax Act can apply.
The point of the example is not the exact rupee figure, which will vary with volatility and premiums. The point is that a WMA crossover is only worth trading once it survives costs and your tax slab. A signal that earns Rs 200 gross but costs Rs 120 round trip and is then taxed at 30 percent is not a strategy. Size and instrument choice decide whether a good signal becomes a good trade.
WMA vs SMA vs EMA: Which to Use When
Three moving averages dominate Indian charting platforms. The SMA weights every price equally. The WMA weights prices in a straight line, newest heaviest. The EMA (Exponential Moving Average) also favours recent prices but decays older prices smoothly using a multiplier rather than a fixed ladder. EMA reacts a touch faster than WMA in most settings, while WMA is slightly smoother than EMA for the same period.
| Feature | SMA | WMA | EMA |
|---|---|---|---|
| Weighting | Equal | Linear, newest heaviest | Exponential decay |
| Reaction speed | Slowest | Fast | Fastest |
| Whipsaws in range | Fewest | More | Most |
| Best use | Long-term trend, 200-day | Short to medium momentum | Intraday and scalping |
| Typical Nifty setting | 50, 200 | 9, 21 | 9, 20, 21 |
A practical rule for Indian traders: use a 200-day SMA to judge the broad market regime on Nifty, use a 9 and 21 WMA or EMA pair for swing entries, and drop to a 5 or 9 EMA for intraday Bank Nifty scalps. WMA sits in the middle, faster than SMA, smoother than EMA, which is why it is a comfortable default for positional and swing traders who hate excessive noise.
How to calculate WMA in Excel or Google Sheets
You do not need an add-in. Put your closing prices in column B, oldest at the top. In column D, type the weights 1 to 5 in five cells, for example D2 to D6. Then, in the row where the fifth price sits (B6), use SUMPRODUCT, which multiplies two columns cell by cell and adds the results:
=SUMPRODUCT(B2:B6,$D$2:$D$6)/SUM($D$2:$D$6)
- Keep the weights fixed with the dollar signs, so they do not move when you copy the formula.
- Copy the formula down. Each new row drops the oldest price and picks up the newest one, so the window slides along.
- For a 9-period WMA, list weights 1 to 9 and use nine price cells. The divisor becomes 45.
- Google Sheets accepts the same formula. Keep prices oldest first. If your sheet lists newest first, reverse the weights.
This is the same maths as the Nifty example above, so you can check your sheet against the 365,990 and 15 figures.
Linear weights versus custom weights
Charting platforms use linear weights: N, N minus 1, down to 1. It is a fixed ladder with no setting to tune, which is why two people using a 9-period WMA see the same line. A custom weighted average lets you choose the weights yourself, for example 50 percent on the latest value, 30 percent on the one before and 20 percent on the oldest. Custom weights must add up to 100 percent, or you divide by their sum as in the formula above. Analysts use them in forecasting when they have a reason to trust recent data more. For a trading chart, stick to the standard linear WMA so your line matches what others see.
Choosing WMA Periods for Indian Instruments
Period choice should match your holding time, not a generic preset. Shorter WMAs catch turns fast but generate more false signals, which is expensive in options where time decay punishes indecision. Longer WMAs are calmer but lag, which is fine for delivery investing where you are not paying premium decay every day.
- Bank Nifty intraday (high volatility): 5 and 13 WMA on 5-minute or 15-minute charts.
- Nifty swing trading (a few days to two weeks): 9 and 21 WMA on the daily chart.
- Large-cap delivery such as Reliance, TCS or HDFC Bank: 20 and 50 WMA on the daily chart.
- Long-term positional or SIP-style stock investing: 100 or 200 WMA to define the primary trend.
Bank Nifty deserves special care. With a lot size of 30 and large point swings, a single premium move can be several thousand rupees per lot, so a faster 5 and 13 WMA pair often suits its volatility better than the calmer 9 and 21 used on Nifty. Always backtest your chosen pair on at least a year of data for that specific instrument before committing real capital.
How much lag does a WMA remove
Lag is the average age of the prices inside the average. A simple average of N prices has an average age of (N minus 1) / 2 bars. A linear WMA has an average age of (N minus 1) / 3 bars. For a 9-period line that is 4 bars for the SMA and about 2.7 bars for the WMA, so the WMA reacts roughly a day and a half sooner on a daily chart.
| Period | SMA average age (bars) | WMA average age (bars) |
|---|---|---|
| 5 | 2 | 1.33 |
| 9 | 4 | 2.67 |
| 21 | 10 | 6.67 |
Less lag also means more false crosses in a sideways market. For a broader comparison see our guide to using moving averages, and the moving average calculator.
Using WMA for Stop-Loss and Risk Management
Beyond entries, the WMA doubles as a dynamic, trailing stop-loss. In a confirmed Nifty uptrend, many swing traders trail their stop a little below the rising 21-WMA. As the WMA climbs, the stop climbs with it, locking in gains without forcing you to guess a fixed exit level. The moment price closes decisively below the WMA, the trend assumption is broken and you exit.
Pair this with hard position sizing. A widely used rule is to risk no more than 1 to 2 percent of capital per trade. On a Rs 5,00,000 account, that is Rs 5,000 to Rs 10,000 of risk. If a Nifty option trade based on a WMA cross would lose more than that when your WMA stop is hit, the position is too large and you cut the lot count. The indicator finds the trade, but sizing keeps you in the game.
Indian indices often spike intraday and reverse, so place WMA-based stops on a closing basis (end of candle below the WMA) rather than on a single tick touch. This filters out the fake breakdowns that are common around 9:15 am open volatility and around major news.
Hull moving average: a faster WMA variant
Alan Hull built the Hull moving average (HMA) in 2005 to cut lag while keeping the line smooth. It is made only from WMAs. Take a WMA over half the period, double it, subtract a WMA over the full period, then smooth that result with one more WMA whose length is the square root of the period.
HMA(n) = WMA( 2 x WMA(n/2) minus WMA(n), square root of n )
A 16-period HMA, for example, uses WMA(8), WMA(16) and a final WMA(4). The line turns earlier than a plain WMA, but it can overshoot after a sharp move and it still lags. Treat a turn in the HMA as one input, and see our Hull moving average page for more.
Where WMA Fails: Honest Limitations
The biggest weakness is whipsaw in range-bound markets. When Nifty chops sideways in a 300-point band for two weeks, the 9-WMA and 21-WMA cross back and forth repeatedly. Each cross looks like a signal, but most are noise. In options, paying premium and round-trip costs on five failed crosses can quietly drain an account even when no single loss looks dramatic.
WMA is also a lagging indicator. It is built from past prices, so it confirms a move that has already begun rather than predicting one. It will never get you in at the exact bottom or out at the exact top. Around gap-up or gap-down events, such as a surprise RBI decision or global selloff, price can leap straight past the WMA and the signal arrives only after a large move has happened.
- Whipsaws in sideways ranges create repeated false crossovers.
- It lags, confirming trends after they start, never predicting them.
- Gaps can blow past the WMA, making the signal late and the entry poor.
- On illiquid stocks, thin volume distorts closes and therefore the WMA itself.
Confirming WMA Signals With Other Tools
Because WMA crossovers misfire in chop, treat them as one input, not the verdict. Combine the WMA trend read with a momentum oscillator and with volume. A 9 over 21 WMA bullish cross is far more trustworthy when the RSI is above 50 and rising, and when the cross candle prints on above-average volume. If RSI is flat near 50 and volume is thin, the cross is probably noise inside a range.
- RSI: a bullish WMA cross with RSI above 50 confirms real momentum.
- Volume: a cross on heavy volume is stronger than one on light volume.
- Price structure: only trust upside crosses above clear support, not into resistance.
- Higher timeframe: align the daily WMA trend with the weekly trend before sizing up.
For a deeper toolkit, explore the other guides in our technical indicators library and bolt momentum and volume filters onto your WMA system. The combination, not the WMA alone, is what gives an edge in Indian markets.
WMA outside trading: forecasting and smoothing
Shops and factories use a weighted moving average to forecast next month's demand from recent months. Say sales were 100, 120 and 110 units in the last three months, with weights 1, 2 and 3. The weighted total is 100 + 240 + 330 = 670, and 670 / 6 = 111.7 units. The recent month counts three times, so the forecast follows the latest level more closely than a simple average of 110 would. It is still only a smoothing method. It cannot see a festival, a price change or a supply problem coming.
No period is best in every market. Shorter settings such as 5 or 9 react faster and give more false crosses, and longer settings give fewer signals later. Pick a period that fits how long you hold, then review your own logged trades to see whether the setting helped or hurt.
Sources and Further Reading
For authoritative data and contract rules, refer to Zerodha Varsity, Investopedia, NSE India and NSE Indices (Nifty Indices). Lot sizes, STT rates and tax rules change, so always confirm current contract specifications and rates on the official source before you trade. All price levels and rupee figures here are illustrative and are not a recommendation or a promise of returns.
Sources and Further Reading
For authoritative data and further reading on this topic, refer to Zerodha Varsity, Investopedia, NSE India and NSE Indices (Nifty Indices). Always confirm current rules, rates and contract specifications on the official source before you trade.
Related Topics
Related Articles
Understanding the Qstick Indicator for Indian Markets
Learn the Qstick indicator with a worked Reliance example, best Nifty and Bank Nifty settings, a costed options trade and Indian tax rules.
Williams %R: Trading Guide for India (2026)
Master Williams %R indicator for Indian stock trading. Learn overbought/oversold signals, divergence, failure swings, and Nifty trading examples.
Understanding the T3 Moving Average in Indian Markets
How the T3 moving average works: the formula step by step, a worked Nifty calculation, settings for Indian markets and where T3 gives false signals.
Understanding Standard Pivot Points in Indian Markets
How to calculate standard pivot points from the previous high, low and close, read the support and resistance levels, and where pivot signals fail.
Linear Regression Indicator: Formula and Slope
Understand the Linear Regression Indicator, its slope and lookback settings, with checked example arithmetic and the limits of using a fitted price trend.
Understanding Price Volume Trend (PVT) in Indian Markets
Learn Price Volume Trend with a full worked PVT example on Reliance, real NSE volumes, divergence signals, and India tax on delivery vs F&O.
The trading journal for Nifty, Bank Nifty and Indian F&O. Track your trades, spot patterns, build discipline.
- Log one trade a day by hand, on purpose
- AI mentor finds your repeat mistakes
- Behavioural analytics catch tilt early
- Trading calendar with P&L heatmap
- Pre-trade checklist flags risks
Yearly ₹3,499 · No broker credentials