Ledger & Candle
Chapter 04 · Technical Analysis

Technical Indicators

Reading time ~75 min · Data as of 30 Sep 2026 · Based on Zerodha Varsity Module 2 (Technical Analysis): Volumes, Moving Averages, Indicators Part 1 & 2, Other Indicators

1. What you'll learn and why it matters

In Chapters 2 and 3 you learned to read price itself: candles, support and resistance, trends and patterns. An indicator is a formula applied to that same price and volume data. It turns a messy chart into a cleaner number or line that answers one specific question: Is there a trend? How strong is it? Is the move overstretched? How big is a normal day's move?

By the end of this chapter you will be able to:

Why this matters for your style

Swing trader (days to weeks): you need a trend filter (moving averages, ADX), a timing tool (RSI, MACD, Bollinger) and a volatility tool (ATR) to set stops. Positional/long-term investor: the 50/200-day averages, weekly RSI and relative strength against Nifty help you avoid buying into falling knives and help you pick stocks that are already outperforming. Futures trader: leverage makes stop placement and position sizing non-negotiable, and ATR is the tool that tells you whether one lot is even affordable within your risk budget (Section 10 shows a real case where it is not).

How to read this long chapter

On a first pass, focus on the core: Sections 2 (families), 3–5 (moving averages and trend filters), 6 (RSI), 10 (ATR for stops and sizing) and 18 (combining tools). Sections 7–9 and 11–15 each add one more tool; read them one at a time, ideally with the stock's chart open. Sections 16–17 are reference and evidence, and you can come back to them later.

An honest warning before we start

No indicator predicts the future. Every one of them is a transformation of past prices, so it carries no information that was not already on the chart. They help you organise what you see and apply rules consistently. This chapter deliberately shows real cases where the textbook signal failed, along with a small statistical test across 37 stocks, so you build judgement rather than faith. All examples are historical analysis for education, not recommendations to buy or sell anything.

Data note

All numbers come from the course dataset: 10 years of daily NSE data (via Yahoo Finance) up to 30 Sep 2026, computed in course/scripts/ch04_figures.py. The Yahoo files contain a few zero-volume "placeholder" bars on exchange holidays (for example 1 May 2026 and 14 Sep 2026, where open = high = low = close). The script removes those before computing indicators. Prices are split-adjusted but not dividend-adjusted. Your broker's chart (Kite, TradingView, Fyers) may show values that differ by a small amount because of data vendor differences and how the first values of an average are seeded. That is normal.

2. What an indicator is: leading vs lagging, oscillators vs trend-following

Varsity groups indicators into two broad camps, and the split is worth understanding before you learn any single formula.

TypeWhat it doesTypical examplesStrengthWeakness
Leading (usually oscillators)Tries to warn of a turn before the trend changes by measuring momentum, i.e. how fast price is movingRSI, Stochastic, Bollinger %B (Section 8)Early signals, good in sideways marketsMany false signals; in a strong trend it stays "overbought" or "oversold" for weeks
Lagging (trend-following)Confirms a trend after it has startedMoving averages, MACD, Supertrend, ADX, DonchianCatches big trends and keeps you in themLate entries and exits; whipsaws (repeated small losses) in sideways markets

An oscillator is an indicator that moves between fixed bounds (RSI and Stochastic run from 0 to 100) or around a centre line (MACD oscillates around zero). Because it is bounded, it can show "extremes". A trend-following indicator, such as a moving average, is plotted in price units on top of the chart and has no extremes. It simply follows price with a delay.

A third group is easy to overlook but in practice it is the most useful: volatility indicators (ATR, Bollinger bandwidth). They say nothing about direction. They tell you how large a normal move is, which is exactly what you need to place a stop that is not too tight and to size a position. A fourth group is volume-based (volume average, OBV, VWAP), which tells you whether a move has participation behind it.

Nifty 50 from October 2025 to September 2026 with 50 and 200-day SMAs, RSI(14) and ATR as a percent of price in three panels
Figure 4.1 — Three indicator families on one chart. Top: trend (Nifty with its 50- and 200-day SMAs). Middle: momentum (RSI 14). Bottom: volatility (ATR 14 as % of price). Volatility peaked at 2.07% of price on 8 Apr 2026, right after the March 2026 crash, and was lowest at 0.65% on 7 Jan 2026. On 30 Sep 2026 Nifty closed at 22,620 with RSI 25.3, below both its 50-day (23,902) and 200-day (24,373) averages. Source: NSE data via Yahoo Finance.
The single most important idea in this chapter

Every indicator works in one market regime and fails in another. Trend-followers make money in trends and bleed in ranges. Oscillators make money in ranges and fail badly in trends. So the first question is always "What regime is this stock in?" and only then "What is my signal?" ADX (Section 11) and the 200-day average (Section 5) exist mainly to answer the first question.

3. Moving averages: SMA and EMA

3.1 The idea in plain language

Daily closes are noisy. A moving average (MA) replaces each day's close with the average of the last n closes. Every day the oldest close drops out and the newest one comes in, so the average "moves" along the chart. The result is a smooth line that shows the underlying direction. Varsity's short summary is "the trend is your friend": the MA is a way to see that trend.

The logic: averaging cancels random day-to-day noise but keeps persistent drift. If most of the last 50 closes were higher than the 50 before them, the 50-day average is rising, and that is about as simple a definition of an uptrend as you can get. The cost of smoothing is lag. The average always trails price, and the longer the window, the bigger the lag.

3.2 Simple moving average (SMA)

Formula\[ SMA_t(n) = \frac{C_t + C_{t-1} + \dots + C_{t-n+1}}{n} \]
\(C\)
A daily closing price, in ₹ (index points for Nifty). The small subscript says which day.
\(t\)
Today, the day you are calculating the average for. \(C_{t-1}\) is the previous session's close, \(C_{t-2}\) the one before that, and so on.
\(n\)
The window length: how many sessions go into the average (10, 20, 50, 200…).
\(C_{t-n+1}\)
The oldest close still inside the window. With \(n = 10\) it is \(C_{t-9}\): today plus the 9 sessions before it makes 10 closes. The dots \(\dots\) mean "and every close in between".
\(SMA_t(n)\)
The \(n\)-day simple moving average on day \(t\), in the same units as price.

How it works: add up the last \(n\) closes, including today's, and divide by \(n\). The next day, drop the oldest close, add the new one and divide again. Price above a rising SMA is the simplest sign of an uptrend. The RELIANCE example in Section 3.3 works a 10-day SMA by hand.

Every one of the n closes gets equal weight \(1/n\). One side effect is the "drop-off effect": the SMA can change direction just because a big old close falls out of the window, even if today's price did nothing unusual.

3.3 Exponential moving average (EMA)

The EMA gives more weight to recent prices. Varsity ties this to the idea that "markets discount everything", so the latest price carries the most information. It is recursive: today's EMA is yesterday's EMA nudged towards today's close by a fraction \(\alpha\), called the smoothing factor.

Formula\[ EMA_t = \alpha \, C_t + (1-\alpha)\, EMA_{t-1} = EMA_{t-1} + \alpha\,(C_t - EMA_{t-1}) \] \[ \alpha = \frac{2}{n+1} \]
\(EMA_t\)
The exponential moving average on day \(t\) (today), in ₹.
\(EMA_{t-1}\)
Yesterday's EMA value. Each day's EMA is built from the previous day's.
\(C_t\)
Today's closing price.
\(\alpha\)
"Alpha", the smoothing factor: a fraction between 0 and 1. It is the weight today's close gets.
\(n\)
The EMA length in sessions (10, 20, …). A bigger \(n\) gives a smaller \(\alpha\) and a slower line.
  1. Work out \(\alpha = 2/(n+1)\).
  2. Seed: the first EMA value (on the \(n\)-th day) is the plain SMA of the first \(n\) closes.
  3. Every later day: take the gap between today's close and yesterday's EMA, \(C_t - EMA_{t-1}\), multiply it by \(\alpha\) and add the result to yesterday's EMA. That is the right-hand form of the formula. The left-hand form gives the same number: \(\alpha\) of today's close plus \((1-\alpha)\) of yesterday's EMA.
  4. So the EMA moves a fixed fraction of the way towards each new close. That is why it turns sooner than an SMA of the same length.

For a 10-day EMA, \(\alpha = 2/11 = 0.1818\): today's close gets 18.2% weight and the past gets the remaining 81.8%, which itself decays geometrically. For a 20-day EMA, \(\alpha = 2/21 = 0.0952\). For the first value, charting platforms usually start ("seed") the EMA with the SMA of the first n closes, and we do the same here.

Real example · RELIANCE · Aug–Sep 2026

Computing a 10-day SMA and EMA step by step

DateCloseSMA 10EMA 10What happened
18 Aug 20261,322.0––1st close in window
19 Aug1,311.0––
20 Aug1,313.2––
21 Aug1,316.0––
24 Aug1,309.8––
25 Aug1,317.0––
26 Aug1,298.0––
27 Aug1,282.2––
28 Aug1,287.0––
31 Aug1,277.01,303.321,303.32Seed: EMA = SMA of first 10
1 Sep1,309.01,302.021,304.35EMA recursion starts
2 Sep1,313.11,302.231,305.94
3 Sep1,302.51,301.161,305.32
4 Sep1,322.01,301.761,308.35
…………
30 Sep1,187.01,221.791,218.32Falling market: EMA is closer to price
  1. SMA on 31 Aug: add the ten closes from 18 Aug to 31 Aug: 13,033.2. Divide by 10: \(SMA = 1{,}303.32\).
  2. Seed the EMA: \(EMA_{31\,Aug} = 1{,}303.32\).
  3. EMA on 1 Sep: \(EMA = 1{,}303.32 + 0.1818 \times (1{,}309.0 - 1{,}303.32) = 1{,}303.32 + 1.03 = 1{,}304.35\).
  4. SMA on 1 Sep: the 18 Aug close (1,322.0) drops out and 1,309.0 comes in: \(1{,}303.32 + (1{,}309.0 - 1{,}322.0)/10 = 1{,}302.02\). Because a high old close dropped out, the SMA fell even though price rose that day. That is the drop-off effect in action.
  5. By 30 Sep RELIANCE had fallen to 1,187.0. The EMA (1,218.32) had followed price down more closely than the SMA (1,221.79).

Seeding matters only at the start. An EMA computed over the full 10-year history gives 1,218.24 on 30 Sep, only 0.08 away. The influence of the starting value fades away after a few multiples of n.

3.4 SMA vs EMA on a real turn

Nifty 50 January to May 2026 with 20-day SMA and EMA; the EMA turns up on 8 April and the SMA on 15 April
Figure 4.2 — Nifty 50, Jan–May 2026, with the 20-day SMA and 20-day EMA. After the closing low of 22,331 on 30 Mar 2026, the EMA turned up on 8 Apr (Nifty at 23,997) and the SMA only on 15 Apr (24,231). At the widest gap (13 Mar 2026), price was 1,775 points below the SMA but only 1,509 below the EMA, because the EMA had already followed price further down. Source: NSE data via Yahoo Finance.
Real example · Nifty 50 · Feb–Apr 2026

Faster is not always earlier

On the way up in April 2026, the EMA turned a full week before the SMA (8 Apr vs 15 Apr). On the way down the EMA was also earlier: it started falling for good on 24 Feb (Nifty 25,424.7), and the SMA only on 27 Feb (25,178.7). The days in between show the SMA's drop-off effect. On 19 Feb Nifty fell 1.4% (25,819.3 → 25,454.3), yet the 20-day SMA rose by 14.8 points, because the close leaving its window was lower still. The EMA has no window, so it fell 21.4 points that day. The cost of the EMA's speed is noise. In February alone it changed direction six times (3, 13, 16, 19, 23 and 24 Feb), against four times for the SMA. Neither one is "better". The EMA reacts sooner and makes more false turns. The SMA is steadier but can move for reasons that have nothing to do with today's price.

3.5 Choosing the length

LengthCommonly used forWho uses it
9–21 day (often EMA)Short-term swing direction, trailing stops on fast movesSwing traders
50 dayIntermediate trend; pullbacks to it in strong stocks are widely watchedSwing and positional traders
100 dayIntermediate to long trendPositional traders
200 dayLong-term trend; the most widely quoted "bull or bear" lineInvestors, fund managers, the media
10 week / 30 week / 40 weekWeekly-chart equivalents of 50/150/200 daysPositional traders and investors
How to use moving averages in practice

4. Moving-average crossovers and the golden/death cross

4.1 The crossover system

To reduce whipsaws, Varsity suggests using two averages instead of price vs one average. The shorter one is the "fast" MA and the longer one is the "slow" MA. Buy when the fast MA crosses above the slow MA. Exit when it crosses back below. Varsity lists these popular EMA pairs:

PairTypical holdingSuits
9 × 21Several sessionsShort swing trades
25 × 50Several weeksMedium-term swings
50 × 100Several monthsIntermediate trends
100 × 200A year or moreLong-term trend following

Varsity is clear about the profile of such systems: many small losses, a few large wins, and you must take every signal, because the edge comes from the rare big trend and you cannot know in advance which signal it will be.

4.2 Golden cross and death cross

The most famous pair is the 50-day and 200-day SMA. A golden cross is the 50-day crossing above the 200-day. A death cross is the 50-day crossing below it. Financial media love these events. Here is every one of them on the Nifty 50 in our data:

Nifty 50 2017 to 2026 log chart with 50 and 200-day SMAs and markers for all golden and death crosses
Figure 4.3 — Every Nifty 50 golden cross (green) and death cross (red), 2017–2026, log scale. Source: NSE data via Yahoo Finance.
DateTypeNifty close3 months later6 months laterUntil next crossChange to next cross
16 Nov 2018Death10,682−0.7%+11.7%15 Mar 2019+7.0%
15 Mar 2019Golden11,427+2.6%+1.4%13 Sep 2019−3.1%
13 Sep 2019Death11,076+10.3%−25.4%11 Nov 2019+7.6%
11 Nov 2019Golden11,913+1.0%−25.9%19 Mar 2020−30.6%
19 Mar 2020Death8,263+24.7%+36.1%21 Aug 2020+37.6%
21 Aug 2020Golden11,372+13.1%+29.1%18 Apr 2022+51.0%
18 Apr 2022Death17,174−6.5%+1.8%9 Sep 2022+3.8%
9 Sep 2022Golden17,833+3.7%−3.8%10 Apr 2023−1.2%
10 Apr 2023Death17,624+10.3%+12.4%1 Jun 2023+4.9%
1 Jun 2023Golden18,488+4.1%+12.8%17 Jan 2025+25.5%
17 Jan 2025Death23,203+4.9%+8.0%4 Jun 2025+6.1%
4 Jun 2025Golden24,620+0.4%+5.7%17 Mar 2026−4.2%
17 Mar 2026Death23,581+2.2%−0.7%still active on 30 Sep 2026−4.1%
Real data · Nifty 50 · 2017–2026 · honest result

Did the golden cross "work" on the Nifty?

  1. Golden crosses: 6. Measured from each golden cross to the next death cross, only 2 of 6 were profitable (Aug 2020: +51.0%, Jun 2023: +25.5%). The average was +6.2%, and that average comes almost entirely from those two big trends. That is the "few large wins" profile Varsity describes.
  2. The worst one: the golden cross of 11 Nov 2019 was still "bullish" when COVID hit. By the time the death cross arrived on 19 Mar 2020, Nifty was 30.6% lower. The death cross then arrived within days of the bottom (19 Mar 2020 at 8,263; the low close was 7,610 on 23 Mar), and Nifty rose 37.6% before the next golden cross.
  3. Death crosses as sell signals: all 6 completed death-cross periods ended higher than where they started. The current one, active since 17 Mar 2026, is −4.1% so far. In this decade, Indian large caps recovered from falls quickly, and the 200-day average was too slow to help.
  4. As a full system (long when 50 > 200, otherwise cash, price index only, no costs or dividends), from 24 Jul 2017 to 30 Sep 2026: +29.3% total (CAGR 2.8%), max drawdown −41.9%, invested 74% of the time. (CAGR, the compound annual growth rate, is the steady yearly return that would produce the same total. Max drawdown is the largest fall from a previous peak in the equity curve.) Buy-and-hold over the same period: +127.0% (CAGR 9.3%), max drawdown −38.4%.

Judgement: on a broad index that kept recovering quickly, the 50/200 cross was a poor timing tool. It shines in long, grinding bear markets (2000–03 and 2008 in many markets), and this decade did not have one in India. It is still worth knowing as a regime label, and the 30 Sep 2026 state, a death cross since 17 Mar 2026, tells you the long-term trend is down.

Common mistakes with crossovers

5. Price vs the 50/200-day average as a trend filter

Many swing traders do not trade crossovers at all. They use "close above the 200-day SMA" (often together with "50-day above 200-day") only as a filter: long setups are considered only when it is true. The idea is that buying pullbacks inside long-term uptrends puts the larger tide behind you.

Nifty 50 from 2025 to September 2026 with 200-day SMA, shaded green above and red below, highlighting whipsaw crossings in April-May 2025 and the extended period below since February 2026
Figure 4.4 — Nifty vs its 200-day SMA, 2025–2026. Between 21 Apr and 12 May 2025, Nifty crossed the line 5 times in three weeks (whipsaw). Since 27 Feb 2026 it has stayed below. Even the 3 Aug 2026 rally high (24,774) stopped just under the 200-day SMA (24,778). On 30 Sep 2026 Nifty was 7.2% below its 200-day average. Source: NSE data via Yahoo Finance.
Real data · Nifty 50 · 2017–2026 · honest result

Does "above the 200-day" predict better 3-month returns?

Nifty on day tDaysAvg next-3-month return% positiveWorst
Above 200-day SMA1,724+1.74%62.3%−38.0%
Below 200-day SMA479+7.11%84.6%−13.8%

Nifty spent 76% of days above its 200-day average. In this sample, the days below it were followed by better returns, because almost every dip below (2018, 2020, 2022, 2023, 2025) was bought quickly. The worst three-month outcome (−38%) started when Nifty was above the line, in February 2020. Note that the "below" days come from only a handful of separate episodes, so the sample is small.

What this tells you: for an index that mean-reverts, the 200-day filter is not a return predictor. Its real jobs are (a) to keep trend-following stock strategies out of stocks in long declines (TCS in Section 6 is an example) and (b) to make you smaller and more selective when the whole market is below it, as it has been since February 2026. Test any filter on your own universe before trusting it.

Practical rule set many swing traders use

6. RSI: Wilder's momentum oscillator

6.1 What it measures and why

Momentum is the speed of price change. If a stock rises 10% in 5 days it has high momentum. If it takes 5 months, momentum is low. J. Welles Wilder's Relative Strength Index (1978) compares the size of recent up-days with the size of recent down-days and squeezes the ratio into a 0–100 scale. When up-moves dominate, RSI is high. When down-moves dominate, it is low. (RSI has nothing to do with "relative strength vs the index", which is covered in Section 15. The name causes endless confusion.)

6.2 Calculation (14 periods, Wilder smoothing)

Formula\[ G_t = \max(C_t - C_{t-1}, 0), \qquad L_t = \max(C_{t-1} - C_t, 0) \] \[ \overline{G}_{14} = \tfrac{1}{14}\textstyle\sum_{i=1}^{14} G_i \ \text{(seed)}, \qquad \overline{G}_t = \dfrac{13\,\overline{G}_{t-1} + G_t}{14} \ \text{(thereafter; same for } \overline{L}) \] \[ RS = \frac{\overline{G}}{\overline{L}}, \qquad RSI = 100 - \frac{100}{1 + RS} \]
\(C_t,\ C_{t-1}\)
Today's close and the previous session's close, in ₹.
\(G_t\)
Today's gain: how much the close rose, or 0 if it fell. \(\max(x, 0)\) means "the larger of \(x\) and 0", so a negative change becomes 0.
\(L_t\)
Today's loss: how much the close fell, written as a positive number, or 0 if it rose.
\(\overline{G},\ \overline{L}\)
The average gain and average loss (the bar on top means "average"), in ₹ per day. \(\overline{G}_t\) is today's value, \(\overline{G}_{t-1}\) yesterday's.
\(\textstyle\sum_{i=1}^{14} G_i\)
The first 14 daily gains added up. \(\Sigma\) means "add up"; \(i\) counts from 1 to 14.
\(RS\)
Average gain divided by average loss. No units.
\(RSI\)
The final reading, on a 0–100 scale.
  1. For each day, turn the change in close into a gain or a loss. One of the two is always 0.
  2. Seed: once you have 14 changes (that takes 15 closes), average the 14 gains and the 14 losses separately.
  3. Every later day: new average = (13 × yesterday's average + today's value) ÷ 14, for gains and losses separately. This is Wilder's smoothing.
  4. Divide average gain by average loss to get \(RS\), then convert it: \(RSI = 100 - 100/(1+RS)\). Equal gains and losses give \(RS = 1\) and RSI 50. Mostly gains push RSI towards 100, mostly losses towards 0.
  5. Reading: above 70 is usually called overbought and below 30 oversold (Section 6.3).

Wilder's smoothing is just an EMA with \(\alpha = 1/14\) (not \(2/15\)). Varsity's worked example uses a plain 14-day average of gains and losses (gains 29 points, losses 10 points → avg gain 2.07, avg loss 0.714, RS 2.90, RSI 74.35). That is exactly the seed step. Charting platforms then switch to Wilder's smoothing for every later day, so their RSI has a "memory" longer than 14 days.

Real example · SBIN · Aug–Sep 2026

RSI(14) from scratch

DateCloseChangeGainLossAvg gainAvg lossRSRSI (this window)RSI (full history)
11 Aug 20261,066.0–––––––57.80
12 Aug1,082.0+16.016.00… 14 changes collected (12 Aug – 31 Aug) …
13 Aug1,083.0+1.01.00
14 Aug1,067.7−15.3015.3
17 Aug1,061.2−6.506.5
18 Aug1,053.0−8.208.2
19 Aug1,048.6−4.404.4
20 Aug1,048.0−0.600.6
21 Aug1,048.7+0.70.70
24 Aug1,039.5−9.209.2
25 Aug1,048.0+8.58.50
26 Aug1,052.0+4.04.00
27 Aug1,042.9−9.109.1
28 Aug1,047.5+4.64.60
31 Aug1,060.0+12.512.503.383.810.8947.0254.58
1 Sep1,034.5−25.5025.53.145.360.5936.9444.54
2 Sep1,020.9−13.6013.62.915.950.4932.8940.28
3 Sep1,023.4+2.52.502.885.520.5234.3141.39
…
30 Sep959.5−5.205.22.946.310.4731.7633.72
  1. Seed (31 Aug): the 14 gains sum to 47.3, so the average gain is 47.3/14 = 3.38. The 14 losses sum to 53.3, so the average loss is 53.3/14 = 3.81.
  2. \(RS = 3.38/3.81 = 0.887\), so \(RSI = 100 - 100/1.887 = 47.02\).
  3. 1 Sep (loss of 25.5): \(\overline G = (3.378\times13 + 0)/14 = 3.14\), \(\overline L = (3.807\times13 + 25.5)/14 = 5.36\), \(RS = 0.586\), \(RSI = 36.94\). One large down day pulled RSI down 10 points.
  4. Why two RSI columns? The "full history" RSI has been smoothing since 2016, so it remembers the stronger August. Our window-seeded RSI starts fresh. They differ by about 7.5 points on 31 Aug and converge to within 2 points by 30 Sep (31.76 vs 33.72). For trading, always use the full-history value. Your charting platform does the same.

6.3 Overbought and oversold

The classic reading is that RSI above 70 is overbought (a possible pullback) and below 30 is oversold (a possible bounce). Varsity's author prefers the stricter 80/20, which gives fewer but more extreme signals. Varsity also gives the opposite interpretation: if RSI stays overbought for a long time, that shows strong positive momentum, which is a reason to stay long, not to sell. The real data agrees with that more nuanced reading.

Real example · Nifty 50 · Sep 2026 · a failure

"Oversold" can keep getting more oversold

Nifty's RSI first fell below 30 on 9 Sep 2026 (close 23,431.5, RSI 26.4). Buying that "oversold" reading would have been early. On 30 Sep Nifty closed at 22,620.4 (−3.5%) with RSI 25.3, and it spent 9 sessions of September below 30. In a downtrend (Nifty had been below its 200-day SMA since February), oversold readings describe the trend. They do not predict a turn.

6.4 RSI ranges shift with the trend

A very useful practical idea, popularised by Andrew Cardwell and Constance Brown, is that in a strong uptrend RSI tends to oscillate between about 40 and 80 and rarely reaches 30. In a downtrend it oscillates between about 20 and 60 and rarely reaches 70. So in an uptrend, a dip to 40–45 is the "oversold" buy zone, and in a downtrend a rally to 55–60 is the "overbought" zone.

Two panels: SBIN uptrend June 2025 to February 2026 with RSI between 40 and 80, and TCS downtrend 2025 to 2026 with RSI between 20 and 60
Figure 4.5 — RSI ranges by regime. Left: SBIN rose 47.7% (813.7 → 1,201.7) from 1 Jun 2025 to 28 Feb 2026. Its RSI never went below 39.9 (1 Aug 2025), and the 10th–90th percentile range was 46.0–76.2. Right: TCS fell 50.1% (4,112.5 → 2,050.6) from Jan 2025 to Sep 2026. RSI spent 17.8% of days below 30 and only 0.9% above 70, with a 10th–90th percentile range of 26.6–58.6. Source: NSE data via Yahoo Finance.

6.5 Divergence

A bullish divergence happens when price makes a lower low but RSI makes a higher low. The selling pushed price lower, but with less force than the previous wave. A bearish divergence is a higher high in price with a lower high in RSI. Divergence is a warning that momentum is fading. It is not an entry signal by itself, because divergences can repeat two or three times before price actually turns.

Nifty 50 daily candles February to May 2026 with RSI below; price makes a lower low on 30 March while RSI makes a higher low
Figure 4.6 — A textbook bullish divergence on Nifty 50, March 2026. Source: NSE data via Yahoo Finance.
Real example · Nifty 50 · Mar–Apr 2026

Bullish RSI divergence at the March 2026 low

  1. First low: 13 Mar 2026, close 23,151.1, RSI 23.7 (deeply oversold; RSI had first dropped below 30 on 4 Mar).
  2. Second, lower low: 30 Mar 2026, close 22,331.4 (820 points lower), but RSI only 31.9, a higher low.
  3. Confirmation: at the second low RSI was already back above 30 (31.9), unlike the 23.7 reading two weeks earlier. On 1 Apr Nifty closed higher at 22,679.4 (RSI 37.0); the 2 Apr intraday dip to 22,182.6 closed well off the low (22,713.1) and turned out to be the final bottom. On 8 Apr Nifty gapped up and closed 3.8% higher, which was the price confirmation.
  4. Outcome: from the 30 Mar close to the 21 Apr close (24,576.6) Nifty rose +10.1%.
  5. Caution: on 23 Mar (close 22,512.7, RSI 26.9) a trader could already have seen a "divergence" against 13 Mar. Price still fell another 0.8% to 30 Mar. Divergence tells you the falls are getting weaker. Price structure (a higher low, a break of a down-trendline) tells you when.
RSI failure modes

7. MACD: trend and momentum in one

7.1 Construction

Gerald Appel's Moving Average Convergence Divergence measures the gap between a fast and a slow EMA. When the 12-day EMA pulls away above the 26-day EMA, upward momentum is building (the averages diverge). When they come back together, momentum is fading (they converge).

Formula\[ MACD_t = EMA_{12}(C)_t - EMA_{26}(C)_t \] \[ Signal_t = EMA_9(MACD)_t, \qquad Histogram_t = MACD_t - Signal_t \]
\(EMA_{12}(C)_t\)
The 12-day EMA of closing prices on day \(t\) (Section 3.3): the "fast" average.
\(EMA_{26}(C)_t\)
The 26-day EMA of closes: the "slow" average.
\(MACD_t\)
The MACD line: fast EMA minus slow EMA, in ₹ (points for Nifty). Positive when the fast average is above the slow one.
\(Signal_t\)
The signal line: a 9-day EMA of the MACD line itself, i.e. a smoothed, slower copy of MACD.
\(Histogram_t\)
MACD minus signal, drawn as bars around zero.
  1. Each day, compute the 12-day and 26-day EMAs of the close and subtract the slow one from the fast one. That is the MACD line.
  2. Treat the MACD values as a new series and take its 9-day EMA. That is the signal line.
  3. Subtract the signal line from MACD to get the histogram. It is positive when MACD is above its signal line (momentum improving) and negative when below. The usual setting is written (12, 26, 9). The ADANIENT table below shows real values.

MACD is in price units (rupees for a stock, points for Nifty), so a value of 100 on a ₹3,000 stock is not comparable with 100 on a ₹300 stock. Compare MACD only with its own history, or divide by price.

7.2 Signals

Real example · ADANIENT · Mar–Apr 2026

MACD table around a major turn

DateCloseEMA 12EMA 26MACDSignalHistogram
30 Mar 20261,758.81,896.691,981.02−84.33−66.55−17.77
1 Apr1,842.51,888.361,970.76−82.40−69.72−12.68
2 Apr1,834.21,880.021,960.64−80.62−71.90−8.72
6 Apr1,902.21,883.441,956.31−72.88−72.10−0.78
7 Apr1,882.11,883.231,950.82−67.59−71.19+3.61
8 Apr2,043.81,907.931,957.70−49.77−66.91+17.14
13 Apr2,129.01,979.831,984.50−4.67−42.98+38.30
15 Apr2,144.42,005.151,996.35+8.80−32.62+41.42
  1. Histogram shrinking: from −17.77 on 30 Mar to −0.78 on 6 Apr. Downward momentum was fading while price was still near its low.
  2. Signal-line crossover (7 Apr): \(MACD = 1{,}883.23 - 1{,}950.82 = -67.59\), which is now above the signal line (−71.19), so the histogram turns positive at +3.61. Bullish cross at a close of 1,882.1.
  3. Zero-line crossover (15 Apr): the 12-EMA (2,005.15) moved above the 26-EMA (1,996.35) at 2,144.4, about 14% above the signal-line entry.
  4. Exit: the next bearish signal-line cross came on 8 Jun 2026 at 2,970.0. From 1,882.1 that is +57.8%.
ADANIENT January to September 2026 price with MACD, signal line and histogram; annotations for bullish cross 7 April, zero-line cross 15 April, bearish cross 8 June and noisy August-September crossings
Figure 4.7 — MACD (12,26,9) on ADANIENT, Jan–Sep 2026. Source: NSE data via Yahoo Finance.
Real data · ADANIENT · 2026 · the full picture

All long-only MACD signal-line trades in 2026

EntryEntry priceExitExit priceResult
3 Feb2,202.62 Mar2,124.6−3.5%
7 Apr1,882.18 Jun2,970.0+57.8%
3 Jul3,212.17 Jul3,107.2−3.3%
25 Aug3,110.01 Sep2,863.9−7.9%
9 Sep3,104.716 Sep2,920.0−5.9%
18 Sep3,020.024 Sep2,900.0−4.0%

One big winner and five losers. Once the trend stalled (July–September), MACD crossed back and forth near zero every few days. This is the classic trend-follower profile, and it is why Varsity warns that MACD "works in trending markets but performs poorly in sideways markets". A practical improvement is to accept signal-line crosses only in the direction of the zero line (longs only when MACD > 0) or only when ADX > 20–25.

Real example · Nifty 50 · Mar 2026

MACD histogram divergence

Nifty closes on 13 Mar, 23 Mar and 30 Mar 2026 were 23,151 → 22,513 → 22,331 (lower lows). The MACD histogram on those dates was −193.0 → −129.1 → −65.0 (higher lows). The bars were shrinking even as price fell. The same signal as the RSI divergence in Section 6.5 appeared, from a different formula. That is unsurprising, since both measure momentum (Section 18).

8. Bollinger Bands: volatility envelopes

8.1 Construction

John Bollinger's bands place an envelope around a 20-day SMA at ±2 standard deviations of the last 20 closes. Standard deviation (SD) measures how spread out the closes are. When the stock is calm the bands squeeze together, and when it is volatile they widen.

Formula\[ Mid_t = SMA_{20}(C)_t, \quad \sigma_t = \sqrt{\tfrac{1}{20}\textstyle\sum_{i=0}^{19}(C_{t-i}-Mid_t)^2} \] \[ Upper = Mid + 2\sigma, \quad Lower = Mid - 2\sigma \] \[ \%B = \frac{C - Lower}{Upper - Lower}, \qquad Bandwidth = \frac{Upper - Lower}{Mid} \]
\(C\)
Today's close, in ₹. \(C_{t-i}\) is the close \(i\) sessions ago.
\(Mid_t\)
The middle band: the 20-day SMA of closes on day \(t\).
\(\sigma_t\)
"Sigma", the standard deviation of the last 20 closes, in ₹: how far closes typically sit from their average. \(\textstyle\sum_{i=0}^{19}\) adds up the 20 terms from \(i = 0\) (today) to \(i = 19\) (19 sessions ago).
\(Upper,\ Lower\)
The upper and lower bands, 2 standard deviations above and below the middle line.
\(\%B\)
Where today's close sits between the bands, as a fraction.
\(Bandwidth\)
The gap between the bands as a fraction of the middle line, usually shown as a %.
  1. Average the last 20 closes. That is \(Mid\).
  2. For each of those 20 closes, subtract \(Mid\) and square the result (squaring makes every gap positive). Average the 20 squares and take the square root. That is \(\sigma\). Dividing by 20 gives the "population" standard deviation, which the framework uses.
  3. Upper band = \(Mid + 2\sigma\), lower band = \(Mid - 2\sigma\).
  4. \(\%B\) = distance of the close above the lower band ÷ full band width. Bandwidth = band width ÷ \(Mid\). The next paragraph explains how to read both, and the HAL example below computes all of them.

%B tells you where price sits inside the bands: 0 = on the lower band, 0.5 = on the middle line, 1 = on the upper band, above 1 = outside the upper band. Bandwidth measures how wide the bands are relative to price, and a multi-month low in bandwidth is a "squeeze".

The logic: if closes were normally distributed, about 95% would fall within ±2 SD. Price is not normally distributed (it trends and has fat tails), so the bands are best read as "what is unusual relative to the last month", not as a probability statement.

Real example · HAL · 21 Jul 2026

Computing the bands, %B and bandwidth

  1. Last 20 closes (24 Jun – 21 Jul 2026): 4,500.2, 4,368.9, 4,368.7, 4,342.8, 4,381.2, 4,434.4, 4,434.0, 4,428.9, 4,440.6, 4,400.3, 4,364.7, 4,378.9, 4,506.8, 4,511.3, 4,442.4, 4,420.5, 4,433.8, 4,500.7, 4,491.0, 4,581.7.
  2. Mean: \(Mid = 4{,}436.59\). Population SD: \(\sigma = 60.80\).
  3. \(Upper = 4{,}436.59 + 2 \times 60.80 = 4{,}558.2\); \(Lower = 4{,}436.59 - 121.6 = 4{,}314.98\).
  4. \(\%B = (4{,}581.7 - 4{,}314.98)/(4{,}558.2 - 4{,}314.98) = 266.7/243.2 = 1.097\). The close was above the upper band.
  5. \(Bandwidth = 243.2 / 4{,}436.59 = 5.48\%\). Five days earlier (16 Jul) it was 4.55%, the lowest in 126 sessions (about 6 months). Compare 9.75% on 1 Jul.

8.2 Varsity's way: mean reversion in ranges

Varsity teaches Bollinger Bands as a mean-reversion tool. Price at the upper band is "expensive" relative to its average, so short it with a target at the middle line. Price at the lower band is "cheap", so buy it with a target at the middle line. Varsity also warns that this fails when the bands expand during a strong trend ("envelope expansion"). Bollinger's own guidance adds two more patterns, the squeeze and the band walk.

"Short it" in Indian markets means futures, not shares

In the NSE cash segment you can sell shares you do not own only intraday. A short sale must be bought back the same day, or the undelivered shares go to the exchange auction at a penalty price. So any "short" in this chapter (Bollinger upper-band fades, ADX/MACD sell signals) held for days needs stock futures or options (Chapters 9–10). As a beginner swing trader in cash, use the long side of these rules, and read sell signals as "exit or do not buy".

BEL May to September 2026 daily candles in a sideways range with Bollinger Bands and Stochastic 14,3,3 below; buy and sell markers at stochastic crossovers
Figure 4.8 — A genuine range: BEL between an intraday low of 382.1 (16 Sep) and an intraday high of 435.0 (23 Jun), mid-May to Sep 2026, average ADX 19.3. Bands and Stochastic (Section 9) mark the edges of the range. Markers are Stochastic crossovers in the extreme zones. Source: NSE data via Yahoo Finance.

8.3 The squeeze, and the head-fake

Volatility tends to alternate: quiet periods are followed by active ones. A squeeze (bandwidth at a multi-month low) says a big move is getting more likely. It does not say in which direction. Traders wait for a close outside a band and then follow it. Bollinger himself warned about the head-fake: a first break one way that reverses into the real move the other way.

Two Bollinger squeeze examples: HAL July 2026 squeeze followed by successful upside breakout; ASIANPAINT January 2026 squeeze followed by upside break that reversed into a large decline
Figure 4.9 — Same setup, opposite outcomes. Left: HAL, 6-month low bandwidth (4.55%) on 16 Jul 2026, close above the upper band on 21 Jul at 4,581.7, closing high of 5,099.0 on 18 Aug (+11.3%). Right: ASIANPAINT, squeeze in early January 2026 (bandwidth about 3.4% on 6–8 Jan, with a brief poke above the band on 6 Jan), decisive close above the upper band on 12 Jan at 2,896.4 (%B 1.25). Within three weeks it was at 2,402.0 (2 Feb), −17.1%. Source: NSE data via Yahoo Finance.
Real data · 35 stocks · Jan 2025 – Aug 2026 · honest result

How often does a squeeze breakout follow through?

We scanned 35 stocks (TRENT and TMPV excluded because of corporate-action data artefacts) for every 126-day bandwidth low, then took the first close outside a band within 10 sessions and measured the move over the next 20 sessions in the breakout direction.

86
squeeze breakouts
53%
moved in breakout direction after 20 days (46 of 86)
−0.15%
average directional 20-day move

A squeeze on its own was roughly a coin flip in this sample (39 upside breaks, 20 followed through; 47 downside breaks, 26 followed through). The squeeze is a "pay attention" flag. The edge has to come from elsewhere: the bigger trend, volume on the breakout (HAL's real move came with 7.8× average volume on 6 Aug, see Section 13), and a tight stop if the break fails.

8.4 The band walk

In a strong trend price can "walk" along the upper band, closing near or above it day after day. Shorting the upper-band touch in that situation is exactly Varsity's "envelope expansion" failure.

ADANIENT March to June 2026 with Bollinger Bands; price rides the upper band from April to June, %B shown in lower panel mostly above 0.8
Figure 4.10 — Band walk on ADANIENT, Apr–Jun 2026. Source: NSE data via Yahoo Finance.
Real example · ADANIENT · Apr–Jun 2026 · mean reversion fails

"Touches the upper band, so sell" in a trend

  1. On 13 Apr 2026 ADANIENT closed at 2,129.0 with %B = 1.001, exactly on the upper band. A mean-reversion trader would short it, targeting the middle band.
  2. From 8 Apr to 5 Jun, %B was at or above 0.8 on 36 of 40 sessions, with 6 closes above the upper band.
  3. Price went from 2,043.8 (8 Apr) to 3,048.2 (5 Jun). The short from 2,129 would have lost about 43%.
  4. What should have warned you: the bands were widening (bandwidth rising), price was above a rising 20-SMA, and the MACD and Supertrend had both turned up (Sections 7 and 12). Fade the bands only when ADX is low and the bands are flat.

9. Stochastic oscillator (brief)

George Lane's Stochastic asks: where is today's close within the high–low range of the last 14 days? In an uptrend, closes tend to be near the top of the recent range, and in a downtrend near the bottom.

Formula\[ \text{raw }\%K = 100 \times \frac{C_t - LL_{14}}{HH_{14} - LL_{14}} \] \[ \%K_{slow} = SMA_3(\text{raw }\%K), \quad \%D = SMA_3(\%K_{slow}) \]
\(C_t\)
Today's close, in ₹.
\(LL_{14}\)
The lowest low of the last 14 sessions, today included.
\(HH_{14}\)
The highest high of the last 14 sessions, today included.
\(\text{raw }\%K\)
Where today's close sits inside that 14-day range: 0 = at the lowest low, 100 = at the highest high.
\(SMA_3(\dots)\)
A plain 3-day average of whatever is in the brackets.
\(\%K_{slow}\)
The 3-day average of raw %K. This is the "%K" line on most charts.
\(\%D\)
The 3-day average of slow %K: a slower signal line.
  1. Find the 14-day range: highest high minus lowest low.
  2. Take how far today's close is above the lowest low, divide by the range and multiply by 100. That is raw %K.
  3. Average the last three raw %K values to get slow %K. Average the last three slow %K values to get %D. These two averaging steps are the "3, 3" in the (14, 3, 3) setting.
  4. Plot slow %K and %D together, both on a 0–100 scale. The next paragraph gives the overbought and oversold levels and the crossover signals.

Above 80 is overbought and below 20 is oversold. A buy signal is %K crossing above %D while below 20, and a sell signal is %K crossing below %D while above 80.

Real example · BEL · Sep 2026

Stochastic step by step

DateHighLowClose14-day LL14-day HHraw %K%K (slow)%D
15 Sep 2026403.65382.90382.90382.90416.000.0017.2925.66
16 Sep390.20382.10385.75382.10416.0010.7713.7418.74
17 Sep395.90387.00395.45382.10416.0039.3816.7215.92
18 Sep399.20393.30393.30382.10416.0033.0427.7319.39
  1. 17 Sep raw %K: \(100 \times (395.45 - 382.10)/(416.00 - 382.10) = 100 \times 13.35/33.90 = 39.38\).
  2. Slow %K: average of the last three raw values \((0.00 + 10.77 + 39.38)/3 = 16.72\).
  3. %D: average of the last three slow %K values \((17.29 + 13.74 + 16.72)/3 = 15.92\).
  4. %K (16.72) crossed above %D (15.92) below 20, which is a buy signal at 395.45. By 30 Sep, nine sessions later and the end of our data, BEL was 1.8% lower. In this range, the 6 buy signals (May–Sep 2026) were higher 10 sessions later only twice (the last one measured to 30 Sep). The 3 sell signals were each followed by small declines (−3.0%, −0.2%, −0.2%).

Use it for: timing entries inside a known range or a pullback within a trend. Do not use it with RSI and %B together. Section 18 shows the three are 0.83–0.89 correlated, so they mostly repeat each other.

10. ATR: measuring volatility for stops and position size

10.1 True range

Wilder's Average True Range measures how much a stock typically moves in a day, including gaps. The plain high-minus-low range ignores overnight gaps, which is a serious omission in India, where results, global news and overnight moves in GIFT Nifty (formerly SGX Nifty) cause frequent gap opens. True range uses the largest of three distances:

Formula\[ TR_t = \max\big(H_t - L_t,\ |H_t - C_{t-1}|,\ |L_t - C_{t-1}|\big) \] \[ ATR_t = \frac{13\,ATR_{t-1} + TR_t}{14} \]
\(H_t,\ L_t\)
Today's high and low, in ₹.
\(C_{t-1}\)
The previous session's close.
\(|x|\)
The absolute value: the size of \(x\) ignoring its sign, so \(|-285.2| = 285.2\).
\(TR_t\)
Today's true range, in ₹: the largest (\(\max\)) of the three distances in the brackets.
\(ATR_t\)
The 14-day average true range on day \(t\), in ₹. \(ATR_{t-1}\) is yesterday's value.
  1. Work out three distances: high minus low, high to the previous close, and low to the previous close (the last two ignoring sign). The true range is the biggest. On a normal day it is just high minus low. After a gap, one of the other two is larger.
  2. Seed: the first ATR is the plain average of the first 14 true ranges.
  3. Every later day: ATR = (13 × yesterday's ATR + today's TR) ÷ 14. This is the same Wilder smoothing as in RSI.
  4. Read ATR as "a typical day's move in rupees". Divide it by price to compare stocks (Section 10.3).
Real example · Nifty 50 · Apr 2026

Why true range matters: the 8 April gap-up

DateHighLowPrev closeH − L|H − prev C||L − prev C|TRATR 14
6 Apr 202622,998.322,542.922,713.1455.4285.2170.2455.4467.5
7 Apr23,153.822,719.322,968.2434.5185.6248.9434.5465.1
8 Apr24,025.223,828.523,123.7196.7901.5704.8901.5496.3
9 Apr23,990.823,682.823,997.3307.96.6314.5314.5483.3
10 Apr24,074.123,856.323,775.1217.7299.081.2299.0470.2
  1. On 8 Apr Nifty gapped up. The day's own range was only 196.7 points, but the move from the previous close to the high was 901.5. The true range is 901.5, not 196.7.
  2. \(ATR_{8\,Apr} = (465.1 \times 13 + 901.5)/14 = (6{,}046.3 + 901.5)/14 = 496.3\).
  3. ATR as a % of price: \(496.3/23{,}997.3 = 2.07\%\), the highest of the past year (Figure 4.1).

10.2 Using ATR for stops

A stop placed inside a stock's normal daily noise gets hit by randomness, not by being wrong. ATR tells you how wide that noise is. Varsity's rule: place the stop at least one ATR from entry (long: entry − ATR; short: entry + ATR). Swing traders commonly use 1.5–3 × ATR, and a chandelier stop trails the stop at "highest close since entry − 3 × ATR". (Chuck LeBeau's original uses the highest high and a 22-day ATR. Using closes, as we do here, is a common variant that is slightly less likely to be stopped by one intraday spike.)

Real example · HAL · Jul–Sep 2026

ATR stop and position size on the squeeze breakout

  1. Entry: close of 21 Jul 2026 = ₹4,581.70. ATR(14) that day = ₹95.92.
  2. Initial stop (2 × ATR): \(4{,}581.70 - 2 \times 95.92 = \text{₹}4{,}389.87\). Risk per share = ₹191.83.
  3. Position size for a ₹5,00,000 account risking 1% (₹5,000) per trade: \[ Qty = \left\lfloor \frac{5{,}000}{191.83} \right\rfloor = 26 \text{ shares} \] Position value \(26 \times 4{,}581.70 = \text{₹}1{,}19{,}124\), or 23.8% of capital. Actual risk \(26 \times 191.83 = \text{₹}4{,}988\).
  4. Trailing (chandelier): stop = highest close since entry − 3 × ATR, never lowered. The highest close was 5,099.0 (18 Aug). The stop ratcheted up to ₹4,805.48 and was broken on 2 Sep at 4,780.0.
  5. Result: traders measure outcomes in R, multiples of the initial risk per share (here ₹191.83). \((4{,}780.0 - 4{,}581.7)/191.83 = +1.03R\), about ₹5,156 on 26 shares before costs. The trailing stop gave back part of the peak gain, which is the price of staying in for a bigger trend.
HAL June to September 2026 candles with entry marker on 21 July, initial 2xATR stop line, chandelier trailing stop and exit on 2 September; ATR panel below
Figure 4.11 — HAL, 2026: entry on the squeeze breakout, initial 2×ATR stop, 3×ATR chandelier trailing stop, exit on 2 Sep. Source: NSE data via Yahoo Finance.
Real example · HAL futures · lot size from NSE bhavcopy, 30 Sep 2026

ATR tells you if one futures lot fits your risk budget

  1. HAL's futures lot size in the NSE F&O bhavcopy of 30 Sep 2026 is 150 shares. (Lot sizes are revised periodically. Check the current NSE contract specification before you trade.)
  2. Using the same 2 × ATR stop (₹191.83 per share), the risk per lot is \(150 \times 191.83 = \text{₹}28{,}775\).
  3. For a ₹5,00,000 account that is 5.75% risk on a single trade, nearly six times the 1% rule. To keep one lot within 1%, you would need about \(28{,}775 / 0.01 = \text{₹}28.8\) lakh of capital.
  4. The contract's notional value (the full market value of the shares the lot represents) is \(150 \times 4{,}581.70 = \text{₹}6.87\) lakh, larger than the whole account. That is leverage, and it is why Chapter 9 treats futures sizing separately.

Lesson: with futures you cannot buy "26 shares". You trade whole lots. If ATR × multiple × lot size exceeds your risk budget, the correct position size is zero.

10.3 ATR as a comparison tool

Raw ATR depends on the price level, so convert it to a percentage of price to compare stocks. On 30 Sep 2026, HAL's ATR was ₹110.36 (2.36% of its ₹4,668 price) and HDFCBANK's was ₹13.96 (1.97% of ₹708.70). A fixed "5% stop" is therefore about 2.1 ATRs for HAL but 2.5 ATRs for HDFCBANK. ATR-based stops adjust automatically for each stock's personality.

11. ADX and the DMI: is there a trend at all?

11.1 The idea

Wilder's Directional Movement system has three lines. +DI measures upward pressure (how much today's high exceeds yesterday's). −DI measures downward pressure (how much today's low undercuts yesterday's). ADX is a smoothed measure of how far apart +DI and −DI are. ADX tells you the strength of a trend, not its direction. A falling market with strong selling has a high ADX too.

Formula\[ up = H_t - H_{t-1},\quad down = L_{t-1} - L_t \] \[ {+DM} = \begin{cases} up & \text{if } up > down \text{ and } up > 0 \\ 0 & \text{otherwise}\end{cases} \] \[ {-DM} = \begin{cases} down & \text{if } down > up \text{ and } down > 0 \\ 0 & \text{otherwise}\end{cases} \] \[ {+DI} = 100\,\frac{\text{Wilder}_{14}(+DM)}{ATR_{14}},\quad {-DI} = 100\,\frac{\text{Wilder}_{14}(-DM)}{ATR_{14}} \] \[ DX = 100\,\frac{|{+DI} - {-DI}|}{{+DI} + {-DI}},\quad ADX = \text{Wilder}_{14}(DX) \]
\(H_t,\ L_t\)
Today's high and low, in ₹. \(H_{t-1},\ L_{t-1}\) are the previous session's.
\(up\)
How far today's high is above yesterday's high (negative if it is below).
\(down\)
How far today's low is below yesterday's low (negative if it is above).
\({+DM},\ {-DM}\)
Plus and minus directional movement for the day, in ₹. Only the bigger of \(up\) and \(down\) counts, and only if it is positive. The other is 0. On an inside day (lower high, higher low) both are 0.
\(\text{Wilder}_{14}(\dots)\)
Wilder's 14-day smoothing, as in RSI and ATR: start with a plain 14-day average, then new = (13 × old + today) ÷ 14.
\(ATR_{14}\)
The 14-day average true range (Section 10).
\({+DI},\ {-DI}\)
Plus and minus directional indicators: smoothed +DM and −DM as a percentage of ATR.
\(DX\)
Directional index: the gap between +DI and −DI as a percentage of their sum. Near 0 = the two sides are balanced, near 100 = one side dominates.
\(ADX\)
Average directional index: DX smoothed over 14 days, on a 0–100 scale.
  1. Each day, compare today's bar with yesterday's to get \(up\) and \(down\). The larger one, if positive, becomes +DM or −DM. The other is 0.
  2. Smooth +DM, −DM and the true range with Wilder's 14-day method. Then +DI = 100 × smoothed +DM ÷ ATR, and the same for −DI.
  3. DX = 100 × the gap between +DI and −DI (ignoring sign) ÷ their sum. Smooth DX the same way to get ADX.
  4. Reading: ADX above 25 means a strong trend, below 20 means little or no trend. ADX does not give direction. Which DI is on top tells you that (table below).
ADX (Varsity's bands)MeaningWhich tools to favour
Below 20Weak or no trendRange tools: Bollinger fades, Stochastic, support/resistance
20–25Grey zoneWait or trade small
Above 25Strong trend (direction from +DI vs −DI)Trend tools: MAs, Supertrend, breakouts, pullback entries

Varsity's trade rule: buy when ADX is above 25 and +DI is above −DI. Sell or short when ADX is above 25 and −DI is above +DI. Stop at the low (or high) of the signal candle.

Real example · MARUTI · Aug 2025

Computing ADX on the day it crossed 25

DateHighLowClose+DM−DMTRATR+DI−DIDXADX
18 Aug 202514,12513,66414,0681,16901,189285.5945.7711.3260.3412.52
19 Aug14,27013,97914,2501450291285.9746.0610.5062.8816.12
20 Aug14,36214,20014,221920162277.1246.5110.0664.4419.57
21 Aug14,40114,15614,280044245274.8243.5510.5660.9622.53
22 Aug14,37014,23014,34900140265.1941.9010.1660.9625.27
  1. 18 Aug: high rose by 1,169 versus the prior day, and the low did not fall, so +DM = 1,169 and −DM = 0. This was a big gap-up day (a TR of 1,189), when autos rallied on GST-cut expectations.
  2. 22 Aug: \(DX = 100 \times |41.90 - 10.16|/(41.90 + 10.16) = 100 \times 31.74/52.06 = 60.96\).
  3. \(ADX = (22.53 \times 13 + 60.96)/14 = 25.27\). It crossed 25 with +DI above −DI, which is Varsity's buy condition, at a close of 14,349.
  4. Note the lag: +DI had already moved above −DI on 12 Aug at 12,840, when ADX was only 7.4. ADX confirms a trend that is already under way.
MARUTI June 2025 to September 2026 price with ADX, +DI and -DI; ADX above 25 during Aug-Oct 2025 rally and the early-2026 fall, below 25 April-August 2026, and rising again in September 2026
Figure 4.12 — ADX/DMI on MARUTI, Jun 2025 – Sep 2026: a trend up, a trend down, a range, and a new trend down. Source: NSE data via Yahoo Finance.
Real example · MARUTI · 2025–2026

Reading the four regimes

  1. Uptrend: buy signal 22 Aug 2025 at 14,349. ADX peaked near 67 in late September. The closing high was 16,703 on 24 Dec 2025 (+16.4% from the signal).
  2. Downtrend: on 9 Jan 2026 −DI (22.8) crossed above +DI (22.7) with ADX 26.6 at 16,501, a sell signal. MARUTI fell to 12,306 by 30 Mar 2026 (−25.4%).
  3. Range: from 20 Apr to 2 Sep 2026, ADX averaged 15.5 and never exceeded 25.0, while the DI lines crossed 13 times. Every DI crossover in that period was noise. ADX correctly said "no trend, step aside".
  4. New downtrend: ADX rose above 25 again on 3 Sep 2026 (25.2) with −DI at 34.7 vs +DI at 10.4, close 12,857. By 30 Sep: close 11,967, ADX 51.4.

12. Supertrend

Supertrend (by Olivier Seban) is an ATR-based trailing line. In an uptrend it sits below price as a green line and only moves up. When price closes below it, the line flips above price, turns red, and from then on only moves down. It is a trend-following system and a trailing stop in one.

Formula\[ \text{BasicUpper}_t = \frac{H_t + L_t}{2} + m \cdot ATR_n \] \[ \text{BasicLower}_t = \frac{H_t + L_t}{2} - m \cdot ATR_n \] \[ \text{FinalLower}_t = \begin{cases}\text{BasicLower}_t & \text{if BasicLower}_t > \text{FinalLower}_{t-1} \text{ or } C_{t-1} < \text{FinalLower}_{t-1}\\ \text{FinalLower}_{t-1} & \text{otherwise}\end{cases} \]
\(H_t,\ L_t\)
Today's high and low, in ₹. \(\frac{H_t + L_t}{2}\) is the midpoint of today's bar.
\(ATR_n\)
The \(n\)-day average true range on day \(t\) (Section 10), in ₹.
\(n\)
The ATR period in sessions: 10 in our examples, 7 on Kite's default.
\(m\)
The multiplier: how many ATRs the bands sit from the midpoint (3 in our examples).
\(\text{BasicUpper}_t,\ \text{BasicLower}_t\)
Today's raw bands: the midpoint plus or minus \(m\) ATRs.
\(\text{FinalLower}_t\)
The ratcheted lower band, the line used in long mode. \(\text{FinalLower}_{t-1}\) is yesterday's value.
\(\text{FinalUpper}_t\)
The ratcheted upper band, the line used in short mode.
\(C_{t-1}\)
The previous session's close.
  1. Each day, compute the basic bands: midpoint of the bar ± \(m\) × ATR.
  2. Ratchet the lower band: take today's basic lower band only if it is higher than yesterday's final lower band. Otherwise keep yesterday's value, so the line can only rise. The exception: if yesterday's close was already below the old line, the band resets to today's basic value.
  3. FinalUpper mirrors this: it can only fall, unless the previous close was above it.
  4. In long mode, Supertrend = FinalLower (the green line under price). A close below it flips to short mode, where Supertrend = FinalUpper (the red line above price). A close above FinalUpper flips it back to long.

Settings: Kite's default, which Varsity uses, is period 7, multiplier 3, and Varsity suggests keeping the multiplier between 3 and 4. TradingView's built-in default is period 10, multiplier 3. A larger multiplier means fewer flips and later exits. The examples here use (10, 3), so your Kite chart with (7, 3) will flip on slightly different days.

Real example · ADANIENT · Apr 2026

The flip from short to long

DateClose(H+L)/2ATR 10Basic upperBasic lowerFinal upperFinal lowerSupertrendMode
6 Apr 20261,902.21,855.578.52,090.91,620.22,010.31,664.62,010.3Short
7 Apr1,882.11,884.874.62,108.51,661.12,010.31,664.62,010.3Short
8 Apr2,043.82,037.088.82,303.51,770.62,010.31,770.61,770.6Long
9 Apr2,040.52,037.785.42,293.81,781.52,293.81,781.51,781.5Long
10 Apr2,086.82,068.282.32,314.91,821.42,293.81,821.41,821.4Long
  1. While short, the final upper band stayed fixed at 2,010.3, because each new basic upper (2,090.9, 2,108.5) was higher and the band is only allowed to fall.
  2. On 8 Apr the close (2,043.8) was above 2,010.3, so the mode flipped to long.
  3. The new line is the final lower band: \(2{,}037.0 - 3 \times 88.8 = 1{,}770.6\). It then rose every day as price rose, acting as a trailing stop.
Supertrend 10,3 in 2026 on ADANIENT with few flips during a long trend and on ICICIBANK with many whipsaws
Figure 4.13 — Supertrend (10,3) in 2026. Top: ADANIENT, one long trend. Bottom: ICICIBANK, a choppy year. Source: NSE data via Yahoo Finance.
Real data · 2026 · trend vs chop

The same indicator, two very different years

StockLong-only Supertrend trades in 2026 (entry → exit, close to close)Sum
ADANIENT3 Feb 2,202.6 → 6 Mar 2,039.9 (−7.4%); 8 Apr 2,043.8 → 13 Aug 2,964.9 (+45.1%); 27 Aug 3,169.0 → 31 Aug 2,859.1 (−9.8%)+27.9%
ICICIBANK6 Jan 1,411.2 → 21 Jan 1,349.0 (−4.4%); 12 Feb 1,430.0 → 6 Mar 1,313.4 (−8.2%); 8 Apr 1,309.2 → 30 Apr 1,263.4 (−3.5%); 11 Jun 1,317.0 → 10 Sep 1,384.5 (+5.1%)−11.0%

Supertrend gives fewer false signals than a simple price-vs-MA rule, as Varsity notes, but it cannot remove whipsaws in a stock that keeps reversing. Combine it with an ADX or 200-day filter, or use it purely as a trailing stop for trades you entered for other reasons.

13. Volume indicators: volume average, OBV, VWAP

13.1 Volume vs its 10-day average (Varsity's method)

Volume is the number of shares traded. A trade where one person buys 100 shares from another adds 100 to volume, not 200. Raw volume means little on its own, so Varsity compares today's volume with the average of the previous 10 sessions. Volume above that average suggests large participants ("smart money") are involved.

PriceVolume vs 10-day avgVarsity's reading
UpUpBullish: real buying, likely institutions
UpDownCaution: weak buying, possible bull trap
DownUpBearish: real selling
DownDownCaution: weak selling, possible bear trap
Real example · HAL · Jul–Aug 2026

The breakout that lacked volume, and the day that had it

  1. 21 Jul 2026 (the Bollinger squeeze breakout, +2.02%): volume 697,566 vs 10-day average 642,844, a ratio of 1.09×. Only marginally above average, so this is a "price up, volume barely up" day and not a convincing breakout by Varsity's test.
  2. 6 Aug 2026 (+5.92%, close 4,920): volume 4,796,689 vs 10-day average 615,363, a ratio of 7.79×. This was the session that confirmed real demand, and HAL made its closing high of 5,099 on 18 Aug.

13.2 On-Balance Volume (OBV)

Joseph Granville's OBV keeps a running total. Add the day's volume on up-closes, subtract it on down-closes, and ignore flat days.

Formula\[ OBV_t = OBV_{t-1} + \operatorname{sign}(C_t - C_{t-1}) \times V_t \]
\(OBV_t\)
On-balance volume on day \(t\): a running total, counted in shares. \(OBV_{t-1}\) is yesterday's total.
\(C_t - C_{t-1}\)
Today's change in close: today's close minus the previous session's.
\(\operatorname{sign}(\dots)\)
+1 if the number inside is positive, −1 if it is negative, 0 if it is exactly zero.
\(V_t\)
Today's volume: the number of shares traded.

How it works: start the total anywhere (0 is fine). On an up-close add the day's volume, on a down-close subtract it, and on an unchanged close leave the total as it is. The HAL table below does this for six days.

The absolute level of OBV is meaningless. Only its direction matters. Rising OBV with rising price confirms the trend. Price making new highs while OBV does not is a volume divergence and a warning.

Real example · HAL · Jul 2026

OBV step by step (rebased to 0 on 14 Jul)

DateCloseVolumeDirectionOBV
14 Jul 20264,442.4770,894–0
15 Jul4,420.5440,343down → subtract−440,343
16 Jul4,433.8474,213up → add33,870
17 Jul4,500.7658,032up → add691,902
20 Jul4,491.0344,703down → subtract347,199
21 Jul4,581.7697,566up → add1,044,765

Over the bigger picture, from 1 Apr to 30 Sep 2026 HAL's price rose 27.2% and OBV rose by 16.36 million shares. Volume confirmed the trend. Note also the May 2026 drop, where OBV fell sharply on heavy red-volume days (Figure 4.14), which is a "price down, volume up" warning in Varsity's table.

13.3 VWAP: intraday, rolling and anchored

Volume-Weighted Average Price is the average price paid per share, weighted by how many shares traded at each price. It answers the question "where is the average participant's cost?"

Formula\[ TP_t = \frac{H_t + L_t + C_t}{3}, \qquad VWAP = \frac{\sum TP_t \times V_t}{\sum V_t} \]
\(H_t,\ L_t,\ C_t\)
The high, low and close of bar \(t\), in ₹. A bar is one day on a daily chart, or one minute for intraday VWAP.
\(TP_t\)
The typical price of the bar: the average of its high, low and close. It stands in for "the price traded at" during that bar.
\(V_t\)
The volume (shares traded) in bar \(t\).
\(\sum\)
"Add up" over every bar in the window: since 9:15 am today for intraday VWAP, the last 20 days for a 20-day rolling VWAP, or every day since the chosen start date for anchored VWAP.
\(VWAP\)
The volume-weighted average price, in ₹.
  1. For each bar, compute the typical price and multiply it by the bar's volume. That is roughly the rupee value traded in the bar.
  2. Add those products up over the window, and separately add up the volumes.
  3. Divide the first total by the second. Heavy-volume bars pull VWAP towards their price more than quiet bars do. Price above VWAP means the average buyer in that window is in profit.
Real example · HAL · Mar–Sep 2026

Anchored VWAP from the 30 March 2026 low

DateHighLowCloseVolumeTPCum TP×V (₹ cr)Cum VAVWAP
30 Mar 20263,615.63,479.13,487.22,197,2523,527.30775.02,197,2523,527.30
1 Apr3,688.63,545.03,670.82,246,7683,634.801,591.74,444,0203,581.65
2 Apr3,700.13,551.03,687.01,611,0093,646.032,179.16,055,0293,598.78
  1. 30 Mar: \(TP = (3{,}615.6 + 3{,}479.1 + 3{,}487.2)/3 = 3{,}527.30\). On the first day, AVWAP equals TP.
  2. 1 Apr: TP × V for the day is \(3{,}634.80 \times 2{,}246{,}768 = \text{₹}816.7\) crore, so the running total is \(775.0 + 816.7 = \text{₹}1{,}591.7\) crore (₹1,591.7 × 107). Divide by the running volume: \(AVWAP = 1{,}591.7 \times 10^7 / 4{,}444{,}020 = 3{,}581.65\).
  3. Since the anchor, HAL closed below its AVWAP on only 12 days, the last one on 16 Jun 2026, when the May–June pullback held near the line (about 4,290–4,300).
  4. On 30 Sep 2026: close 4,668.0, AVWAP 4,503.9 (buyers since the March low are still in profit on average), but the 20-day rolling VWAP was 4,842.5 (buyers in the last month are on average underwater). Long-term structure was intact, and short-term momentum was weak.
HAL March to September 2026 with anchored VWAP from 30 March low and rolling 20-day VWAP, volume bars with 10-day average, and OBV
Figure 4.14 — Volume tools on HAL, 2026: anchored VWAP from the 30 Mar low, rolling 20-day VWAP, volume vs its 10-day average (6 Aug: 7.8×), and OBV. Source: NSE data via Yahoo Finance.

14. Donchian channels

Richard Donchian's channel is the simplest trend tool of all: the highest high and lowest low of the last n days. A close above the prior 20-day high is a breakout, and the famous "Turtle" traders of the 1980s used 20- and 55-day versions. It connects directly to Chapter 3's support and resistance. The channel is the most recent range.

Formula\[ Upper_t = \max(H_{t-n}, \dots, H_{t-1}), \qquad Lower_t = \min(L_{t-n}, \dots, L_{t-1}) \] \[ Mid = \tfrac{Upper + Lower}{2} \]
\(H,\ L\)
Daily highs and lows, in ₹. \(H_{t-1}\) is yesterday's high and \(H_{t-n}\) the high \(n\) sessions ago.
\(n\)
The channel length in sessions: 20 for the entry channel, 10 for the exit line in the rule below.
\(\max,\ \min\)
The largest and the smallest value in the list.
\(Upper_t,\ Lower_t\)
The highest high and lowest low of the previous \(n\) sessions. Today is not included.
\(Mid\)
The midpoint of the channel.

How it works: look back over the last \(n\) sessions, not counting today, and note the highest high and the lowest low. A close above \(Upper_t\) is an upside breakout. A close below \(Lower_t\) is a downside break.

Example (TITAN, 16 Jun 2026, \(n = 20\)): the 20 sessions from 18 May to 15 Jun had a highest high of 4,297.0 (15 Jun) and a lowest low of 3,962.8 (11 Jun). So \(Upper = 4{,}297.0\), \(Lower = 3{,}962.8\) and \(Mid = 4{,}129.9\). TITAN closed at 4,338.0 on 16 Jun, above 4,297.0. That is the last breakout entry in the table below.

(We use the previous n days, so today's close can break the channel.) A classic swing rule is: buy on a close above the 20-day high, and exit on a close below the 10-day low.

TITAN October 2025 to September 2026 with 20-day Donchian channel and 10-day low exit line, with entry and exit markers
Figure 4.15 — Donchian breakouts on TITAN, Oct 2025 – Sep 2026 (the last four of the seven trades in the table below). Source: NSE data via Yahoo Finance.
Real data · TITAN · Apr 2025 – Sep 2026 · honest result

20-day breakout / 10-day low exit on a steady uptrend

EntryPriceExitPriceResult
11 Apr 20253,234.912 Jun 20253,452.7+6.7%
25 Jun 20253,652.28 Jul 20253,441.3−5.8%
18 Aug 20253,554.812 Sep 20253,571.9+0.5%
16 Oct 20253,640.33 Dec 20253,817.8+4.9%
26 Dec 20253,992.022 Jan 20264,018.6+0.7%
8 Apr 20264,492.511 May 20264,205.6−6.4%
16 Jun 20264,338.015 Sep 20264,856.0+11.9%

7 trades, 5 winners, sum +12.5% (average win +4.9%, average loss −6.1%). Buying and holding TITAN returned +53.6% from 1 Apr 2025 to 30 Sep 2026 (+41.8% even if you started on the first entry day, 11 Apr 2025). TITAN rose steadily with frequent sharp dips, so a tight 10-day exit kept shaking the system out. Two lessons follow. The channel lengths must fit the stock's rhythm (a 20/55 or ATR-based exit would have held longer). And trend-following systems earn their keep across many stocks, not on one chart (Chapter 12).

15. Relative strength vs Nifty (RS line and Mansfield RS)

For stock selection, this may be the most useful tool in the chapter. The question is not "is this stock going up?" but "is it going up more than the market?" Leadership tends to persist for months (the momentum effect, documented in many markets, including India). Stocks that outperform in a weak market are often the first to run when the market turns.

Formula\[ RS_t = \frac{C^{stock}_t}{C^{Nifty}_t}, \qquad \text{Mansfield RS}_t = \left(\frac{RS_t}{SMA_{52\,weeks}(RS)_t} - 1\right) \times 100 \]
\(C^{stock}_t\)
The stock's close in week \(t\), in ₹ (we use the last close of each week).
\(C^{Nifty}_t\)
Nifty 50's close on the same date, in index points.
\(RS_t\)
The RS line: stock price divided by Nifty. Its level means nothing on its own. Only its direction matters: rising = the stock is beating Nifty.
\(SMA_{52\,weeks}(RS)_t\)
The average of the last 52 weekly RS values: the stock's one-year "normal" relationship with Nifty.
\(\text{Mansfield RS}_t\)
How far this week's RS is above (+) or below (−) that one-year average, in %.
  1. Divide the stock's weekly close by Nifty's weekly close. That is the RS line.
  2. Average the last 52 weekly RS values.
  3. Divide this week's RS by that average, subtract 1 and multiply by 100. Above zero means the stock is doing better against Nifty than it usually does. The paragraph below explains the zero-line cross.

The RS line rises when the stock outperforms Nifty, even if both are falling. Mansfield RS (named after the Mansfield chart service and popularised by Stan Weinstein, using weekly data) compares the RS line with its own 52-week average. Above zero means the stock is outperforming its normal relationship with the index. Crossing from negative to positive is a classic early leadership signal.

Real example · TITAN · week ending 30 Sep 2026

Mansfield RS by hand

  1. \(RS = 4{,}587.0 / 22{,}620.45 = 0.20278\).
  2. Average of the weekly RS over the last 52 weeks: 0.1753.
  3. \(\text{Mansfield} = (0.20278/0.1753 - 1) \times 100 = +15.7\). TITAN was 15.7% stronger relative to Nifty than its one-year norm.
RS lines of TITAN and INFY vs Nifty since April 2025, their Mansfield RS, and a bar chart ranking 35 stocks by Mansfield RS on 30 September 2026
Figure 4.16 — Top left: RS lines rebased to 100. TITAN outperformed Nifty by about 57% since Apr 2025, while INFY underperformed by about 33%. Top right: Mansfield RS. Bottom: the 35-stock ranking on 30 Sep 2026. Source: NSE data via Yahoo Finance.
Leaders (30 Sep 2026)Mansfield RS6-month returnLaggardsMansfield RS6-month return
ADANIENT+23.8+65.1%WIPRO−17.5−15.5%
ETERNAL+23.1+39.8%INFY−17.0−20.5%
TITAN+15.7+16.1%TCS−14.3−13.1%
HAL+13.8+33.9%IRCTC−13.6−7.9%
DIXON+12.5+35.4%ITC−11.0−8.7%

Over the same six months (31 Mar – 30 Sep 2026), Nifty returned +1.3%. Notice how the IT sector (WIPRO, INFY, TCS, HCLTECH) clusters at the bottom. RS ranking reveals sector rotation without reading a single news article. Also notice that ETERNAL, HAL and DIXON were rising in RS (from +2.4, +2.6 and −4.8 thirteen weeks earlier), while ADANIENT's was falling from +37.5. Both the level and the direction matter.

RS caveats

RS is backward-looking, and leaders can reverse sharply (DIXON was −19.7% over the year to 30 Sep 2026 despite its recent strength). Use RS to build a shortlist, then apply your trend, entry and risk rules. Corporate actions (splits, bonuses, demergers) can corrupt the RS line if the data is not adjusted, which is why TRENT and TMPV are excluded here.

16. Other indicators in Varsity's list

Varsity's "Other indicators" chapter covers a few more tools. You should recognise them, but none adds a new kind of information beyond the families above.

IndicatorConstruction (default)How it is readFamily
Alligator (Bill Williams)Three offset SMAs: jaw 13, teeth 8, lips 5Lines fanned out in order (price > 5 > 8 > 13) = trend; tangled lines = no tradeTrend (MA stack)
Aroon (Tushar Chande)Days since the 25-day high / low, scaled 0–100Aroon-Up > 50 and Aroon-Down < 30 = uptrend (and vice versa); oscillator = Up − DownTrend (time-based)
ATR bandsMA ± ATRA close outside the band suggests continuation in that directionVolatility envelope
Central Pivot RangeFrom the previous day's H, L, C: Pivot = (H+L+C)/3, BC = (H+L)/2, TC = 2 × Pivot − BCIntraday support/resistance; Varsity has a separate chapterIntraday levels

17. Context test: the same RSI signal across 37 stocks

Books often state that "RSI below 30 is a buy in an uptrend but a trap in a downtrend". Instead of taking that on faith, we tested it on the 37 stocks in our data, 2017–2026.

Bar charts comparing average 20-day return and 10-day hit rate after RSI below 30 and above 70 signals in uptrends and downtrends versus baseline
Figure 4.17 — The same RSI reading in different contexts, 37 NSE stocks, Jul 2017 – Sep 2026. Source: NSE data via Yahoo Finance; course computation.
CaseSignalsAvg 10-day% up at 10 daysAvg 20-dayMedian 20-dayWorst 10% (20-day)
All stock-days (baseline)78,882+0.81%54.4%+1.62%+1.14%−8.2%
RSI < 30, any trend877+0.56%56.1%+0.89%+0.93%−10.9%
RSI < 30 in uptrend153−0.30%59.5%−0.10%+0.83%−11.1%
RSI < 30 in downtrend382+1.41%57.1%+1.63%+0.94%−9.7%
RSI > 70, any trend1,682+1.13%56.1%+2.14%+1.36%−7.4%
RSI > 70 in uptrend1,272+1.05%55.5%+2.08%+1.23%−7.7%
RSI > 70 in downtrend87+0.45%47.1%+1.67%+0.63%−8.0%
Average 20-day return by periodRSI<30 uptrendRSI<30 downtrendRSI>70 uptrendRSI>70 downtrendBaseline
2017–2019+2.48% (n=43)+1.64% (99)+0.40% (299)−1.40% (15)+1.31%
2020–2022−1.10% (39)+0.28% (106)+3.21% (472)+3.19% (37)+2.26%
2023–2026−1.12% (71)+2.43% (177)+2.02% (501)+1.39% (35)+1.29%
What the test teaches (and what it does not)

18. Combining indicators without redundancy

18.1 Most oscillators measure the same thing

Beginners often pile RSI, Stochastic, CCI, Williams %R and MACD onto one chart and feel reassured when they "all agree". They agree because they are built from the same closes over similar windows. Here is the correlation of daily readings across all 37 stocks since 2018:

Correlation heatmap of RSI, Stochastic, %B, MACD histogram, distance from 50-SMA, ADX and ATR percent across 37 stocks
Figure 4.18 — Correlation of indicator readings, 37 stocks, 2018–2026. RSI, Stochastic %K and %B correlate 0.83–0.89 with each other. ADX and ATR% are almost uncorrelated with all of them. Source: course computation.

18.2 One trend + one momentum + one volatility tool

JobQuestion it answersPick ONE
Trend / regimeShould I be looking for longs, shorts, or nothing?200-SMA (with 50-SMA), or ADX/DMI, or Supertrend
Momentum / timingIs this a good moment to enter (pullback ending, breakout starting)?RSI, or MACD, or Stochastic
Volatility / riskWhere is my stop, and how big can my position be?ATR (Bollinger bandwidth if you trade squeezes)
Optional: participationIs real money behind the move?Volume vs 10-day average, or OBV
Optional: selectionWhich stocks to look at in the first place?Relative strength vs Nifty

Varsity puts indicators last in its decision hierarchy: (1) a recognisable candlestick pattern, (2) support/resistance for entry and stop, (3) volume above average, and only then (4) indicator confirmation. If the indicators agree, take the full position. If they don't, trade smaller or skip, but do not reject an otherwise valid setup just because of an indicator, and do not take a trade on an indicator alone.

KOTAKBANK March to September 2026 with EMA20, SMA50, SMA200, RSI with 40-80 band, and ATR
Figure 4.19 — A minimal dashboard: trend (20-EMA, 50-SMA, 200-SMA), momentum (RSI with the 40–80 uptrend band) and volatility (ATR) on KOTAKBANK, Mar–Sep 2026. Source: NSE data via Yahoo Finance.
Worked reading · KOTAKBANK · 30 Sep 2026 · educational, not a recommendation

Reading a chart with three non-overlapping tools

  1. Trend: close ₹417.0 above the 200-SMA (400.1). The 50-SMA (404.0) crossed above the 200-SMA on 22 Sep 2026, a fresh golden cross. ADX 28.3 with +DI 23.3 > −DI 18.6, so a trend is present and up. Mansfield RS +11.9 (outperforming Nifty, which was 7.2% below its 200-SMA).
  2. Momentum: during the September pullback RSI dipped to 40.99 on 28 Sep, right at the floor of the uptrend 40–80 band, and recovered to 56.5 by 30 Sep. That is the "uptrend oversold" reading from Section 6.4.
  3. Volatility/risk: ATR ₹8.18 (1.96% of price). A 2×ATR stop sits at \(417.0 - 16.36 = \text{₹}400.64\), right next to the 200-SMA. Two independent reasons support the same level, which is the kind of confluence you look for.
  4. Sizing (₹5,00,000 account, 1% risk): \(\lfloor 5{,}000/16.36 \rfloor = 305\) shares, about ₹1,27,185 (25.4% of capital), risk ₹4,991.
  5. What could go wrong: the broad market was in a downtrend (Nifty death cross since March), golden crosses are slow and often fail (Section 4), and Section 17 showed that no single reading is an edge. A disciplined trader would also check the candlestick trigger, support/resistance and volume (Chapters 2–3), and what's coming up (results, events) before acting.
Timeframes: use the weekly chart for positional decisions

Every indicator here works on any timeframe. For positional trades and investments, compute them on weekly bars (a 10-week SMA ≈ 50-day, a 40-week SMA ≈ 200-day, weekly RSI 14), and use the daily chart only to time the entry. A clean multi-timeframe rule is to trade in the direction of the weekly trend and enter on a daily pullback.

In your framework

The course framework (framework/, built in Chapter 17) implements every indicator in this chapter in framework.indicators: sma, ema, rsi (Wilder), macd, bollinger, stochastic, atr (Wilder), adx, obv, vwap_rolling, supertrend, donchian, relative_strength(df, bench_df), mansfield_rs(df, bench_df) (this chapter's weekly version, 52-week average) and pivots (swing highs/lows). ATR-based sizing lives in framework.risk.position_size(capital, risk_pct, entry, stop, lot_size=1) framework.risk.atr_stop and framework.risk.chandelier_stop. The swing scanner python -m framework.scan combines a 200/50-SMA trend filter, an RSI pullback trigger (RSI dipped below 45) and an ATR-based stop, the same three-job structure as this section. The EMA and Wilder averages are seeded with a simple average exactly as in this chapter, so the framework reproduces its numbers.

19. Try it yourself

These snippets need a copy of the course repository and Python with pandas and numpy (setup steps are in its framework/README.md). Run them from the repository's root folder, for example with .venv/bin/python, because the file paths are relative to that folder. Each snippet is self-contained and reproduces numbers from this chapter.

19.1 SMA, EMA and Wilder RSI on SBIN

import pandas as pd

def load(sym):
    df = pd.read_csv(f"data/ohlc/{sym}.csv", index_col=0, parse_dates=True)
    return df[~((df.Volume == 0) & (df.High == df.Low))]   # drop holiday placeholder bars

def wilder(s, n):
    # seed with the simple mean of the first n values, then (prev*(n-1) + x) / n
    s = s.dropna(); out = pd.Series(index=s.index, dtype=float)
    out.iloc[n-1] = s.iloc[:n].mean()
    for i in range(n, len(s)):
        out.iloc[i] = (out.iloc[i-1]*(n-1) + s.iloc[i]) / n
    return out

df = load("SBIN")
c = df.Close
sma20 = c.rolling(20).mean()
ema20 = c.ewm(span=20, adjust=False).mean()     # alpha = 2/(20+1)
d = c.diff()
avg_gain = wilder(d.clip(lower=0), 14)
avg_loss = wilder((-d).clip(lower=0), 14)
rsi14 = 100 - 100 / (1 + avg_gain / avg_loss)
print(pd.DataFrame({"close": c, "sma20": sma20, "ema20": ema20, "rsi14": rsi14}).tail(3).round(2))
# 2026-09-30: close 959.5, sma20 992.47, ema20 992.55, rsi14 33.72

19.2 MACD, Bollinger %B, ATR and position size on HAL

import pandas as pd
df = pd.read_csv("data/ohlc/HAL.csv", index_col=0, parse_dates=True)
df = df[~((df.Volume == 0) & (df.High == df.Low))]
c = df.Close
macd = c.ewm(span=12, adjust=False).mean() - c.ewm(span=26, adjust=False).mean()
signal = macd.ewm(span=9, adjust=False).mean()
mid = c.rolling(20).mean(); sd = c.rolling(20).std(ddof=0)
upper, lower = mid + 2*sd, mid - 2*sd
pct_b = (c - lower) / (upper - lower)
prev = c.shift(1)
tr = pd.concat([df.High - df.Low, (df.High - prev).abs(), (df.Low - prev).abs()], axis=1).max(axis=1)
atr14 = tr.ewm(alpha=1/14, adjust=False).mean()          # Wilder smoothing
day = "2026-07-21"
print(round(pct_b[day], 3), round(atr14[day], 2))        # 1.097 95.92
entry, stop = c[day], c[day] - 2*atr14[day]
print("qty for 1% of Rs 5 lakh:", int(5000 // (entry - stop)))   # 26

19.3 Rank stocks by Mansfield relative strength

import pandas as pd, glob, os
nifty = pd.read_csv("data/ohlc/IDX_NSEI.csv", index_col=0, parse_dates=True).Close
rows = []
for f in glob.glob("data/ohlc/*.csv"):
    sym = os.path.basename(f)[:-4]
    if sym.startswith("IDX_") or sym in ("TRENT", "TMPV"):   # skip indices and adjustment artefacts
        continue
    c = pd.read_csv(f, index_col=0, parse_dates=True).Close
    rs = (c / nifty.reindex(c.index).ffill()).resample("W-FRI").last().dropna()
    mansfield = (rs / rs.rolling(52).mean() - 1) * 100
    rows.append((sym, round(mansfield.iloc[-1], 1)))
print(sorted(rows, key=lambda r: -r[1])[:5])
# [('ADANIENT', 23.8), ('ETERNAL', 23.1), ('TITAN', 15.7), ('HAL', 13.8), ('DIXON', 12.5)]

Exercises with code: (a) change the RSI lookback to 7 and to 21 and count how many days SBIN spent above 70 in 2025–26; (b) rerun the Section 17 test with a 2-day RSI below 10 (the full script is course/scripts/ch04_figures.py, function context_test); (c) compute the Supertrend on your own favourite stock with multipliers 2, 3 and 4 and count the flips.

20. Practical checklist

21. Key takeaways

Key takeaways

22. Quiz and exercises

Q1. A stock's 20-day EMA yesterday was ₹500. Today it closes at ₹521. What is today's 20-day EMA?
\(\alpha = 2/(20+1) = 0.0952\). \(EMA = 500 + 0.0952 \times (521 - 500) = 500 + 2.00 = \text{₹}502.00\). The EMA moves only about a tenth of the way towards the new close, which is why a 20-day EMA still lags.
Q2. Yesterday's Wilder averages were: average gain 3.00, average loss 1.50 (14-period). Today the stock falls by 6.00. What were yesterday's and today's RSI?
Yesterday: \(RS = 3.00/1.50 = 2.0\), \(RSI = 100 - 100/3 = 66.67\).
Today: gain = 0, loss = 6.00. \(\overline G = (3.00 \times 13 + 0)/14 = 2.786\); \(\overline L = (1.50 \times 13 + 6.00)/14 = 1.821\); \(RS = 1.530\); \(RSI = 100 - 100/2.530 = 60.47\). One sharp down day cost about 6 RSI points.
Q3. Yesterday a stock closed at ₹500. Today it gapped up and traded between ₹520 and ₹530. What is today's true range, and why not just use high − low?
\(TR = \max(530 - 520,\ |530 - 500|,\ |520 - 500|) = \max(10, 30, 20) = \text{₹}30\). High − low (₹10) ignores the ₹20 gap, which is real risk to anyone holding overnight. The Nifty on 8 Apr 2026 is a real example: day range 196.7 points, true range 901.5.
Q4. You have ₹3,00,000 and risk 1% per trade. Entry is ₹1,200, ATR(14) is ₹30, and you use a 2×ATR stop. How many shares can you buy, and what percentage of capital is the position?
Risk budget = ₹3,000. Stop = 1,200 − 60 = ₹1,140, so the risk per share is ₹60. Qty = ⌊3,000 / 60⌋ = 50 shares. Position = 50 × 1,200 = ₹60,000 = 20% of capital. Note that the position size follows from the stop distance, not the other way round.
Q5. A stock's 20-day SMA is ₹1,000 and the 20-day SD is ₹25. It closes at ₹1,040. Compute the Bollinger Bands, %B and bandwidth.
Upper = 1,000 + 50 = ₹1,050; lower = ₹950. \(\%B = (1{,}040 - 950)/(1{,}050 - 950) = 90/100 = 0.90\). Bandwidth = 100/1,000 = 10%. Price is in the upper part of the envelope but still inside it.
Q6. The 12-day EMA is 520, the 26-day EMA is 510 and the signal line is 12. Read the MACD.
MACD = 520 − 510 = +10, which is above zero, so the medium-term trend is up. Histogram = 10 − 12 = −2, so MACD is below its signal line. Upward momentum is fading, and if this is the first day below, it is a bearish signal-line crossover. In a strong trend, many traders would treat this as a pullback warning rather than an exit, especially with MACD still above zero.
Q7. Nifty's golden cross on 11 Nov 2019 was followed by a −30.6% move before the next death cross. What does this teach about crossovers?
Crossovers are slow regime labels built from 50 and 200 days of history. They cannot react to a sudden shock (COVID, Feb–Mar 2020), and the exit signal arrived after most of the damage, on 19 Mar 2020, almost at the bottom. A crossover system needs an independent stop (e.g., ATR-based) and its own position sizing. It cannot serve as its own risk control.
Q8. A stock has ADX 15, with +DI 22 above −DI 18. A friend says "+DI is above −DI, so it's an uptrend, buy." What do you say?
ADX 15 means there is no meaningful trend (below 20). The DI lines cross back and forth in such ranges. MARUTI's DIs crossed 13 times between April and September 2026 while ADX averaged 15.5. Varsity's rule requires ADX > 25 and +DI > −DI. With ADX at 15, trend-following entries are low quality. Range tactics (buy near support/lower band, sell near resistance) or simply waiting are more appropriate.
Q9. Your chart shows RSI(14), Stochastic(14,3,3) and Bollinger %B all "oversold". Why is this weaker confirmation than it looks, and what would you replace two of them with?
Across our 37 stocks they correlate 0.83–0.89, so they are essentially one momentum measurement shown three times. Keep one (say RSI) and replace the others with tools that answer different questions: a trend/regime filter (200-SMA or ADX) and a volatility tool (ATR for the stop). Optionally add volume vs its 10-day average to check participation.
Q10. A stock's price/Nifty ratio today is 0.25, and its 52-week average of that ratio is 0.20. What is its Mansfield RS, and what does it mean if the stock fell 5% this month?
Mansfield = (0.25/0.20 − 1) × 100 = +25. The stock is outperforming its one-year relationship with Nifty by 25%. If it fell 5% while Mansfield stayed high, Nifty probably fell more. Relative strength measures leadership, not absolute gains. Such stocks often lead when the market recovers, though leadership can also reverse.
Q11. You have ₹10,00,000, risk 1% per trade, and want to trade one HAL futures lot (150 shares) with a 2×ATR stop of ₹191.83 per share. Is it allowed under your rule? What are your options?
Risk per lot = 150 × 191.83 = ₹28,775 = 2.88% of ₹10 lakh, almost three times your 1% budget (₹10,000). Under the rule, you cannot take even one lot. Options: (a) skip the trade; (b) trade the cash stock instead (⌊10,000/191.83⌋ = 52 shares); (c) wait for a setup with a genuinely tighter, structure-based stop (do not simply shrink the stop to make the maths work, because a stop inside normal noise just gets hit); (d) build capital first. Chapter 9 covers this in detail.
Q12. ADANIENT touched its upper Bollinger Band on 13 Apr 2026 (%B ≈ 1.00). Varsity's mean-reversion rule says short with a target at the middle band. Why did this fail, and what would have warned you?
The stock was starting a strong trend, and price walked the upper band (%B ≥ 0.8 on 36 of 40 sessions) from 2,043.8 to 3,048.2 by 5 Jun. Warnings: the bands were expanding (Varsity's "envelope expansion" failure case), price was above a rising 20-SMA, MACD had made a bullish crossover on 7 Apr and crossed zero on 15 Apr, and Supertrend had flipped long on 8 Apr. Mean reversion on bands belongs in low-ADX ranges like BEL in mid-2026, not in trends.
Q13. Starting from OBV = 0, a stock closes 100 → 102 (volume 50,000) → 101 (30,000) → 104 (80,000). What is OBV after each day? The 10-day average volume is 40,000. How does Varsity's volume table read the last day?
Day 1 (up): OBV = +50,000. Day 2 (down): 50,000 − 30,000 = +20,000. Day 3 (up): 20,000 + 80,000 = +1,00,000. The last day is price up on 2.0× average volume (80,000 / 40,000), which Varsity reads as bullish: real buying with participation. Compare HAL's 21 Jul 2026 breakout at only 1.09× (Section 13.1).
Q14. You are long and Supertrend (10,3) is in long mode with yesterday's line (final lower band) at ₹1,820. Today's basic lower band works out to ₹1,805 and the stock closes at ₹1,850. What is today's Supertrend line, and why?
₹1,820. In long mode the final lower band can only rise: today's basic lower (1,805) is below yesterday's 1,820, so the line stays at 1,820 (the exception, a reset, applies only if the previous close was below the line). The close of 1,850 is above 1,820, so the mode stays long. This one-way ratchet is what makes Supertrend work as a trailing stop (Section 12, ADANIENT table).
Q15 (exercise). Using the try-it code, compute RSI(14) for INFY and count how many sessions from Oct 2025 to Sep 2026 it spent below 30 and above 70. Does the result fit the "downtrend: 20–60" idea?
Expected outcome: INFY fell about 31% over that year, and its RSI spent about 11% of sessions below 30 and well under 1% above 70, with a minimum of about 17.6 on 24 Feb 2026. That fits the downtrend range: rallies stalled around 55–65 and oversold readings were frequent. Your exact counts may differ slightly depending on how you handle the first bars. The pattern is the point.

23. Sources

Primary (concepts, explained here in our own words): Zerodha Varsity, Module 2, Ch 12: Volumes · Ch 13: Moving Averages · Ch 14: Indicators (Part 1) — momentum, RSI, leading vs lagging · Ch 15: Indicators (Part 2) — MACD, Bollinger Bands, avoiding indicator overload · Ch 20: Other indicators — ADX, Alligator, Aroon, ATR, ATR bands, Supertrend, VWAP · Ch 22: The Central Pivot Range · Module 2 index.
Original indicator definitions: J. Welles Wilder, New Concepts in Technical Trading Systems (1978) for RSI, ATR, ADX/DMI and Wilder smoothing; Gerald Appel (MACD); John Bollinger, Bollinger on Bollinger Bands (2001) for %B, bandwidth, squeeze and band walk; George Lane (Stochastic); Joseph Granville (OBV); Richard Donchian (channels); Stan Weinstein, Secrets for Profiting in Bull and Bear Markets (1988) for Mansfield relative strength. Supertrend defaults: Kite (7,3) as stated in Varsity Ch 20; TradingView built-in (10,3).
Data: NSE daily OHLCV via Yahoo Finance (course dataset, snapshot to 30 Sep 2026; zero-volume holiday placeholder bars removed); NSE F&O UDiFF bhavcopy 30 Sep 2026 for the HAL futures lot size (150). All figures and numbers are reproducible with course/scripts/ch04_figures.py (indicator code in course/scripts/ch04_indicators.py).

← PreviousSupport, Resistance, Trends & Chart PatternsNext →Swing Trading Playbook