Ledger & Candle
Chapter 05 · Technical Analysis

Swing Trading Playbook

Reading time ~55 min · Data as of 30 Sep 2026 · Based on Zerodha Varsity Module 2 (Technical Analysis, ch. 19 "The Finale"), Module 9 (Risk Management & Trading Psychology) and Module 10 (Trading Systems)

1. What you'll learn and why it matters

Chapters 2 to 4 gave you the parts: candlesticks, support and resistance, trends, chart patterns, moving averages, RSI, ATR and volume. This chapter puts the parts together into a playbook: a written process you can follow every evening, in about 30 to 60 minutes, without watching the screen during market hours.

By the end you will be able to:

Why this matters for each kind of learner

Swing trader: this is your core manual. Positional trader: Setup 4 (weekly trend + daily trigger) and the trailing rules let you hold for months. Long-term investor: the regime and relative-strength gates are a useful timing layer on top of the fundamental work in Chapters 6 to 8. Future futures trader: the same process applies to stock futures in Chapter 9, but leverage makes the sizing and gap-risk sections far more important.

Read the results honestly

Every number below comes from historical NSE data, computed with Python. The examples are historical analysis, not recommendations. The backtests include losers, and in 2025-26 three of the four setups lost money on our stock list. Trading involves real risk of loss. Treat this chapter as a way to build judgement, not as a promise of returns.

2. What swing trading is (and isn't)

Swing trading means holding a position for a few days to a few weeks to capture one "swing": one leg of a trend, or a bounce from a level. Varsity's Module 2 finale also calls this positional trading and recommends it to beginners over day trading, because you decide with end-of-day (EOD) data, calmly, after the close.

StyleTypical holdChart usedScreen timeMain risk
Intraday / scalpingMinutes to hours1-15 minAll dayCosts, noise, emotions
Swing2 days to ~6 weeksDaily (with weekly for context)30-60 min each eveningOvernight gaps, events
Positional / trend1-6 monthsWeekly + daily~1 hour a week + checksGiving back open profit
InvestingYearsFundamentals; monthly/weekly chartsQuarterly reviewsBusiness and valuation risk

The practical frame (from Varsity, adapted)

What it costs, and how it is taxed (briefly)

Swing trades are delivery trades (product type CNC on Zerodha): you buy, the shares reach your demat account and you sell days later. As of Zerodha's published charges (checked October 2026), equity delivery has zero brokerage, but statutory charges still apply: STT (Securities Transaction Tax) 0.1% on both buy and sell, NSE transaction charges 0.00307%, SEBI fee Rs 10 per crore, GST 18% on (transaction + SEBI charges), stamp duty 0.015% on the buy side, and a DP charge of Rs 15.34 per stock per day on which you sell. On a Rs 1.1-1.25 lakh position, the worked examples in this chapter come to 0.23-0.26% of the buy value for the round trip: STT alone is 0.2%, and two partial sells mean two DP charges. The backtests use a flat 0.24%. Section 9 works out one example line by line.

Gains on listed shares held 12 months or less are short-term capital gains, taxed at 20% plus cess for FY 2026-27 (unchanged since 23 July 2024). Very frequent trading can also raise the question of whether your income is business income. Chapter 13 covers costs and tax in detail. In this chapter, costs are included in every R-multiple (the profit or loss of a trade measured in units of its initial risk, defined in Section 7). Taxes are not.

3. The top-down process in one picture

A professional swing trader doesn't start with a hot stock. They start with the market and narrow down. Every trade must pass eight gates, in order:

Funnel diagram with eight gates: market regime, sector strength, stock selection, setup, entry trigger, initial stop, position size, manage and exit
Figure 1. The eight gates of the playbook. The upper gates decide whether and where to trade, and the lower gates decide how. Most evenings, most stocks fail an early gate, and that's fine.

The logic: most stocks move with the market most of the time. Varsity's Dow Theory chapters make the same point with the primary trend: fighting it lowers your odds. So the first question is "is the tide coming in?" Then "which boats are rising fastest?" (sectors and relative strength). Only then "is there a low-risk place to step on board?" (the setup, trigger and stop). Finally, "how big, and how do I get off?" (size and management).

Varsity's two-part scan

Varsity's finale chapter describes a two-part daily routine. Part 1, shortlisting: flip through every chart in your universe and look only at the last 3-4 candles for a recognisable pattern. Part 2, evaluation: spend 15-20 minutes on each of the 4-5 shortlisted charts and check them against a strict checklist. Usually only 1-2 qualify, and on some days none do. Deciding not to trade is a trading decision too. Our playbook adds the regime and sector gates in front of that routine.

4. Gate 1: market regime

The regime answers one question: how much risk should I take on new long trades today? We use three measures, all computed from end-of-day data.

4.1 Nifty 50 versus its 200-day moving average

Plain language: the 200-day simple moving average (200-DMA) is the average closing price of the last ~10 months. If the index is above it, and the average itself is rising, the long-term trend is up.

The logic: the 200-DMA is a slow, widely watched line. When price is above it, the average investor who bought in the last 10 months is in profit, so dips tend to get bought. Below it, rallies tend to get sold by people who want to get out at breakeven. It does not predict tomorrow. It describes the "weather".

Formula \[ \text{SMA}_{200,t} = \frac{1}{200}\sum_{k=0}^{199} C_{t-k} \qquad \text{Distance} = \left(\frac{C_t}{\text{SMA}_{200,t}} - 1\right)\times 100\% \]
\(C_t\)
Nifty 50's close on day \(t\) (today), in index points. \(C_{t-k}\) is the close \(k\) sessions ago.
\(\textstyle\sum_{k=0}^{199}\)
"Add up" the terms for \(k = 0\) (today) to \(k = 199\): the last 200 closes.
\(\text{SMA}_{200,t}\)
The 200-day simple moving average (200-DMA) on day \(t\): the plain average of those 200 closes.
\(\text{Distance}\)
How far today's close is above (+) or below (−) the 200-DMA, in %.

How it works: add the last 200 closes and divide by 200. Then divide today's close by that average, subtract 1 and multiply by 100. A positive distance means Nifty is above its long-term average. For the slope, compare today's 200-DMA with its value 20 sessions earlier: higher means rising.

Real example · Nifty 50 · 30 Sep 2026

Where is the market versus its 200-DMA?

  1. Nifty close on 30 Sep 2026: \(C_t = 22{,}620.45\).
  2. Average of the last 200 closes: \(\text{SMA}_{200} = 24{,}372.85\).
  3. Distance = \((22{,}620.45 / 24{,}372.85 - 1) \times 100 = -7.19\%\).
  4. Slope: the 200-DMA is 1.09% lower than it was 20 sessions earlier, so it is falling.
  5. Verdict: price below a falling 200-DMA. Nifty last crossed below it on 27 Feb 2026 and has stayed below since, through the March 2026 sell-off (VIX peaked at 27.89 on 30 Mar 2026). Risk-off.

4.2 Breadth: how many stocks are participating?

An index can be held up by a handful of giants while most stocks fall. Breadth counts how many stocks in your universe are above their own moving averages.

Formula \[ \text{Breadth}_{200} = \frac{\#\{\text{stocks with } C > \text{SMA}_{200}\}}{\#\{\text{stocks with 200 days of data}\}}\times 100\% \]
\(\#\{\dots\}\)
"The number of" things described inside the braces.
\(C\)
Each stock's latest close, in Rs.
\(\text{SMA}_{200}\)
That stock's own 200-day simple moving average.
\(\text{Breadth}_{200}\)
The share of stocks in your universe that close above their own 200-DMA, in %.

How it works: for each stock in your universe, check whether today's close is above its 200-day average. Count the yeses, divide by the number of stocks with at least 200 days of history, and multiply by 100. Above 50% means most stocks are in long-term uptrends. The same calculation with the 50-day average gives breadth50.

On 30 Sep 2026 only 7 of 37 stocks (18.9%) were above their 200-DMA, and only 3 of 37 (8.1%) were above their 50-DMA. That is a very weak tape. When fewer than 1 in 5 stocks are in a long-term uptrend, buying setups have little tailwind.

4.3 India VIX: the market's fear gauge

India VIX is computed by NSE from Nifty option prices. It estimates the annualised volatility the market expects over the next 30 days. Roughly, a VIX of 13 implies typical daily Nifty moves of about \(13/\sqrt{252} \approx 0.8\%\). On 30 Sep 2026 VIX was 13.49, close to its 1-year median of 12.6. So the current weakness is a slow grind, not a panic. In March 2026 VIX hit 27.89, and daily swings and overnight gaps were much larger.

How we use VIX: not as a buy or sell signal, but as a size dial. Higher VIX means wider stops and more gap risk. Because our stops are ATR-based, a volatile market automatically gives smaller share counts. On top of that, many traders halve their per-trade risk when VIX is above ~18.

Three-panel chart: Nifty 50 with 50- and 200-day averages and regime shading from July 2024 to September 2026; breadth of 37 stocks above 200- and 50-day averages; India VIX
Figure 2. The regime dashboard. Top: Nifty with its 200-DMA (green shading = above, red = below). Middle: breadth across our 37 stocks. Bottom: India VIX. Notice how breadth collapsed early in both the Jan-Mar 2025 and Mar 2026 declines. Source: NSE data via Yahoo Finance; computed in ch05_figures.py.
DateNifty200-DMA% above 200-DMA% above 50-DMAIndia VIXRegime
28 Mar 202523,51924,082195912.7Risk-off, improving
30 Jun 202525,51724,084627312.8Risk-on
30 Sep 202524,61124,162543811.1Risk-on, weakening (50-DMA breadth only 38%)
31 Dec 202526,13024,93357519.5Risk-on
30 Mar 202622,33125,232191427.9Risk-off, high fear
30 Jun 202623,86624,878435413.6Mixed
30 Sep 202622,62024,37319813.5Risk-off

4.4 Turning the three numbers into a rule

RegimeDefinition (all at the daily close)Action for new long swing trades
Risk-onNifty > 200-DMA, the 200-DMA is rising, breadth200 ≥ 50%Full risk (1% per trade), all four setups, up to 6 open positions
MixedAnything that is neither risk-on nor risk-off: for example, Nifty above a falling 200-DMA, or Nifty below its 200-DMA while breadth200 is still 40% or moreHalf risk (0.5%), prefer leaders (top RS), up to 4 positions
Risk-offNifty < 200-DMA and breadth200 < 40%No new trend setups (S1, S2), or 0.25-0.5% risk at most. Support bounces (S3) only, at half risk with quick targets. Mostly cash.
OverlayIndia VIX > 18Halve whatever risk the row above allows (gap risk is higher)

Does the regime filter actually help? Section 13 tests it on 2,192 historical trades. In short: trend-following setups (S1 pullback, S2 breakout) earned a small positive average when Nifty was above its 200-DMA and lost money when it was below. Setup 3, a mean-reversion bounce, behaved the opposite way. Nifty was above its 200-DMA on 76.1% of trading days from 2017 to 2026, so the filter keeps you trading most of the time and steps you aside in the worst stretches.

Limitation

The 200-DMA is slow. Nifty peaked at 26,216 on 26 Sep 2024 but first closed below its 200-DMA on 14 Nov 2024, already 10.2% lower. After a few brief, false recrossings (late Nov 2024, early Jan 2025), it only got back above for good on 21 Apr 2025, 9.3% above the 4 Mar 2025 low. Whipsaws like these are the other cost of a slow filter. Breadth reacts faster. That is why we use both, plus VIX. No filter avoids every loss. A filter only tilts the odds.

In your framework

framework.data.load_ohlc("IDX_NSEI") plus framework.indicators.sma(close, 200) gives the regime line. Breadth is a loop over your universe (see "Try it yourself"). python -m framework.scan will print the regime line first, before any setups.

5. Gate 2: sector strength

Plain language: money rotates. In any quarter some sectors lead (more buyers) and others lag. A good setup in a leading sector has two tailwinds. The same setup in a lagging sector is swimming upstream.

The logic: institutions allocate by sector and their buying happens over weeks, which creates persistent trends at the sector level. Varsity's Module 10 momentum chapter builds on the same observation: what has outperformed over the past months tends, on average, to keep outperforming for a while.

Formula (relative performance, in percentage points) \[ RS^{(n)}_{\text{sector}} = R^{(n)}_{\text{sector}} - R^{(n)}_{\text{Nifty}}, \qquad R^{(n)} = \left(\frac{P_t}{P_{t-n}}-1\right)\times100 \]
\(P_t\)
The index's closing value today. \(P_{t-n}\) is its close at the start of the look-back window.
\(n\)
The look-back window: 3 months (30 Jun to 30 Sep 2026 in the example) or 6 months.
\(R^{(n)}\)
The return over that window, in %.
\(R^{(n)}_{\text{sector}},\ R^{(n)}_{\text{Nifty}}\)
That return for the sector index and for Nifty 50.
\(RS^{(n)}_{\text{sector}}\)
The sector's relative strength: its return minus Nifty's, in percentage points (pp).

How it works: work out each index's return over the same window, then subtract Nifty's return from the sector's. Positive RS means the sector beat Nifty, even if both fell. The unit is "percentage points" because you are subtracting one percentage from another.

Real example · NSE sector indices · 30 Jun → 30 Sep 2026

Which sectors led over the last quarter?

  1. Nifty 50: 23,865.75 on 30 Jun 2026 → 22,620.45 on 30 Sep 2026 = −5.22%.
  2. Nifty Media: +7.09% over the same three months, so RS = 7.09 − (−5.22) = +12.31 pp (top).
  3. Nifty IT: +5.35%, so RS = +10.56 pp. But its 6-month RS is −5.97 pp and its 12-month return is −17.68%. This is a bounce inside a long downtrend, so treat it with suspicion.
  4. Nifty Pharma: +4.39%, RS +9.61 pp, and also +17.62 pp over 6 months. This is consistent leadership.
  5. Nifty FMCG: −8.78%, RS −3.57 pp (bottom), and negative over 6 and 12 months too. A consistent laggard.
Horizontal bar chart of NSE sector indices showing 3-month and 6-month returns relative to Nifty 50 as of 30 September 2026
Figure 3. Sector relative strength on 30 Sep 2026. Dark bars: 3-month RS (since 30 Jun 2026). Light bars: 6-month RS (since 30 Mar 2026). The best candidates for long setups are sectors strong on both horizons: Pharma, Metal, Realty, Healthcare, Consumer Durables, Auto and Media. Source: NSE ind_close_all daily index files.

How to use it: rank sectors by 3-month RS every weekend. Prefer longs in the top third and avoid the bottom third. Where 3-month and 6-month RS disagree (IT here), the shorter number is often a bounce and the longer one is the trend. Your universe may not map neatly to NSE sectors (our 37 stocks include just one pharma name), so also look at the stocks themselves (next gate).

Common mistakes

(1) Chasing last month's top sector after it has already run 25% (look at RS and the chart). (2) Using a 1-month window alone, which is mostly noise. (3) Forgetting that in a risk-off market, "strongest sector" may just mean "falling slowest".

6. Gate 3: stock selection (liquidity and relative strength)

6.1 Liquidity filter

You must be able to get in and, more importantly, out at a fair price. Varsity suggests a tight bid-ask spread or a minimum daily volume (about 5 lakh shares). A cleaner test is turnover, because 5 lakh shares of a Rs 150 stock and of a Rs 12,000 stock are very different amounts of money.

Formula \[ \text{Turnover}_{20} = \operatorname{median}_{k=0..19}\left(C_{t-k}\times V_{t-k}\right) \quad \text{(Rs)} \] \[ \text{rule: } \text{Turnover}_{20} \ge \text{Rs }20\text{ crore} \]
\(C_{t-k}\)
The stock's close \(k\) sessions ago, in Rs (\(k = 0\) is today).
\(V_{t-k}\)
The number of shares traded that day.
\(C \times V\)
That day's turnover in Rs: roughly the money that changed hands.
\(\operatorname{median}_{k=0..19}\)
The middle value of the 20 daily turnovers (today and the 19 sessions before). With 20 values, it is the average of the 10th and 11th once sorted.
\(\text{Turnover}_{20}\)
The typical daily turnover over the last 20 sessions, in Rs (1 crore = Rs 1,00,00,000).

How it works: multiply close by volume for each of the last 20 sessions, sort the 20 numbers and take the middle one. The median is used instead of the average so that one unusually heavy day can't make a thinly traded stock look liquid. The stock passes if the result is at least Rs 20 crore.

Example (HDFCBANK, 30 Sep 2026): close 708.70 × 3,93,65,496 shares = Rs 2,789.8 crore that day. Over the 20 sessions from 2 Sep to 30 Sep the daily figure ranged from Rs 865 crore to Rs 3,611 crore. The 10th and 11th sorted values were Rs 1,982.5 crore and Rs 2,155.7 crore, so the median is about Rs 2,069 crore, far above Rs 20 crore.

On 30 Sep 2026 all 37 stocks passed. The most liquid was HDFCBANK at about Rs 2,069 crore a day. The least liquid was IRCTC at about Rs 28 crore. For a Rs 5 lakh account, liquidity is never the constraint in these names. It starts to matter with mid- and small-caps, where a Rs 1 lakh order can move the price.

6.2 Relative strength (RS) of the stock

We want the stocks that are stronger than the market: they fall less in declines and rise more in rallies. We score each stock on its 3-month (63 sessions) and 6-month (126 sessions) return minus Nifty's over the same window, then average the two.

Formula \[ \text{RS score} = \tfrac12\left(R^{(63)}_{\text{stock}}-R^{(63)}_{\text{Nifty}}\right) + \tfrac12\left(R^{(126)}_{\text{stock}}-R^{(126)}_{\text{Nifty}}\right) \]
\(R^{(63)}_{\text{stock}}\)
The stock's return over the last 63 sessions (about 3 months), in %. Same recipe as \(R^{(n)}\) in Section 5: today's close ÷ the close 63 sessions ago, minus 1, times 100.
\(R^{(126)}_{\text{stock}}\)
The stock's return over the last 126 sessions (about 6 months), in %.
\(R^{(63)}_{\text{Nifty}},\ R^{(126)}_{\text{Nifty}}\)
Nifty 50's return over the same two windows.
\(\tfrac12\)
Each horizon gets half the weight.
\(\text{RS score}\)
The average of the 3-month and 6-month outperformance, in percentage points.

How it works: subtract Nifty's 3-month return from the stock's, do the same for 6 months, and average the two gaps. Positive means the stock has beaten Nifty. Rank your universe by this score: the highest numbers are the leaders. The ETERNAL example below plugs in real numbers.

Real example · ETERNAL · 30 Sep 2026

Computing an RS score step by step

  1. Nifty: 63-session return −6.43%, 126-session return −0.87%.
  2. ETERNAL: 63-session return +14.41%, 126-session return +37.24%.
  3. 3-month RS = 14.41 − (−6.43) = +20.84 pp. 6-month RS = 37.24 − (−0.87) = +38.11 pp.
  4. RS score = ½(20.84) + ½(38.11) = +29.48, rank 1 of 37. It also closes above both its 50- and 200-DMA, one of only 3 stocks doing so.
Scatter plot of 37 stocks: 6-month relative strength on x-axis, 3-month relative strength on y-axis; bubble size is turnover; colour shows above or below 200-day average
Figure 4. The relative-strength map on 30 Sep 2026. The top-right quadrant (strong on both horizons) is where long setups get priority: ETERNAL, DIXON, HAL, KOTAKBANK, TITAN. Most of the large IT, FMCG, energy and PSU names sit bottom-left. Green = above its 200-DMA.
RankStockClose3m RS (pp)6m RS (pp)RS scoreAbove 50 / 200-DMATurnover (Rs cr)
1ETERNAL320.00+20.84+38.11+29.48Yes / Yes638
2ADANIENT2,903.40−2.19+60.14+28.97No / Yes313
3DIXON13,100.00+12.31+31.62+21.97No / Yes444
4HAL4,668.00+11.71+30.95+21.33No / Yes357
5KOTAKBANK417.00+10.87+14.76+12.81Yes / Yes465
6TITAN4,587.00+8.80+16.08+12.44No / Yes248
……
35TMPV283.50−11.62−5.62−8.62No / No244
36WIPRO158.50−2.47−16.40−9.44No / No173
37INFY994.10+1.94−20.83−9.45No / No847

How to use it: each weekend, rank your universe and keep a focus list of the top 10-12 names. During the week, look for setups mainly in the focus list. This mirrors Varsity's momentum-portfolio idea (rank by past return, keep the top dozen) at a swing-trading scale.

Limitations

RS tells you what has been strong, not what will be. Leaders can reverse violently. Even ADANIENT's +60 pp 6-month RS sits next to a negative 3-month RS, which is a sign of fading momentum. RS is a filter to put the odds on your side, not a reason to buy on its own.

In your framework

framework.indicators.relative_strength(df, bench_df, period) returns the RS line, the ratio of stock to benchmark return over period days, and Mansfield RS. The framework.scan CLI ranks candidates by a rating built from the 3- and 6-month ratios.

7. Gates 4-7: setup, trigger, stop and position size

7.1 Setup versus trigger

A setup is a chart condition that makes a move likely enough to watch, for example "price has pulled back to the 20 EMA in an uptrend". A trigger is the price event that says "the move has started, act now", for example "price trades above yesterday's high". Separating the two stops you buying falling knives: if the bounce never comes, the trigger never fires and you never enter.

7.2 The initial stop: where am I wrong?

The stop goes where your idea is proven wrong, not where the loss "feels" acceptable. Below the pullback low, below the breakout bar, below support. We add a small buffer of a fraction of ATR(14) so that ordinary noise doesn't take you out. ATR is the average true range from Chapter 4.

Formula \[ \text{Stop} = \text{structure low} - b\times \text{ATR}_{14} \] \[ R = \text{Entry} - \text{Stop}\ \ (\text{rupees at risk per share}) \]
\(\text{structure low}\)
The chart price that proves the idea wrong if it breaks: the pullback low, the breakout-bar low or the pattern low. Each setup's rules say which one.
\(b\)
The buffer, as a fraction of ATR: 0.25 for Setups 1, 2 and 4, and 0.1 for Setup 3.
\(\text{ATR}_{14}\)
The 14-day average true range on the setup day, in Rs: the size of a typical day's move (Chapter 4).
\(\text{Entry}\)
The price you buy at, in Rs.
\(R\)
The risk per share, in Rs: what you lose on each share if the stop is hit exactly.

How it works: find the structure low, then subtract a small slice of ATR so that ordinary noise doesn't reach the stop. The gap between entry and stop is \(R\), your unit of risk.

Example (TITAN, Section 9): lowest low of the last 3 sessions 3,667.3, ATR 63.39, \(b = 0.25\). Stop = 3,667.3 − 0.25 × 63.39 = 3,667.3 − 15.85 = 3,651.45. Entry 3,762.00, so \(R = 3{,}762.00 - 3{,}651.45 = 110.55\) rupees per share.

\(R\) is the unit everything else is measured in. A trade that makes \(2\times\) the per-share risk is a +2R trade. A full stop-out is −1R. Thinking in R lets you compare a Rs 300 stock with a Rs 14,000 stock.

Formula: R-multiple of a trade \[ R\text{-multiple} = \frac{\sum_i w_i\,(\text{Exit}_i - \text{Entry})}{\text{Entry}-\text{Stop}} - \frac{\text{costs}}{\text{Entry}-\text{Stop}} ,\qquad \sum_i w_i = 1 \]
\(\text{Entry},\ \text{Stop}\)
Your buy price and initial stop, in Rs. \(\text{Entry} - \text{Stop}\) is \(R\), the risk per share.
\(i\)
Numbers each part of the exit. A trade sold in two halves has parts \(i = 1, 2\). A trade sold all at once has only \(i = 1\).
\(\text{Exit}_i\)
The price at which part \(i\) was sold.
\(w_i\)
The fraction of the position sold in part \(i\) (0.5 for a half). The fractions add up to 1.
\(\textstyle\sum_i\)
"Add up" over all the parts.
\(\text{costs}\)
Round-trip trading costs per share, in Rs. The backtests use a flat 0.24% of the entry price.
  1. For each part of the exit, take its profit per share (\(\text{Exit}_i - \text{Entry}\)) and multiply by its fraction \(w_i\). Add the parts. That is the average profit per share.
  2. Divide by \(R\) to express it in R. +2R means you made twice what you risked. −1R is a clean stop-out.
  3. Subtract the costs, also divided by \(R\). The tighter the stop, the bigger this deduction.

Example (TITAN, Section 9): half sold at 3,983.09 and half at 4,075.50, entry 3,762.00, \(R = 110.55\). Gross = 0.5 × 221.09/110.55 + 0.5 × 313.50/110.55 = 1.00 + 1.42 = 2.42R. Costs = 0.0024 × 3,762/110.55 ≈ 0.08R. Net = +2.34R.

7.3 Position size: the most important calculation in this course

Varsity's Module 9 opens its position-sizing chapters with a poker story: the author lost his buy-in three times in 25 minutes by betting too big after losses. The lesson is that position sizing, not stock picking, decides whether you survive. Losses compound against you:

Account drawdown5%10%20%30%40%50%60%
Gain needed to get back to the start5.3%11.1%25.0%42.9%66.7%100%150%

The fix is fixed-fractional risk: decide how much of the account you will lose if the stop is hit (we use 1%), then let the stop distance set the number of shares. Varsity calls this family "percentage risk" or "percentage volatility" sizing, following Van Tharp.

Formula \[ Q_{\text{risk}} = \left\lfloor \frac{\text{Capital}\times \text{risk\%}}{\text{Entry}-\text{Stop}} \right\rfloor, \qquad Q_{\text{cap}} = \left\lfloor \frac{\text{Capital}\times 25\%}{\text{Entry}} \right\rfloor \] \[ Q = \min(Q_{\text{risk}},\,Q_{\text{cap}}) \]
\(\text{Capital}\)
Your account size in Rs (which figure to use is Section 7.4).
\(\text{risk\%}\)
The share of capital you accept losing if the stop is hit: 1% in this course, less in weaker regimes (Section 4.4).
\(\text{Entry} - \text{Stop}\)
The risk per share, \(R\), in Rs.
\(\lfloor x \rfloor\)
"Floor": round down to a whole number of shares. Rounding down keeps the risk at or under budget.
\(Q_{\text{risk}}\)
The number of shares the risk budget allows.
\(Q_{\text{cap}}\)
The number of shares the 25% exposure cap allows.
\(\min(\dots)\)
The smaller of the two.
\(Q\)
The number of shares you actually buy.
  1. Risk budget in Rs = capital × risk%.
  2. Divide the budget by the risk per share and round down. That is \(Q_{\text{risk}}\).
  3. Divide 25% of capital by the entry price and round down. That is \(Q_{\text{cap}}\).
  4. Buy the smaller of the two. If the cap is smaller, your actual risk ends up below 1%, which is fine. The TITAN example below works through it.

The second term is an exposure cap: no single stock may be more than 25% of the account. Without it, a very tight stop would tell you to put the whole account in one stock, and one overnight gap would then cost far more than 1%.

Worked example · TITAN · 3-4 Nov 2025 · account Rs 5,00,000

Sizing the TITAN pullback trade

  1. Risk budget = 5,00,000 × 1% = Rs 5,000.
  2. Entry (buy-stop at the setup bar's high) = 3,762.00. Stop = 3,651.45. Per-share risk \(R = 110.55\).
  3. \(Q_{\text{risk}} = \lfloor 5{,}000/110.55 \rfloor = 45\) shares (value Rs 1,69,290, which is 34% of the account).
  4. \(Q_{\text{cap}} = \lfloor 1{,}25{,}000/3{,}762 \rfloor = 33\) shares.
  5. \(Q = \min(45, 33) = \mathbf{33}\) shares, worth Rs 1,24,146. Actual risk = 33 × 110.55 ≈ Rs 3,648 (0.73% of the account). The cap made this trade a little smaller than 1% risk, which is fine.

7.4 Which "capital"? Varsity's three equity models

When positions are already open, what number do you multiply by 1%? Varsity's Module 9 (after Van Tharp) lists three models:

Varsity also describes sizing by a fixed number of shares or lots per lakh (simple, but ignores risk), by a percentage of margin (useful for futures), and by percentage volatility: shares = (capital × x%) ÷ ATR, so each position contributes the same daily rupee swing. For ETERNAL on 30 Sep 2026, ATR(14) was 8.15. At a 1% volatility budget that gives 5,000 ÷ 8.15 = 613 shares. Compare that with 358 shares from our stop-based method in Section 17. Both are reasonable. Pick one method and use it every time.

7.5 Portfolio heat

Each trade risks ≤1%, but trades are correlated: in a sell-off, all your longs fall together. So cap the total open risk (the sum of (entry − current stop) × qty over all positions) at about 5-6% of capital, hold at most 2 positions per sector, and count a position whose stop is at breakeven as zero heat.

In your framework

framework.risk.position_size(capital, risk_pct, entry, stop, lot_size=1), framework.risk.atr_stop(...) and framework.risk.r_multiple(...) implement this section. Add the 25% exposure cap in your own wrapper, or as a max_positions setting in run_backtest.

8. Gate 8: trade management and exits

Varsity's advice is blunt: once a well-checked trade is placed, do nothing until the target or the stop is hit, except trail the stop, which is "a healthy practice". We turn that into four mechanical rules that apply to every setup (Setup 3 uses a fixed target instead of rules 1-2):

  1. Partial profit at +2R: sell half the position when price reaches Entry + 2R. This banks a gain that already pays for about two losers.
  2. Breakeven stop: after the partial, move the stop on the remaining half to the entry price. The rest of the trade is now a free ride, apart from gap risk.
  3. Trailing exit for the rest: for daily setups, exit at the next open after a daily close below the 20 EMA. For the weekly setup, exit after a weekly close below the 10-week EMA. Using closes instead of intraday lows avoids being shaken out by one bad hour.
  4. Time stop: if price has not reached +1R within 10 sessions (15 for Setups 3 and 4), exit at the close. A swing trade that goes nowhere ties up capital and attention. A maximum hold (60 sessions for daily setups, 120 for the weekly one) forces a fresh look.
Diagram of a trade plan in R terms showing initial stop at minus 1R, entry, plus 1R time-stop level, plus 2R partial profit level, an illustrative price path and a trailing 20 EMA
Figure 5. The management plan drawn in R units, using the levels of the TITAN example (entry 3,762.0, 1R = Rs 110.55). The price path is illustrative. The real TITAN trade is in Figure 6.
Why these rules?

Swing-trade results are lopsided (Figure 15): most trades end near −1R or a little above zero, and a minority become large winners. The partial at 2R makes the trade less stressful to hold. The breakeven stop turns some would-be losers into scratches. The trailing stop lets the few big trends pay for everything. The time stop removes dead money. Each rule is a trade-off. A tighter trail, for example, gives back less but cuts big winners short.

What the rules can't protect against

An overnight gap. If a stock closes at 1,315 and opens at 1,282 below your stop of 1,308, you sell near 1,282, not 1,308. Section 14 measures how often that happens.

9. Setup 1: trend pullback to the 20 EMA

The idea: in an established uptrend, buy a temporary dip to a rising short-term average rather than chasing strength. You get a better price and a nearby, logical stop.

The logic: trends move in waves. After a push higher, early buyers take profits and price drifts back toward its "fair" short-term level, the 20 EMA. Buyers who missed the first leg wait there. If the trend is healthy, they step in and price turns back up. If the dip goes much deeper (below the pullback low), the trend may be ending, and we want out.

Exact rules (S1)

StepRule
Trend filterClose > 50-SMA > 200-SMA; the 200-SMA is higher than 20 sessions ago; the 20 EMA is above the 50-SMA
Recent strengthThe highest high of the last ~60 sessions was made within the last 10 sessions (a fresh high, then a dip)
Setup barToday's low ≤ 20 EMA × 1.005 (touched or came within 0.5%), and the close stays above the 50-SMA
TriggerBuy-stop at the setup bar's high, valid for 3 sessions (cancel if the stop is hit first). On a gap above the trigger, the fill is at the open.
Initial stopLowest low of the last 3 sessions − 0.25 × ATR(14)
ManagementHalf at +2R, then breakeven stop and trail with a daily close < 20 EMA; time stop 10 sessions; max hold 60
Real example · TITAN · Nov 2025 – Jan 2026 · winner

A textbook pullback in a strong uptrend (+2.34R net)

  1. Context (3 Nov 2025): close 3,724.5 > 50-SMA 3,583.01 > 200-SMA 3,428.83. On 23 Oct 2025 TITAN had tagged 3,800, its highest price in more than a year (the all-time high was 3,886.95 in January 2024), so the stock had just made a fresh 52-week high. Nifty was above its 200-DMA (risk-on).
  2. Setup bar (3 Nov): low 3,667.3 ≤ 20 EMA 3,660.53 × 1.005 = 3,678.83. The dip touched the average. High 3,762.0 becomes the trigger.
  3. Stop: lowest low of 30 Oct-3 Nov = 3,667.3, minus 0.25 × ATR 63.39 (15.85) = 3,651.45. \(R = 3{,}762.00 - 3{,}651.45 = 110.55\). 2R target = 3,762 + 2 × 110.55 = 3,983.10.
  4. Entry (4 Nov): opened 3,724.5, rose to 3,827 and filled the buy-stop at 3,762.00. Volume that day was 25.2 lakh, about 2.4× the 50-day average, which confirmed the turn. Size: 33 shares (Section 7.3).
  5. Weeks 1-7: price held above the stop and climbed slowly. It never needed the time stop (it passed +1R within 10 sessions).
  6. Partial (26 Dec 2025): high 4,006.9 ≥ 3,983.10, so sell 16 shares at 3,983.09 (+2R). The stop on the other 17 moves to 3,762.
  7. Trail exit: on 20 Jan 2026 the close (4,075.5) fell below the 20 EMA (4,102.17), so sell the remaining 17 at the next open, 21 Jan, at 4,075.50.
  8. Result: \(R = 0.5\times\frac{3983.09-3762}{110.55} + 0.5\times\frac{4075.5-3762}{110.55} = 0.5(2.00)+0.5(2.84) = 2.42R\) gross. The backtest deducts a flat 0.24% of the entry value, 0.0024 × 3,762 / 110.55 ≈ 0.08R, giving net +2.34R. In rupees, with the real 16/17-share split and the exact costs (STT 257.16 + exchange 7.89 + SEBI 0.26 + GST 1.47 + stamp 18.62 + DP 2 × 15.34 = Rs 316.08), the trade made Rs 8,550.86 (+1.71% of the account) over 53 sessions. All R figures in this chapter use the same backtest convention (equal halves, flat 0.24% cost), so they can differ slightly from rupee P&L ÷ rupee risk.
TITAN daily candlestick chart September 2025 to January 2026 with 20 EMA and 50 SMA, marking setup on 3 Nov 2025, entry at 3762, stop at 3651.4, half exit at 2R 3983.1 on 26 Dec and final exit at 4075.5 on 21 Jan 2026
Figure 6. TITAN, Setup 1. Dip to the rising 20 EMA, trigger above the setup high, partial at 2R, trailing exit on a close below the 20 EMA.
DateOpenHighLowClose20 EMAClose in RAction
31 Oct 20253,758.93,783.03,739.53,746.73,653.80—Drifting back toward the EMA
3 Nov 20253,730.03,762.03,667.33,724.53,660.53—Setup bar: low touches the EMA. Place buy-stop 3,762
4 Nov 20253,724.53,827.03,715.03,813.53,675.10+0.47Filled at 3,762.0. Place stop GTT 3,651.45
6 Nov 20253,780.03,837.73,761.63,774.43,684.55+0.11Hold
11 Nov 20253,810.53,820.03,752.13,812.43,713.54+0.46Hold
26 Dec 20253,908.94,006.93,900.03,992.03,892.91+2.082R hit: sell 16 at 3,983.09; stop to 3,762
20 Jan 20264,155.04,155.04,064.34,075.54,102.17+2.84Close below the 20 EMA: exit tomorrow
21 Jan 20264,075.54,109.94,053.54,079.24,099.98+2.87Sold 17 at the open, 4,075.5
Real example · AXISBANK · Feb – Mar 2026 · loser, gap through the stop

Right setup, wrong market: −1.76R net

  1. Setup bar (13 Feb 2026): close 1,332.3, 20 EMA 1,325.32, 50-SMA 1,287.58, 200-SMA 1,197.76 (strong uptrend). Low 1,316.1 ≤ 1,325.32 × 1.005 = 1,331.95. Trigger = high 1,346.5.
  2. Stop: lowest low of 11-13 Feb = 1,316.1 − 0.25 × 32.16 = 1,308.06. \(R = 38.44\).
  3. Entry (16 Feb): opened 1,324, traded up to 1,361.9 and filled at 1,346.5. Size: risk allows 130 shares, the cap allows 92, so buy 92 (Rs 1,23,878; planned risk Rs 3,536).
  4. Late Feb: the stock passed +1R (1,384.94) on 23 Feb and peaked at 1,405.7 on 26 Feb (+1.54R), short of the 2R level of 1,423.38, so there was no time stop and no partial. Nifty slipped below its 200-DMA on 27 Feb 2026, and the March sell-off began (VIX rose from ~13 to above 20).
  5. 6 Mar: close 1,315.8, just 7.7 points above the stop (low 1,313.5).
  6. 9 Mar: opened at 1,282.2, below the stop of 1,308.06. The stop order fills near the open, not at 1,308.
  7. Result: \((1282.2 - 1346.5)/38.44 = -1.67R\) gross, −1.76R after costs. Rs −6,200 (−1.24% of the account). The loss was 1.75 times the planned risk because of the gap.
AXISBANK daily chart January to March 2026 showing a pullback setup on 13 Feb 2026, entry 1346.5 on 16 Feb, stop 1308.1, and a gap-down open of 1282.2 on 9 Mar 2026 below the stop
Figure 7. AXISBANK, Setup 1 that failed. The trade was valid when entered. The market regime then turned, and an overnight gap jumped the stop.
Real example · HDFCBANK · 3-6 Nov 2025 · quick loser

The everyday −1R

Setup bar 3 Nov 2025 (low 983.3 vs 20 EMA 990.71), entry 4 Nov at 994.55, stop 977.54 (\(R = 17.01\), only 1.71% below entry). Price slid and hit the stop on 6 Nov: −1.0R gross. 125 shares (the cap again bound) lost Rs 2,126 plus Rs 290 of costs. Note that costs were 0.14R here, because the stop was so tight. Tight stops make costs a bigger share of R. This is the most common outcome of any setup: a small, planned, boring loss.

Setup 1 statistics (37 stocks, 2017-Sep 2026, net of costs): 906 trades, win rate 38.3%, average +0.080R, profit factor 1.13 (total R won ÷ total R lost; above 1 means the winners outweighed the losers), average hold 13.8 sessions. With Nifty above its 200-DMA: +0.124R (767 trades). Below: −0.166R (139 trades). In 2025-26 alone: 121 trades, win rate 24.0%, −0.399R. A choppy market is the pullback trader's worst enemy, because every "dip to the EMA" keeps going.

Common mistakes with pullbacks

(1) Buying the touch without waiting for the trigger. (2) Calling a stock an "uptrend" because of one week of gains. Use the 50/200 filter. (3) Moving the stop lower "to give it room" after entry. (4) Taking pullbacks while breadth is collapsing.

In your framework

framework.strategies.trend_pullback(df) returns entry, exit and stop columns for exactly this rule set. Run python -m framework.backtest_cli trend_pullback to reproduce the statistics.

10. Setup 2: breakout to a 52-week high on volume

The idea: when a stock closes above the highest price of the past year, on heavy volume, after a period of sideways movement (a "base"), buy the next morning.

The logic: the 52-week high is a resistance level everyone can see (Chapter 3). Sellers who bought near it have been waiting to "get out at cost". A close above it on unusual volume means demand has absorbed all of that supply. With nobody left holding at a loss above, there is little overhead resistance. Volume, as Varsity's volume chapter stresses, is the confirmation that big participants are involved.

Exact rules (S2)

StepRule
Signal barClose > prior 252-session high (52-week high); volume ≥ 1.5 × prior 50-day average; close in the upper half of the day's range
BaseThe prior 20 sessions' range (high − low) ≤ 15% of the high, i.e. a consolidation, not a vertical spike
EntryNext session's open. Skip if it gaps more than 3% above the signal close (don't chase).
Initial stopLower of (signal-bar low, old 52-week high) − 0.25 × ATR(14). A close back inside the base means the breakout failed.
ManagementHalf at +2R, breakeven, trail with a close < 20 EMA; time stop 10 sessions; max 60
Formula: relative volume \[ \text{RVOL}_t = \frac{V_t}{\frac{1}{50}\sum_{k=1}^{50} V_{t-k}} \ \ge 1.5 \]
\(V_t\)
Volume (shares traded) on the signal day \(t\).
\(V_{t-k}\)
Volume \(k\) sessions before the signal day.
\(\frac{1}{50}\sum_{k=1}^{50} V_{t-k}\)
The average volume of the 50 sessions before the signal day. \(k\) starts at 1, so the signal day itself is left out.
\(\text{RVOL}_t\)
Relative volume: the signal day's volume as a multiple of that average. 1.0 = normal, 2.0 = double.

How it works: average the volume of the previous 50 sessions and divide the signal day's volume by it. The breakout counts only if RVOL is at least 1.5. The signal day is left out of the average so that a huge day can't inflate its own yardstick. The MARUTI example below has an RVOL of 7.15.

Real example · MARUTI · Aug – Oct 2025 · winner

A news-driven breakout that kept going (+2.71R net)

  1. Base: from 20 June to 14 August 2025 MARUTI moved sideways between 12,225 and 12,959 below its 52-week high of 13,541.65 (Figure 8).
  2. Signal (18 Aug 2025): close 14,068 > 13,541.65. Volume 21,54,781 vs a 50-day average of 3,01,425, so RVOL = 7.15. The close was near the day's high. (The surge followed the government's mid-August 2025 signal of GST rate cuts, which lifted auto stocks. The chart rules didn't need to know that.)
  3. Entry (19 Aug): open 14,070 (a 0.01% gap, within the 3% limit).
  4. Stop: min(signal low 13,664, old high 13,541.65) − 0.25 × 285.59 = 13,470.25. \(R = 599.75\) (4.26%).
  5. Size: \(\lfloor 5000/599.75\rfloor = 8\) shares (the cap also allows 8). Value Rs 1,12,560. Planned risk Rs 4,798.
  6. Partial (8 Sep): high 15,319 ≥ 2R level 15,269.49. Sell 4 shares. Stop on the other 4 moves to 14,070.
  7. Exit: 29 Oct close 16,138 < 20 EMA 16,160.25, so sell 4 at the 30 Oct open, 16,190.
  8. Result: \(0.5(2.00) + 0.5\frac{16190-14070}{599.75} = 1.00 + 1.77 = 2.77R\) gross, +2.71R net, Rs +12,983 (+2.60%) in 49 sessions.
MARUTI daily chart June to November 2025 showing sideways base, breakout above the prior 52-week high on 18 Aug 2025 with volume spike, entry 14070, stop 13470.2, half exit at 15269.5 and final exit 16190
Figure 8. MARUTI, Setup 2. The dotted purple line is the prior 52-week high. The volume bar on the breakout day dwarfs the 50-day average.
Real example · LT · Oct – Nov 2025 · loser

A breakout that just didn't follow through (−1.11R net)

  1. Signal (28 Oct 2025): close 3,972.8 > prior 52-week high 3,966.2, by only 0.17%. RVOL = 33.9 lakh / 16.1 lakh = 2.11. RSI(14) 75: already stretched.
  2. Entry (29 Oct): open 3,988.0. Stop = 3,917.3 − 0.25 × 55.93 = 3,903.32. \(R = 84.68\). Size 31 shares (the cap binds).
  3. Price poked to 4,062.6 on 30 Oct (still under +1R = 4,072.7), then faded.
  4. 6 Nov: low 3,872.1 < stop, so out at 3,903.32. −1.0R gross, −1.11R net (Rs −2,913).
  5. And then: after one more dip to 3,831.1 on 7 Nov, LT recovered and closed at 4,081.3 on 27 Nov, above the entry. Stops sometimes take you out just before a move resumes. That is the cost of having a stop at all, and re-entry only happens if a new setup appears.
  6. Lesson: a breakout that only just clears the level, with modest volume, is weaker evidence than MARUTI's 7× volume and a close 3.9% above the old high. Many traders require RVOL ≥ 2 and a close at least 1% above the level. You can test those refinements in Chapter 12.
LT daily chart showing a marginal breakout above the 52-week high on 28 Oct 2025, entry 3988, and stop-out at 3903.3 on 6 Nov 2025
Figure 9. LT, Setup 2 that failed. The close above the old high was marginal and the move reversed within six sessions.
Real example · ONGC · 28 Jan – 2 Feb 2026 · event-risk loser

A breakout entered just before the Union Budget

  1. Signal: ONGC broke out on 28-29 Jan 2026 on 4.7× average volume (close 275.39 on 29 Jan vs the prior 52-week high of 269.65).
  2. Entry (30 Jan): 273.89, stop 267.40 (\(R = 6.49\)). The 25% cap allowed 456 shares, a planned risk of about 0.6% of the account.
  3. The event: the Union Budget was presented on Sunday 1 Feb 2026, and NSE held a special live trading session that day (NSE circular, Jan 2026). Our Yahoo daily series doesn't contain that Sunday session. The next bar in our data is 2 Feb, opening at 251.60, far below the stop.
  4. Could you even have sold on Sunday? Probably not. NSE declared 1 Feb a settlement holiday, and brokers' notices said shares bought on 30 Jan would reach demat only on 2 Feb, so they could not be sold in the Budget session (no BTST, i.e. buy-today-sell-tomorrow).
  5. Result: the stop was jumped by an event. In our data the loss is −3.44R gross, −3.54R net, about −2.1% of the account against a planned 0.6%.
  6. Lesson: know the event calendar. Budget day, RBI policy days and company results are scheduled. Don't open a fresh breakout the session before one, or halve the size.

Setup 2 statistics: 418 trades, win rate 37.8%, average only +0.012R (gross +0.073R before costs), profit factor 1.02. It was positive in 2021-23 (+0.176R) and clearly negative in 2024-26 (−0.268R, win rate 29.6%). On our large-cap list, plain 52-week-high breakouts were roughly break-even after costs. That doesn't make breakouts useless. It means the edge, if any, comes from selectivity (base quality, sector strength, volume quality) and from the occasional MARUTI-style runner.

In your framework

framework.strategies.breakout_52w(df), with the volume and base conditions as parameters, so you can test RVOL 1.5 vs 2.0 yourself.

11. Setup 3: support bounce with a bullish candle (the Varsity checklist)

This setup is a direct translation of the trading checklist in Varsity Module 2's finale chapter. In Varsity's words, the checklist is "fairly stringent", so few trades qualify, but conviction is high when one does. Here are its items, and how we made each one exact:

Varsity checklist itemOur exact rule
A recognisable candlestick pattern in the last 1-3 candlesHammer, bullish engulfing, piercing or morning star (definitions from Chapter 2)
Prior trend should be down for a bullish patternClose today < close 10 sessions ago
Volume at least equal to the 10-day averageVolume ≥ average of the prior 10 sessions
Support should coincide with the stop-loss; reject if S&R is more than 4% away from the stopA confirmed swing low from 15-250 sessions ago within 3% of the pattern low; that support within 4% of the stop
Look back ~2 years for S&RPivot lows and highs (5 bars either side) within the last 250 sessions
Target from the nearest resistance; minimum RRR 1.5Target = nearest swing high above entry; skip unless \((T-E)/(E-S) \ge 1.5\)
MACD / RSI as optional confirmationNot required (kept simple)
Stop = low of the patternPattern low − 0.1 × ATR(14)

Entry: buy-stop above the pattern high, valid for 2 sessions. Exit: the full position at the target or at the stop. The time stop applies if price has not reached +1R within 15 sessions, and the maximum hold is 40 sessions. There is no partial exit or trailing here, because the target is a real resistance level.

Formula: risk-reward ratio \[ \text{RRR} = \frac{\text{Target}-\text{Entry}}{\text{Entry}-\text{Stop}} \ \ge 1.5 \]
\(\text{Target}\)
Where you plan to take profit: the nearest swing high (resistance) above entry, in Rs.
\(\text{Entry}\)
The planned buy price: the buy-stop just above the pattern high.
\(\text{Stop}\)
The initial stop: pattern low − 0.1 × ATR(14).
\(\text{RRR}\)
Risk-reward ratio: rupees you stand to make for each rupee you risk.

How it works: divide the distance to the target by the distance to the stop. An RRR of 1.5 means a winner pays 1.5 times what a loser costs. Below 1.5, skip the trade. The AXISBANK example below has a planned RRR of 4.3.

The logic: support is a price where buyers showed up before. A bullish candle there, on decent volume, shows they are showing up again. The stop sits just under the pattern, so it is close and the reward to the next resistance can be several times the risk. The weakness: you are buying in a short-term downtrend, so when support breaks, it can break hard.

Real example · AXISBANK · Aug 2026 · winner in a risk-off market

Hammer on a December swing low (+3.61R net)

  1. Support: the swing low of 1,216.9 made on 16 Dec 2025.
  2. Prior trend: AXISBANK closed between about 1,307 and 1,329 in mid-July 2026, then slid to 1,217.4 by 14 August. Close on 14 Aug (1,217.4) was below the close 10 sessions earlier. ✓
  3. Pattern (14 Aug 2026): O 1,216.0, H 1,218.7, L 1,208.6, C 1,217.4. Body 1.4, lower shadow 7.4 (≥ 2 × body), upper shadow 1.3 (≤ 25% of the 10.1 range). A hammer. ✓
  4. Volume: 55.6 lakh vs 10-day average 54.7 lakh (1.02×). ✓ Just enough.
  5. Stop: 1,208.6 − 0.1 × 21.87 = 1,206.41. Support 1,216.9 is 0.9% above the stop (well within 4%). ✓
  6. Target: nearest swing high above = 1,272.0 (3 Aug 2026). Planned RRR = (1,272.0 − 1,218.7)/(1,218.7 − 1,206.41) = 4.3 ≥ 1.5. ✓
  7. Entry (17 Aug): opened at 1,220.0, above the trigger 1,218.7, so filled at the open. \(R = 13.59\) (1.11%).
  8. Size: risk allows 367 shares (Rs 4.48 lakh, 90% of the account!). The 25% cap allows 102, so actual risk is only Rs 1,386. This shows why the cap exists.
  9. Exit (31 Aug): high 1,300 ≥ 1,272, so sold at the target 1,272.0. +3.83R gross, +3.61R net (Rs +5,006, +1.0%), 10 sessions. The market was in risk-off mode (Nifty below its 200-DMA), which is when this setup has historically done best.
AXISBANK daily chart June to September 2026 with support line at 1216.9 from a December 2025 swing low, hammer on 14 Aug 2026, entry 1220 on 17 Aug, stop 1206.4 and target 1272 reached on 31 Aug
Figure 10. AXISBANK, Setup 3. Support from December 2025 (purple), a small hammer, a tight stop and a target at the 3 Aug swing high.
Real example · HDFCBANK · Mar 2026 · loser with a gap

Engulfing pattern at support, then an 8.7% gap down (−2.12R net)

  1. Support: the swing low of 835.03 (11 Mar 2025). Price had undercut it to 812 and closed back above it.
  2. Pattern (16 Mar 2026): 13 Mar red (O 820.0, C 817.0), 16 Mar green (O 817.0, C 840.6), engulfing the prior body: bullish engulfing. Volume 5.22 crore vs 10-day average 3.97 crore (1.31×). RSI 34.5.
  3. Stop: pattern low 812.0 − 0.1 × 19.36 = 810.06. Target: swing high 921.85 (25 Mar 2025). RRR = (921.85 − 844.5)/(844.5 − 810.06) = 2.25. ✓
  4. Entry (17 Mar): opened 847.7, above the 844.5 trigger. \(R = 37.64\) (4.44%). Size 132 shares, risking Rs 4,968.
  5. 19 Mar: the stock opened at 770.0, an 8.7% gap below the previous close of 843.05 and 40 points below the stop. Volume that day was 17.2 crore, more than 5× normal.
  6. Result: −2.06R gross, −2.12R net, Rs −10,510 (−2.1% of the account), twice the planned loss.
  7. What the regime said: Nifty was below its 200-DMA, breadth was below 20% and VIX was around 19-23. The playbook allows S3 in risk-off only at half risk. At 0.5% risk this loss would have been about −1.05% of the account. The half-size rule exists for exactly this kind of day.
HDFCBANK daily chart January to March 2026 showing bullish engulfing at support on 16 Mar 2026, entry 847.7, stop 810.1 and a gap-down open of 770 on 19 Mar 2026
Figure 11. HDFCBANK, Setup 3 that failed. The checklist was satisfied, but support "holds until it doesn't", and a gap made the loss twice the plan.
Real example · DMART · Mar 2025 · winner

Hammer at the January low (+3.08R net)

Hammer on 3 Mar 2025 (O 3,425.0, H 3,472.0, L 3,340.0, C 3,453.2; lower shadow 85 vs body 28.2) at the 14 Jan 2025 swing low of 3,443.0, on volume 1.76× its 10-day average. Stop 3,329.21, target 3,920.45 (6 Dec 2024 swing high), RRR 3.14. The buy-stop at 3,472.0 filled on 5 Mar (the second valid day). The target was hit on 21 Mar: +3.14R gross, +3.08R net, Rs +15,394 on 35 shares (+3.08% of the account) in 10 sessions. This was also a risk-off market (Nifty below its 200-DMA in March 2025), just before the April-June 2025 recovery.

Setup 3 statistics: 172 trades (the checklist is strict!), win rate 40.7%, average +0.150R, profit factor 1.23, average hold 6.5 sessions. Opposite to the trend setups: with Nifty below its 200-DMA it averaged +0.509R (58 trades, 51.7% wins), and above it −0.033R (114 trades). 2025-26: 48 trades, +0.081R. Adding a "stock above its 200-SMA" filter made it worse (74 trades, +0.099R). The bounces that worked best came in washed-out markets. Treat these splits with care: 58 trades is a small sample.

12. Setup 4: weekly trend + daily trigger

The idea: use the weekly chart to decide direction (only stocks in a weekly uptrend) and the daily chart to time the entry after a short pullback. This is the multiple-timeframe approach Varsity hints at when it says higher timeframes give more reliable signals. It is also the most "positional" of the four setups.

The logic: weekly bars filter out daily noise, so a weekly uptrend reflects the bigger players' sustained buying. Inside it, short pullbacks (daily RSI dipping below 45) are pauses. A daily close above the prior two highs shows buyers are back. Because the trailing exit is weekly, the trade can last for months, which is where large R-multiples come from.

Exact rules (S4)

StepRule
Weekly trend (last completed week)Weekly close > 30-week SMA; the 30-week SMA is higher than 4 weeks ago; 10-week EMA > 30-week SMA
Daily pullbackRSI(14) was below 45 at some point in the last 5 sessions
Daily triggerClose > the highs of both of the previous 2 sessions, and the daily close is still above the 30-week SMA
EntryNext open (skip if it gaps more than 3% above the trigger close)
Initial stopLowest low of the last 10 sessions − 0.25 × ATR(14); skip if the stop is more than 10% away
ManagementHalf at +2R, breakeven, then exit the rest after a weekly close < 10-week EMA; time stop 15 sessions; max 120
Real example · SBIN · Sep 2025 – Feb 2026 · big winner

Riding the weekly trend for 120 sessions (+11.34R net)

  1. Weekly filter (week ending 29 Aug 2025): close above a rising 30-week SMA (781.49); 10-week EMA 807.63 above it. ✓
  2. Pullback: daily RSI fell to 42.7 on 2 Sep 2025. ✓
  3. Trigger (3 Sep): close 812.15 > highs of 1 Sep (808.3) and 2 Sep (810.5). ✓
  4. Entry (4 Sep): open 814.65. Stop: 10-day low 798.50 − 0.25 × 9.48 = 796.13. \(R = 18.52\) (2.27%).
  5. Size: risk allows 269 shares, the cap allows 153 (Rs 1,24,641; risk Rs 2,834).
  6. Partial (17 Sep): a 1.72 crore-share day pushed the high to 858.15 ≥ 2R level 851.69. Sell 76 shares. Stop on the other 77 moves to 814.65.
  7. The hold: SBIN never had a weekly close below its 10-week EMA for five months, through two quarterly results (November 2025 and February 2026).
  8. Exit (27 Feb 2026): 120-session maximum hold, sold at the close, 1,201.70.
  9. Result: \(0.5(2.00) + 0.5\frac{1201.70-814.65}{18.52} = 1.00 + 10.45 = 11.45R\) gross, +11.34R net. Rs +32,276 (+6.46% of the account) from one trade with only Rs 2,834 at risk.
Two panels: left, SBIN weekly candles October 2024 to April 2026 with 10-week EMA and 30-week SMA, shading the holding period; right, SBIN daily candles around the 3 Sep 2025 trigger with stop and 2R levels
Figure 12. SBIN, Setup 4. Left: the weekly trend filter and the 5-month holding period. Right: the daily trigger after RSI dipped below 45.
Real example · HAL · Sep – Dec 2025 · loser

Up +1.2R, then all the way back to the stop (−1.04R net)

  1. Trigger (10 Sep 2025): close 4,557.5 above the prior two highs. Weekly trend up (10-week EMA 4,525.95 > 30-week SMA 4,376.47). Daily RSI had dipped to 40.9 on 5 Sep.
  2. Entry (11 Sep): 4,565.0. Stop 4,297.10 (\(R = 267.90\), 5.87%). Size 18 shares (Rs 82,170), risk Rs 4,822.
  3. 17 Sep: close 4,890.2 = +1.21R. Then the rally stalled well short of the 2R level (5,100.8).
  4. No time stop, because it had passed +1R. No partial, because it never reached +2R. So the stop stayed at 4,297.10 while the stock drifted down over October and November.
  5. 8 Dec 2025: low 4,270.5 hit the stop. −1.0R gross, −1.04R net (Rs −5,015) after 59 sessions.
  6. Lesson: wide, patient stops let winners like SBIN run, and the price is trades like this that give back an open gain. A common variant moves the stop to breakeven at +1R. That would have turned HAL into a scratch but also cut some later winners. Test variants on your data (Chapter 12) before changing rules.
HAL daily chart September to December 2025 showing entry 4565 on 11 Sep, a rise to about plus 1.2R, and slow decline to the stop 4297.1 on 8 Dec 2025
Figure 13. HAL, Setup 4 that failed slowly. The purple step line is the weekly 10-week EMA.
Real example · TITAN · Feb – Aug 2026 · winner through a crash

A wide stop that survived March 2026 (+2.68R net)

RSI dipped to 37.5 on 29 Jan 2026. Trigger 3 Feb 2026, entry 4 Feb at 4,087.0, stop 3,820.62 (6.52% away; only 18 shares). Nifty fell about 14% from its February high close (25,953.85) to 22,331.40 on 30 Mar 2026, but TITAN held its 10-session-low stop. It reached 2R (4,619.76) on 7 Jul 2026, and the remaining 9 shares were sold at the 120-session limit on 3 Aug at 5,000.0. +2.71R gross, +2.68R net, Rs +12,804. A relative-strength leader (Figure 4) can survive a weak market. A tight stop would not have survived the March volatility.

Setup 4 statistics: 696 trades, win rate 41.4%, average +0.293R, profit factor 1.53, average hold 27.5 sessions, best trade +21.57R. It was the best of the four, and its edge came from a few long-held trends (the median trade was −0.68R). Regime: +0.323R above the 200-DMA (588 trades) vs +0.132R below (108). 2025-26: 104 trades, 30.8% wins, −0.162R.

In your framework

Combine framework.data.resample(df, "W-FRI") with framework.indicators.ema/sma for the weekly filter, and framework.indicators.rsi for the daily dip. framework.strategies.ma_crossover and donchian_trend are slower cousins of this setup.

13. How the four setups did, 2017-2026 (honest numbers)

Varsity's Module 10 opens by defining a trading system: an approach you can write down as a process, with inputs, rules and outputs, that can be measured and backtested. Anything you can't define as a process isn't a system. Here we measure our four.

Method: the rules above, applied mechanically to 37 NSE stocks with daily data from Oct 2016 to 30 Sep 2026 (trades start in 2017 once the 200-day averages exist). One open trade per stock per setup. Costs of 0.24% of the entry value are deducted from every trade. When a bar touches both the stop and the target, we assume the stop was hit first. Gaps through stops fill at the open.

Metric (net of costs)S1 PullbackS2 BreakoutS3 Support bounceS4 Weekly+daily
Trades906418172696
Win rate38.3%37.8%40.7%41.4%
Average R (expectancy)+0.080+0.012+0.150+0.293
Average R before costs+0.152+0.073+0.247+0.347
Median R−1.02−0.37−1.05−0.68
Average win / average loss+1.76 / −0.96+1.42 / −0.84+1.97 / −1.10+2.06 / −0.95
Profit factor1.131.021.231.53
Average hold (sessions)13.814.46.527.5
Best / worst trade+12.41 / −2.29+6.53 / −3.54+4.05 / −2.12+21.57 / −2.14
Median stop distance3.5%4.6%2.76%5.16%
Median cost per trade (in R)0.0690.0520.0870.047
Longest losing streak1612616
Nifty > 200-DMA: trades / avg R767 / +0.124390 / +0.024114 / −0.033588 / +0.323
Nifty < 200-DMA: trades / avg R139 / −0.16628 / −0.15758 / +0.509108 / +0.132
2017-2020 avg R (n)+0.19 (273)+0.01 (128)+0.03 (50)+0.26 (208)
2021-2023 avg R (n)+0.15 (360)+0.18 (182)+0.38 (58)+0.60 (285)
2024-Sep 2026 avg R (n)−0.12 (273)−0.27 (108)+0.03 (64)−0.11 (203)
2025-26 only: trades / win / avg R121 / 24.0% / −0.39939 / 28.2% / −0.32948 / 39.6% / +0.081104 / 30.8% / −0.162
2,192
simulated trades, 37 stocks
+0.29R
best expectancy (S4)
~38-41%
win rates: losing is normal
16
longest losing streak (S1, S4)
Left: cumulative R-multiple curves for the four setups from 2017 to 2026; right: bar chart of average R per trade split by whether Nifty was above or below its 200-day average
Figure 14. Left: cumulative net R of each setup. Most gains came in 2020-21 and late 2023-24, and 2025-26 was a drawdown for S1, S2 and S4. Right: average R by regime. Trend setups need a rising market. The support bounce did better in weak markets.
Four histograms of R-multiples per setup showing a cluster near minus 1R and a long right tail of winners
Figure 15. The shape of swing-trading results: a wall of trades near −1R and a long right tail. You'll be wrong more often than right. The size of the winners is what pays.

Reading the numbers: expectancy

Formula \[ E[R] = p_{\text{win}}\times \overline{R}_{\text{win}} + (1-p_{\text{win}})\times \overline{R}_{\text{loss}} \]
\(E[R]\)
Expectancy: the average R you can expect per trade over many trades.
\(p_{\text{win}}\)
The win rate as a fraction: the share of trades that ended with a profit (0.414 = 41.4%).
\(1-p_{\text{win}}\)
The share of trades that lost.
\(\overline{R}_{\text{win}}\)
The average R of the winning trades (a positive number). The bar on top means "average".
\(\overline{R}_{\text{loss}}\)
The average R of the losing trades, kept as a negative number (for example −0.95).

How it works: weight the average win by how often you win, weight the average loss by how often you lose, and add the two. Above zero means the setup made money per trade on average (after costs, since these R values are net). Multiply by your rupee risk per trade to get rupees per trade. The S4 numbers below show the arithmetic.

For S4: \(0.414 \times 2.06 + 0.586 \times (-0.95) = 0.85 - 0.56 = +0.29R\) per trade. Risking Rs 5,000 per trade (full 1%), that's about Rs 1,465 per trade on average, before tax, across hundreds of trades. Any single month can be far worse. S1 and S4 both had 16 losses in a row at some point. Varsity calls the belief that "after 6 losses the 7th must win" the gambler's fallacy: each trade has the same odds as the first. The antidote is fixed position sizing, not bigger bets after losses.

Caveats: why these numbers are probably too good

The honest conclusion

None of these setups is a money machine. On large caps, after costs, S1 and S2 have a thin edge that disappears in bad regimes. S3 is rare and has a small sample. S4 had the best long-run expectancy, but it too lost in 2025-26. Your edge comes from the whole playbook combined: regime filter, leaders only, strict sizing, event awareness and discipline. No single pattern provides it. Paper-trade or trade very small for at least 30-50 trades before trusting any setup with real size.

14. Event risk: results days, gaps and the Budget

Swing trades are held overnight, so they are exposed to news that arrives when the market is closed. The biggest scheduled source is quarterly results. Under SEBI's LODR Regulations, listed companies must publish quarterly results within 45 days of the quarter end (60 days for the annual results) and must announce the board-meeting date in advance. That gives you a calendar to plan around.

Data study · 37 stocks · 1,194 results announcements · 2018-2026

How much more do stocks move around results?

  1. For each results date (from Yahoo Finance's earnings calendar), measure the move from the close before the announcement to the close of the first session after it (a 2-day window), and the largest opening gap in that window.
  2. Median 2-day move: 2.45% around results vs 1.39% for any 2-day window.
  3. Moves bigger than 5%: 21.1% of results events vs 7.0% of normal windows, three times as often.
  4. Opening gaps bigger than 3%: 17.8% of results windows (the larger of the two opening gaps) vs 3.4% of ordinary two-session windows (1.8% of single days): about five times as often on a like-for-like basis.
  5. Biggest 2025-26 results moves in our list: ETERNAL (21 Jul 2025) 16.6% with a 7.8% gap; ETERNAL (20 Jan 2025) 13.8%; DIXON (20 Jan 2025) 12.1%; ADANIENT (3 Feb 2026) 11.7% with a 7.7% gap; SBIN (8 May 2026) 10.8%; CDSL (25 Jan 2025) 10.4%.
Overlaid histograms of absolute 2-day stock moves: all windows versus windows around quarterly results, showing results windows have a much fatter tail
Figure 16. Results windows (red) have a far fatter tail than ordinary days (grey). A 1R stop gives no protection against a 7% opening gap.

Rules for results and other events

A judgement lesson: a statistic that lies

In our backtest, S1 trades that were open over a results date averaged +1.25R (201 trades), versus −0.25R for the rest. S4 showed the same pattern: +1.55R vs −0.42R. Does holding through results make money? No. Losing trades get stopped out within days, so they rarely live long enough to reach a results date. Only trades that were already working survive that long. Results days didn't cause the gains. Survival caused the overlap. Always ask "could the selection itself explain this number?" before acting on a statistic.

Upcoming results in our universe (estimated dates from Yahoo Finance; confirm on NSE): TCS ~8 Oct 2026, DMART ~10 Oct, HCLTECH ~12 Oct, ETERNAL / WIPRO / POLYCAB / NESTLEIND / HDFCAMC ~15 Oct, RELIANCE / DIXON ~16 Oct, the large private banks ~17 Oct, INFY ~23 Oct, and LT, ITC, MARUTI, ASIANPAINT, COALINDIA and others in late October. Any trade opened in early October 2026 is very likely to run into results.

15. Placing the orders: GTT mechanics

A normal stop-loss order on an Indian exchange is a day order: it expires at the close. For multi-day trades you would have to re-enter it every morning. Brokers solve this with GTT (Good Till Triggered) orders. Per Zerodha's GTT support documentation (accessed Oct 2026):

Walk-through · TITAN trade · Nov 2025

The order sequence for one swing trade

  1. Evening of 3 Nov (setup found): create a single buy GTT for 33 shares, trigger 3,762.00, limit about 0.3-0.5% higher (e.g. 3,775) so the order can fill if price moves fast. Note the limit means you might pay a little more than our backtest assumed.
  2. Evening of 4 Nov (filled at ~3,762): create the exit orders. With a half-at-2R plan, either (a) an OCO sell GTT for 16 shares with stop trigger 3,651.45 (limit a little lower, e.g. 3,640) and target trigger 3,983.10, plus a single sell GTT stop for the other 17 shares at 3,651.45, or (b) one stop GTT for all 33 and a separate target GTT for 16. Check how your broker treats quantities across multiple GTTs on the same holding.
  3. Each evening: 2 minutes. Is the position above the stop? Has the 20 EMA been broken on a close? Any results date coming?
  4. 26 Dec (2R hit, 16 sold): modify the remaining stop GTT up to 3,762.00 (breakeven).
  5. 20 Jan (close below the 20 EMA): place a sell order for the 17 shares for the next morning (an AMO, i.e. an after-market order placed in the evening for the next open, at market or with a limit near the expected open), and cancel the stop GTT once it fills.
GTT is not a guaranteed stop

If a stock gaps below your stop and below your limit price, as on AXISBANK 9 Mar 2026 or HDFCBANK 19 Mar 2026, the GTT fires but its limit sell may not fill, and the stock keeps falling. On a gap day, check your positions after the open and exit manually if your limit is stranded. Two ways to reduce this risk: set the stop's limit price a few percent below the trigger, or choose the GTT's market-with-protection option for stop exits. Both raise the chance of a fill but can mean a worse price. There is no perfect answer. Size so that a gap won't hurt you badly.

16. Trade journal and weekly review

Varsity's chapter on trading biases names attribution bias: winners feel like skill, losers get blamed on the broker, the market or bad luck. Its cure is a written journal. Record why you entered and exited, then compare plans with outcomes. Over months the journal shows you your real tendencies. Here is a template, filled in with four trades from this chapter:

#Entry dateStockSetupRegime at entryEntryStopQtyRisk RsPlanExit dateAvg exitR (net)Rules followed?Notes
119 Aug 2025MARUTIS2Risk-on14,070.0013,470.2584,798½ at 2R, trail 20 EMA30 Oct 202515,729.75+2.71YesRVOL 7.2 on news; base 2 months
229 Oct 2025LTS2Risk-on3,988.003,903.32312,625½ at 2R, trail 20 EMA6 Nov 20253,903.32−1.11YesMarginal breakout, RSI 75: weaker evidence
34 Nov 2025TITANS1Risk-on3,762.003,651.45333,648½ at 2R, trail 20 EMA21 Jan 20264,030.70+2.34YesCap limited size; held 53 sessions
416 Feb 2026AXISBANKS1Risk-on → off1,346.501,308.06923,536½ at 2R, trail 20 EMA9 Mar 20261,282.20−1.76YesGap through stop; regime flipped 27 Feb

Also save a chart screenshot at entry and at exit, and add a line on how you felt (anxious, overconfident, bored). Over time those notes reveal patterns, for example "I break rules after 3 losses".

The weekly review (weekend, ~30 minutes)

  1. Numbers: trades closed, win rate, average R, total R this week and over the last 20 trades (a rolling expectancy). Plot your equity curve. Varsity's equity-curve chapter normalises a portfolio to a starting value of 100 and tracks it daily.
  2. Rule audit: how many trades broke a rule (entry without trigger, stop moved, size too big, results ignored)? Rule-breaks are the most useful number in the journal.
  3. Open risk ("heat"): add up (entry − current stop) × qty across open trades. Is it under ~5% of capital?
  4. Regime and RS refresh: recompute the regime table, the sector ranking and the top-12 focus list for next week.
  5. Calendar: note the results dates, RBI policy, Budget and expiry-week events coming up.
  6. One lesson: write one sentence you'll apply next week.
In your framework

framework.risk.r_multiple, expectancy and max_drawdown compute the weekly numbers from a CSV journal. framework.backtest.run_backtest returns trades, an equity curve and metrics in the same format, so you can compare live results with the backtest.

17. The end-of-day routine (worked on 30 Sep 2026)

After the close (data is final around 4-6 pm), set aside 30 to 60 minutes and follow the same steps in the same order every day:

  1. Update data (2 min): refresh your EOD data (framework.data.update_ohlc).
  2. Manage open trades first (5-10 min): for each position check stop, 2R, trailing condition, time stop and upcoming results. Adjust GTTs.
  3. Regime (2 min): Nifty vs 200-DMA, breadth, VIX. This sets today's risk per trade.
  4. Scan (5 min): run the scanner on the focus list / universe for S1-S4 (python -m framework.scan).
  5. Evaluate each candidate (5-10 min each): the pre-trade checklist (Section 20). Most candidates fail.
  6. Plan and place (5 min): size, then create the buy GTT and write the plan in the journal before the trade happens.
  7. Close the laptop. No watching intraday. The orders do the work.
Walk-through · 30 Sep 2026

What the routine said on the last day of our data

  1. Regime: Nifty 22,620.45, 7.19% below a falling 200-DMA (24,372.85). Breadth: 7/37 above the 200-DMA (18.9%), 3/37 above the 50-DMA (8.1%). VIX 13.49. Risk-off. No new S1/S2 trades, or 0.25-0.5% risk at most.
  2. Sectors: leaders over 3 and 6 months are Pharma, Metal, Realty, Healthcare, Consumer Durables, Auto and Media. FMCG and CPSE lag.
  3. Scanner: one hit, ETERNAL, Setup 1. Close 320.00, low 317.1 touched the 20 EMA (327.42), close above the 50-SMA (319.32), 200-SMA far below (276.66). Trigger (buy-stop) 329.00, stop 315.06 (lowest 3-day low 317.1 − 0.25 × ATR 8.15), risk 4.24%.
  4. RS check: ETERNAL is the #1 RS stock in the universe (score +29.48). ✓
  5. Size: full 1% risk would be 358 shares (Rs 1,17,782, risk Rs 4,990.52). The risk-off rule says half risk or less: 179 shares (Rs 58,891, risk Rs 2,495.26).
  6. Event check: ETERNAL's next results are estimated around 15 Oct 2026, about 11 sessions away, inside a normal holding period. ETERNAL produced the largest results move in our list in 2025 (16.6% in July 2025).
  7. Historical context: S1 entered while Nifty was below its 200-DMA averaged −0.166R over 139 trades.
  8. Decision (educational): a disciplined playbook says pass, or at most a quarter-to-half-size trial position with the intention of exiting before results. This is not a recommendation. The point is that the routine turned one tempting chart into a calm, rules-based "probably not". On a day like this, no trade is a good outcome.

18. The mind behind the playbook

Varsity's Module 9 closes with trading biases. Each one maps onto a rule in this playbook:

Bias (Varsity)What it looks like in swing tradingThe playbook's defence
Gambler's fallacy"Five losers in a row, the next must win", so you double the sizeFixed 1% risk. Losing streaks of 12-16 happened in our data.
Recency biasAbandoning a setup after a bad month, or going all-in after a great oneJudge setups on 30+ trades and multi-year stats (Section 13)
Anchoring"I'll only buy at 270", then missing the move, or refusing to sell below your entryTriggers and stops are set by structure and ATR, not by the price you paid
Confirmation biasReading every news item as support for your open tradeThe exit rules decide, not the news. Ask "so what?"
Illusion of controlTen indicators on one chart, endless intraday checkingFour setups, one EOD session, GTT orders
Attribution biasWins are skill, losses are the broker's faultThe journal with "rules followed?" and notes

Chapter 11 goes deeper into risk of ruin, drawdowns and the psychology of losing streaks.

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 reproduces a number from this chapter.

(a) The regime line and breadth

import pandas as pd, glob, os
DATA = "data/ohlc"
nifty = pd.read_csv(f"{DATA}/IDX_NSEI.csv", index_col=0, parse_dates=True)
nifty["SMA200"] = nifty.Close.rolling(200).mean()
last = nifty.iloc[-1]
print(f"Nifty {last.Close:.2f} vs 200-DMA {last.SMA200:.2f} -> {(last.Close/last.SMA200-1)*100:+.2f}%")

above = []
for f in glob.glob(f"{DATA}/*.csv"):
    sym = os.path.basename(f)[:-4]
    if sym.startswith("IDX_"):
        continue
    d = pd.read_csv(f, index_col=0, parse_dates=True)
    d = d[d.Volume > 0]                       # drop stale holiday rows
    above.append(d.Close.iloc[-1] > d.Close.rolling(200).mean().iloc[-1])
print(f"Breadth: {sum(above)} of {len(above)} stocks above their 200-DMA = {sum(above)/len(above)*100:.1f}%")
vix = pd.read_csv(f"{DATA}/IDX_INDIAVIX.csv", index_col=0, parse_dates=True)
print("India VIX:", round(vix.Close.iloc[-1], 2))
# -> Nifty 22620.45 vs 200-DMA 24372.85 -> -7.19%
# -> Breadth: 7 of 37 stocks above their 200-DMA = 18.9%
# -> India VIX: 13.49

(b) Position size with the exposure cap

def position_size(capital, risk_pct, entry, stop, max_pos_pct=0.25):
    risk_rs = capital * risk_pct                 # e.g. 5,00,000 x 1% = 5,000
    per_share = entry - stop                     # rupees lost per share if stopped
    qty_risk = int(risk_rs // per_share)         # shares allowed by the risk budget
    qty_cap = int(capital * max_pos_pct // entry)   # shares allowed by the 25% exposure cap
    qty = min(qty_risk, qty_cap)
    return qty, qty * entry, qty * per_share

print(position_size(500_000, 0.01, 3762.00, 3651.45))   # TITAN
# -> (33, 124146.0, 3648.15...)

(c) Find Setup-1 bars on TITAN

import pandas as pd
from framework.indicators import ema   # EMA seeded with the first 20-day SMA, as in Chapter 4
d = pd.read_csv("data/ohlc/TITAN.csv", index_col=0, parse_dates=True)
d = d[d.Volume > 0]
d["EMA20"] = ema(d.Close, 20)
d["SMA50"] = d.Close.rolling(50).mean()
d["SMA200"] = d.Close.rolling(200).mean()
trend = (d.Close > d.SMA50) & (d.SMA50 > d.SMA200) & (d.SMA200 > d.SMA200.shift(20)) & (d.EMA20 > d.SMA50)
recent_high = d.High.rolling(50).max().rolling(10).max() <= d.High.rolling(10).max()
touch = d.Low <= d.EMA20 * 1.005
print(d[trend & recent_high & touch].loc["2025-10":"2025-11", ["Open", "High", "Low", "Close", "EMA20"]].round(2))
# -> 2025-11-03 3730.0 3762.0 3667.3 3724.5 3660.53   (our example's setup bar)
# -> 2025-11-26 ... (a second touch while already in the trade)

(d) Expectancy of a setup from the trade log

import pandas as pd
t = pd.read_csv("data/extra/ch05_trades.csv")
s4 = t[t.setup == "S4"]
win = (s4.R_net > 0).mean()
avg_win = s4.R_net[s4.R_net > 0].mean()
avg_loss = s4.R_net[s4.R_net <= 0].mean()
print(f"trades {len(s4)}  win {win:.1%}  avg win {avg_win:.2f}R  avg loss {avg_loss:.2f}R  "
      f"expectancy {win*avg_win + (1-win)*avg_loss:+.3f}R")
print(s4.groupby("regime_up").R_net.agg(["count", "mean"]).round(3))
# -> trades 696  win 41.4%  avg win 2.06R  avg loss -0.95R  expectancy +0.293R

The full engine (all four setups, the simulator and every figure) is in course/scripts/ch05_lib.py and course/scripts/ch05_figures.py. Change a rule there, re-run, and see how the statistics move. That is the first step toward building your own system in Chapter 12 and Chapter 17.

20. Pre-trade checklist

Print this. Every box must be ticked before a buy GTT is placed.

21. Key takeaways

Key takeaways

22. Quiz and exercises

Q1. Your account is Rs 5,00,000 and you risk 1% per trade. A Setup-1 trigger is at 1,250 and the stop at 1,212. How many shares do you buy, with the 25% exposure cap?
Risk budget = Rs 5,000. Per-share risk = 1,250 − 1,212 = 38. \(Q_{\text{risk}} = \lfloor 5000/38 \rfloor = 131\). \(Q_{\text{cap}} = \lfloor 1{,}25{,}000/1{,}250\rfloor = 100\). Buy 100 shares (Rs 1,25,000), actual risk 100 × 38 = Rs 3,800 (0.76%).
Q2. Nifty is 2% above its 200-DMA, but the 200-DMA is falling and only 35% of your universe is above its own 200-DMA. VIX is 20. What does the playbook say?
Nifty is above the 200-DMA, but the slope condition fails and breadth (35%) is below 50%, so two of the three risk-on conditions fail. It is not formally risk-off either, because Nifty is still above its 200-DMA. So it falls in the Mixed row, at its weak end: at most 0.5% risk, leaders only. VIX > 18 halves that again, to about 0.25%. Many traders would simply wait.
Q3. You bought at 500 with a stop at 480. You sold half at 540 and the rest at 520. What is the gross R-multiple?
\(R = 500-480 = 20\). First half: (540 − 500)/20 = +2.0R. Second half: (520 − 500)/20 = +1.0R. Weighted: 0.5 × 2.0 + 0.5 × 1.0 = +1.5R before costs.
Q4. A setup has a 40% win rate, average win +2.0R and average loss −1.0R. What is its expectancy, and how many losses in a row should you be prepared for?
\(E = 0.4\times2.0 + 0.6\times(-1.0) = +0.2R\) per trade. A run of 10 losses has probability \(0.6^{10}\approx 0.6\%\) at any given starting point, but over hundreds of trades long streaks become likely. Our 40%-win setups had streaks of 12-16. Plan for it.
Q5. Why did the AXISBANK pullback (Feb 2026) lose 1.67R gross instead of 1R?
On 9 Mar 2026 the stock opened at 1,282.2, below the stop of 1,308.06 (the previous close was 1,315.8). A stop can only fill at the market price after a gap: (1,282.2 − 1,346.5)/38.44 = −1.67R. Stops limit losses during the session, not across gaps.
Q6. Using the Varsity checklist, a hammer forms with its low at 980. The nearest support (a prior swing low) is at 1,025. Should you take it?
The stop goes near the pattern low (~980). Support at 1,025 is (1,025 − 980)/980 ≈ 4.6% away from the stop, more than Varsity's 4% limit. The level that is supposed to protect the trade isn't near the stop. Skip. (Also check that the prior trend was down and volume ≥ the 10-day average.)
Q7. A Setup-3 candidate: trigger 820, stop 800, nearest resistance 845. Take it?
RRR = (845 − 820)/(820 − 800) = 25/20 = 1.25 < 1.5. No: the reward doesn't justify the risk under the checklist.
Q8. In the backtest, S1 trades held over a results date averaged +1.25R vs −0.25R for the others. Should you hold all trades through results?
No. It's a selection effect: losing trades are usually stopped out within days, before results arrive, so only trades that were already winning survive to a results date. Results windows actually carry much larger gap risk (gaps >3% about 5× as often as ordinary two-day windows). The sensible policy is to hold through results only when the trade is already de-risked (partial booked, stop at breakeven), or at reduced size.
Q9. Compute the 3-month relative strength of a sector that went from 10,000 to 10,450 while Nifty went from 24,000 to 23,280.
Sector return = 10,450/10,000 − 1 = +4.5%. Nifty return = 23,280/24,000 − 1 = −3.0%. RS = 4.5 − (−3.0) = +7.5 percentage points.
Q10. Your sell GTT has trigger 900 and limit 897. The stock closes at 905 and opens next day at 860 on bad news. What happens, and what should you do?
The trigger fires (LTP below 900) and a limit sell at 897 goes to the exchange. With the price at 860, a limit of 897 won't fill: the order sits unexecuted while the stock trades lower. If it is still unfilled at the close it is cancelled, and the GTT does not fire again. You must check positions after the open on gap days and exit manually (market or a realistic limit), accepting a loss bigger than 1R. A stop GTT set to market-with-protection would most likely have sold near 860, which is also worse than 1R, but at least you'd be out. This is why position size and event awareness matter more than the stop order itself.
Q11. Exercise: list three things the 2017-2026 statistics can't tell you about how these setups will do in 2027.
(1) Whether today's large caps will behave like 2017-2026 survivors (survivorship bias). (2) The future regime mix: if 2027 looks like 2025-26, trend setups may lose. (3) Your real execution: GTT limit fills, slippage, missed trades and rule-breaks under stress. Also: taxes, and the small sample for S3.
Q12. Exercise: using course/scripts/ch05_lib.py, change Setup 2's volume rule from 1.5× to 2.0× and re-run. What do you expect to happen to the number of trades and the win rate, and why?
Fewer trades (the filter is stricter). The win rate and average R may improve, because only higher-conviction breakouts remain, but they may not, and a smaller sample is noisier. Run it, record the result in your journal of system tests, and resist adopting a change unless it improves results across sub-periods (2017-20, 2021-23, 2024-26), not just overall.

23. Sources

Zerodha Varsity (concepts explained in our own words): Module 2, ch. 19 "The Finale – Helping you get started" (timeframe, lookback, opportunity universe, two-part scan, trading checklist) · Module 2, ch. 11 Support and Resistance · Module 2, ch. 12 Volumes · Module 2, ch. 13 Moving Averages · Module 2, ch. 17-18 Dow Theory · Module 9, ch. 11 Position Sizing for active traders · Module 9, ch. 12 (equity models) · Module 9, ch. 13 (unit, margin and volatility sizing) · Module 9, ch. 6 Equity Curve · Module 9, ch. 15 Trading Biases · Module 9, ch. 16 Trading Biases (Part 2) · Module 10, ch. 1 What to expect (definition of a trading system) · Module 10, Momentum Portfolios.
Rules and rates (checked Oct 2026): Zerodha charges (delivery STT 0.1% each side, NSE txn 0.00307%, stamp 0.015%, DP Rs 15.34) · Zerodha: Introducing GTT · Zerodha Support: What is a GTT order (limits, validity, corporate actions) · Value Research: STCG/LTCG FY 2026-27 · ClearTax: STT rates after Budget 2026 · NSE circular: live trading session on 1 Feb 2026 (Budget day) · SEBI: LODR timelines for financial results.
Data: daily OHLCV for 37 NSE stocks, Nifty 50 and India VIX (NSE via Yahoo Finance, to 30 Sep 2026); NSE ind_close_all index files for 30 Sep 2025, 30 Mar, 30 Jun, 31 Aug and 30 Sep 2026 (data/extra/); quarterly results dates from Yahoo Finance via yfinance (data/extra/ch05_earnings_dates.csv). All statistics, trade logs and figures: course/scripts/ch05_figures.py + ch05_lib.py, outputs in data/extra/ch05_trades.csv and data/extra/ch05_results.json.

← PreviousTechnical IndicatorsNext →Reading Financial Statements