Phase 9 · Portfolio Construction, Risk & Investment Process · Week 72 · ~16 focused hours · Mastery gate ≥ 85%
Two hundred and seventy-five sessions in the market, five round trips, ₹2,900.86 of statutory charges, and a final result 46.66 percentage points behind simply owning the share. That is what the most-quoted rule in the whole toolkit, the fifty-day average crossing the two-hundred-day average, did to ₹3,00,000 on the price series you will work through in the first worked example. It did not even buy the protection it advertises. Holding the stock through the decline cost 35.24% peak to trough; obeying the rule cost 38.76%, because the rule sold near the low, waited, and bought back higher.
That result is not a trick and it is not cherry-picked against the technique. It is the ordinary outcome of a trend rule in a market that trends upward, and the arithmetic behind it is worth having at your fingertips before anyone shows you a chart with two lines crossing on it.
Advertisement
Now the opposite fact. In the eight sessions before a broad Indian index made its high, the index rose 1.77%. Over the same stretch the cumulative advance-decline line fell by 1,849 net issues, the count of stocks at new highs dropped from 71 to 41, and the new-high-minus-new-low spread went from plus 42 to minus 28.
The index was still going up. Almost nothing in it was.
Breadth is the part of this toolkit with a defensible evidence base, and it is the part almost nobody quoting a chart pattern bothers to compute.
So the honest position is neither dismissal nor enthusiasm. Some of what sits under the heading "technical analysis" is arithmetic on public data that any analyst should be able to do: an average, a ratio, a count of advancing issues, a delivery percentage, a stack of open interest. Some of it is a genuine, documented return anomaly that the quantitative galaxy studies properly as a factor. And a large part of it is pattern-naming with no falsifiable content at all, taught by people who have never computed a deflated Sharpe ratio and would not enjoy the answer.
You are going to build all three parts by hand. Every indicator is computed from raw closes with a calculator or ten lines of Python, never taken from a platform's menu, because an indicator you cannot reproduce is an indicator you cannot audit. You will price a moving-average rule in rupees, compute a relative strength index and a moving average convergence divergence line for ten sessions without software, and find four bearish divergences in an index series. Then you will backtest the rule they suggest and watch a 3.62 annualised Sharpe ratio turn into a 0.42 out of sample, with a deflated Sharpe of 0.6886 that fails at any bar you would act on.
There is a reason a value-first programme spends sixteen hours here rather than a dismissive paragraph. The person on the other side of your limit order is very often looking at a chart. When a widely-watched line breaks, other people's stops fire, and their forced selling is your opportunity or your problem depending on whether you knew the line was there. Knowing what the crowd is watching is not the same as believing it, and the whole practical value of this material sits in that gap.
One rule governs everything below, and it will be repeated at the end because it is the only thing here you must never trade away. No chart pattern changes an intrinsic value. A chart can change when you buy, how you size, and what you expect the other side to do.
It cannot change what a business is worth.
Learning objectives
By the end you can:
- State what technical analysis claims, summarise what the empirical record supports and what it does not, and give three defensible reasons a fundamental analyst learns it anyway.
- Construct and read line, bar, candlestick and point-and-figure charts from the same closes, and demonstrate numerically how a linear scale and a logarithmic scale lead to different conclusions about the same series.
- Draw trend, support and resistance from a real price series, apply the change-of-polarity principle, and say precisely why a trendline is a hypothesis rather than a measurement.
- Compute a measured-move target from a head-and-shoulders pattern under both projection conventions, price the trade against a stated stop, and produce the break-even hit rate the pattern needs to pay.
- Compute simple and exponential moving averages by hand, mark every crossover on a long series, and price the whipsaws in currency using a stated transaction-cost stack.
- Compute the relative strength index with Wilder smoothing, the moving average convergence divergence line with its signal and histogram, and the stochastic oscillator, all by hand, and identify divergence with its confirmation lag stated.
- Build an advance-decline line and a new-high-minus-new-low spread, read a breadth divergence against an index top, and explain why breadth carries more evidential weight than single-price patterns.
- Name the measurement problem in each of the common sentiment series, and read the price-and-open-interest four-cell table on Indian derivatives data.
- Apply the multiple-testing critique to any indicator rule: count the configurations tried, compute the expected maximum Sharpe under the null, deflate the observed one, and state the verdict.
- Read an Indian chart correctly through circuit bands, delivery percentage and open interest, and decide what to keep from this toolkit and what to discard.
Prerequisites & connections
Builds on. M9.02 supplies the efficient-markets frame and the active-versus-passive argument, including the weak-form claim that this node then tests against real arithmetic; it also supplies the honest position on factor investing that the momentum discussion here leans on. M0.02 supplies market microstructure: the order book, the price bands, the market-wide circuit breakers, and the transaction-cost stack. M0.04 supplies the contract note whose rate card prices every trade below: STT, stamp duty, exchange and SEBI charges, GST and the depository fee. It also supplies the finding that an Indian delivery round trip costs about 0.2327% of capital against about 0.0530% in the US. M6.04 supplies anchoring and recency, which are what a support level and a chart pattern are made of. QM1.02 supplies hypothesis testing, regression and the multiple-comparisons problem; QM1.04 supplies the sampling distribution of a Sharpe ratio, which is what makes deflation possible at all. M9.01 supplies position sizing and the stop arithmetic used in the practice set.
Feeds forward. M9.03 takes the sell decision, where a price stop and a thesis stop have to be told apart, and the failure mode of selling a good business because a line broke belongs there. M9.04 wires the surviving pieces into a written process. QD1.02 constructs the momentum factor properly, in code, as a cross-sectional ranking device. QD1.03 owns the backtesting engine, the trial-counting discipline and the deflated Sharpe machinery, which this node applies rather than derives. QD2.01 owns execution and the order types you would actually use once a chart has told you when.
Five neighbours own material this node deliberately leaves alone. M9.02 owns market efficiency, the Sharpe arithmetic of active management, the SPIVA record and the factor tour, and it keeps its sceptical stance; nothing here restates that argument. M0.02 owns the order book, the auction mechanics and the settlement chain; only the chart-distorting consequences of circuit bands appear here. QD1.02 owns factor construction, the information coefficient and the twelve-minus-one momentum recipe; the relative-strength section here explains how a bilateral ratio differs from a cross-sectional rank and stops there. QD1.03 owns backtest construction, look-ahead harnesses and the deflated Sharpe derivation; here the formula is quoted with its source and applied once. M6.04 owns the behavioural mechanisms; this node names them where they explain why a level holds and moves on.
Core teaching content
Does technical analysis work?
Technical analysis tries to forecast prices from past prices and volumes alone, starting from the idea that price already reflects everything known and that trends tend to continue. The parts with a real record are momentum, where recent winners keep winning over three to twelve months, and breadth statistics, which have a respectable if noisy record as risk indicators. Most named chart patterns and oscillator thresholds have either failed careful testing or were never specified precisely enough to test.
4 min read, on its own page
Types of stock charts
A stock chart can draw the same price data in four ways (line, bar, candlestick and point-and-figure), and each one discards something different. The scale question is the one that changes conclusions rather than appearances. On a logarithmic axis equal distances mean equal percentage changes, so steady growth looks steady, while a linear axis makes it look like acceleration. For any series longer than about a year, the log scale is the honest default.
3 min read, on its own page
Support and resistance
Support is a price region where buying has previously been sufficient to stop a decline; resistance is where selling has been sufficient to stop a rise. Once a resistance level is broken decisively, it tends to act as support on the way back down, because the population holding a position there has changed sides. Trend and support are useful precisely to the extent that they are shared.
3 min read, on its own page
Head and shoulders pattern
The head and shoulders is the canonical reversal and the only one worth learning to compute carefully, because everything else follows the same arithmetic. It is three peaks, the middle one highest, with the two troughs between them joined by a line called the neckline. The pattern is not a pattern until the price closes below that neckline, and the measured move is the depth of the pattern projected down from the break.
3 min read, on its own page
Moving average crossover
The crossover rule is the most quoted mechanical rule in the business: hold the asset while the fast average is above the slow one, stand aside otherwise. Fifty and two hundred sessions are the conventional lengths, and the crossings have names, the golden cross upward and the death cross downward, that do a lot of work in headlines and none in arithmetic. When the averages converge, the crossover rule stops being a trend filter and becomes a coin, and it charges you every time the coin lands.
4 min read, on its own page
RSI indicator
The relative strength index (RSI) is an oscillator that compares recent average gains with recent average losses and maps the result onto a bounded scale. The conventional thresholds are 70 for overbought and 30 for oversold, and they are where most of the damage is done. In a strong trend the index pins above 70 for weeks, and selling every reading above 70 in a rising market is a reliable way to sell early and often.
4 min read, on its own page
Market breadth indicators
Market breadth indicators are statistics computed across many stocks rather than from one price, so they show how widely a market move is shared. The advance-decline line, for example, is the running total of advancing issues minus declining issues. Breadth has the most defensible evidence base in technical analysis because it averages out single-stock noise and has few free parameters to curve-fit, the advance-decline line having none.
3 min read, on its own page
Market sentiment indicators
Sentiment indicators try to measure what participants feel rather than what prices did. Each of the standard ones has a specific measurement flaw, and knowing the flaw is more valuable than knowing the indicator. The put-call ratio divides the volume of put options by the volume of calls, on the theory that heavy put buying marks fear and therefore a bottom. Margin debt is the aggregate borrowing against securities, and it rises in bull markets because the collateral is worth more.
3 min read, on its own page
4.9 Cycles, and the falsifiability problem in Elliott wave
Claims of fixed-length market cycles run from the four-year presidential cycle in the United States through the decennial pattern to the long Kondratieff wave. The evidential problem is uniform across all of them: the number of complete observations is tiny. A fifty-year cycle observed over a century and a half gives you three cycles, which is not a sample from which anything can be estimated.
Genuine economic cycles do exist, in credit, in inventories and in capital spending, and they are studied properly in the macro sequence with data and mechanisms rather than by counting peaks on a chart. That distinction is the whole of the difference between economics and cycle-drawing.
Ralph Nelson Elliott set out the wave principle in the 1930s and Robert Prechter popularised it. Markets move in a five-wave impulse along the larger trend, followed by a three-wave correction; the structure is self-similar across degrees of scale; and the retracements cluster at Fibonacci ratios.
The problem is not that it is wrong. The problem is that it cannot be wrong. If a count fails, the failure is absorbed by relabelling the waves at a different degree, by declaring an extension, or by invoking one of the several permitted corrective forms. A framework with a permitted reinterpretation for every possible outcome makes no prediction, and a claim no observation can contradict is not a claim about the world.
Say that once and spend your hours elsewhere. If someone shows you a wave count, the only useful question is what price would prove it wrong, and whether they will write that number down in advance.
4.10 Intermarket analysis and relative strength
Relative strength, in the technical sense, is a ratio line: the price of one thing divided by the price of another, plotted over time. A stock against its index, a sector against the market, one currency against another, gold against copper. A rising line means the numerator is outperforming, whatever both are doing in absolute terms.
The reading that catches people out is that a rising price and a falling relative strength line are perfectly compatible. In the tenth practice problem a stock rises 26.30% while its index rises 28.40%, so the ratio falls 1.6355%. Over the last two periods alone the stock gains 9.92% while the ratio falls 5.1455%. A holder looking only at the price sees a good position; a holder looking at the ratio sees capital that would have done better in the index.
Intermarket analysis extends this to relationships between asset classes, and the honest version of it is macroeconomics rather than chart-reading. Credit spreads widen before equity drawdowns because the same deterioration in expected cash flows shows up first where the claim is senior and the holders are professional. Industrial metals lead manufacturing output because they are an input. A steepening yield curve and bank equity move together because the curve is the industry's revenue model.
Each of these has a mechanism you can state, which is precisely what a pattern does not.
The distinction that matters for a programme with a quantitative galaxy attached: relative strength and the momentum factor are not the same object. Relative strength is bilateral and continuous, one name against one benchmark, read over time. The momentum factor is cross-sectional and periodic, a rank of every name in a universe at a single instant against every other name, rebalanced on a schedule, usually built as twelve-month return skipping the most recent month to avoid short-term reversal. They overlap, since a name with high relative strength usually ranks well on momentum.
But a relative-strength line has no universe, no rebalance rule, no skip and no turnover accounting, so it cannot be evaluated the way a factor can.
4.11 The statistical critique, and the one number that answers it
Everything in the previous sections shares a vulnerability, and it is not that the ideas are silly. It is that the space of possible rules is enormous and the data is one sample.
Count the space honestly for a single family. Take the relative strength index: choose a length from about 5 to 30, an overbought threshold from 65 to 85, an oversold threshold from 15 to 35, a holding period from 1 to 40 sessions, a universe, and a start date. That single indicator, with no divergence logic at all, offers hundreds of thousands of configurations before the universe and the start date are chosen. Now add the other indicator families, the parameter grids inside each, and the choice of which market and which decade to test on.
Somebody has tried most of them, and the ones that worked are the ones that got published.
Three specific failures produce most bad technical research.
Data mining across indicator space is the one just described. It is not fraud and it usually is not even conscious. It is what happens when many people search the same data and only the winners are written down.
Look-ahead in signal construction is subtler and more common in hand-drawn work than in code. A swing high needs a forward window to be identified. A trendline needs the points that came after it to be drawn. A pattern's neckline is fitted once you can see the head. Every one of those uses information from after the decision date, and every published chart annotated with arrows was drawn that way.
Selection of the exhibit is the third. A textbook shows the chart where the pattern worked. It is not a lie, exactly, but a picture chosen from a population by its outcome carries no evidence about the population.
The answer to all three is arithmetic borrowed from the backtesting node and applied without mercy. The best of N trials is an order statistic, not an estimate. Under a null of no skill, the expected maximum Sharpe ratio across N independent trials with dispersion sd is
E[max] = sd × [ (1 − γ)·Φ⁻¹(1 − 1/N) + γ·Φ⁻¹(1 − 1/(N·e)) ], γ = 0.5772156649
and the deflated Sharpe ratio of Bailey and López de Prado asks for the probability that the observed Sharpe exceeds that bar, given the sample length and the shape of the return distribution:
DSR = Φ((SR − SR₀)·√(T − 1) ÷ √(1 − γ₃·SR + (γ₄ − 1)/4·SR²))
Every Sharpe ratio in both formulas is per observation, so an annualised figure must be divided by the square root of 252 for daily data before it goes in. Mixing the units is the commonest error in applying this, and it is wrong by a factor of about sixteen.
Two calibration figures are worth memorising. With a grid dispersion of 0.06 per session, the expected maximum annualised Sharpe under the null is 1.8857 at 24 trials and 2.4708 at 120. So a strategy showing an annualised 1.42 over 504 sessions, chosen from 120 configurations, has a deflated Sharpe of 0.0692: it is worse than the bar its own search predicted. The same 1.42 reported as though only four configurations had been tried gives 0.7221.
The honest trial count moves the verdict by 65.29 percentage points of confidence, and it is the number most likely to be missing from any technical result you are shown.
{
"skill": "Testing an indicator rule you have been shown, before you believe it",
"use": "Have an assistant write the indicator, the signal rule and the backtest as three separately testable functions from your written specification, then have it run the same rule across the full parameter grid and log every configuration it tried, including the ones it discarded, so the trial count is a record rather than a memory.",
"tools": ["Chat assistants with code execution - Claude, ChatGPT, Gemini", "Python: pandas and NumPy for the indicator and the grid", "A spreadsheet for the hand recomputation of ten sessions"],
"prompt": "Here are 320 daily closes as a CSV. Write three separate functions: (1) rsi(closes, n) using Wilder smoothing, (2) swing_highs(closes, k) using a symmetric k-bar fractal, (3) a backtest that takes a signal series and returns per-session strategy returns. Then: sweep hold in {5,10,15,20,25,30}, k in {3,4,5,6,7} and RSI length in {7,9,14,21}, record EVERY configuration in a log with its in-sample Sharpe, and report the winner. Print the standard deviation of Sharpe across the grid and the number of configurations that produced a testable record. Do not reuse any out-of-sample data. State explicitly which sessions each signal could first have been known on.",
"verify": "Recompute the RSI and the MACD by hand for ten consecutive sessions from the raw closes and match the code to four decimals before you trust any of its output; the Wilder smoothing recursion and a simple mean are the pair a model most often confuses, and the difference is invisible in a plot. Then check the signal dates: assert that no signal fires earlier than k sessions after the swing high it depends on, and confirm the assertion fails when you deliberately remove the lag. Re-derive the deflated Sharpe yourself and check the units, because per-observation and annualised Sharpes are silently interchangeable in the formula and wrong by a factor of about sixteen. Trace every price to its source file with a date and a row count, and state the trial count as a number you logged rather than a number you remember.",
"diy": "You must be able to compute the relative strength index, the MACD line and its signal, and a moving-average crossover by hand on a short series, because the gate tests exactly that and because you cannot audit a backtest whose indicators you cannot reproduce. The judgement no tool supplies is the trial count: only you know how many variants you tried before this one, including the ones you tried last month and the ones the person who gave you the idea tried first.",
"market": "US"
}
4.12 What a fundamental analyst actually uses this for
Four uses survive, and all four are about execution and other people rather than about value.
The first is timing at the margin. You have done the work, the business is worth more than the price, and the position is going on. The chart does not change that decision. It can change the schedule: buying into a falling market in three tranches rather than one, or waiting for a widely-watched level to be tested before committing the last tranche. The improvement is small, and it is real only if you would have bought anyway.
The second is stop discipline, where one distinction does all the work. A price stop exits when the quote falls a stated amount; a thesis stop exits when a fact you underwrote turns out to be false. They are different instruments, and confusing them is expensive in both directions. For a concentrated fundamental position a price stop is usually wrong, because it converts a temporary quotation into a permanent loss for no reason connected to the business.
Where a price stop belongs is on a position taken for a reason a chart can invalidate, and in sizing. A ₹52.50 risk per share against a 0.75% risk budget on ₹12,00,000 gives 171 shares, a position of ₹1,30,729.50, or 10.89% of capital. An overnight gap overshoots that budget by 45.35%.
Third is reading liquidity. Volume, the bid-ask spread, delivery percentage and the depth of the book together tell you what size you can execute and what it will cost, which the transaction-cost work already taught you is often the larger half of the bill.
That is the least glamorous use here and probably the most valuable.
Last is knowing what the other side is watching: round numbers, prior highs, the two-hundred-day average, index reconstitution dates, derivative expiry, the circuit bands. When those levels break, orders fire mechanically and the resulting move has nothing to do with value. It is your opportunity if you have a valuation and they have a stop, and your problem if you are the one being stopped.
Circuit limits
Price limits that halt or restrict trading after a large move, applied both to individual securities and to the market as a whole. Individual stocks carry bands depending on the security, and those with derivatives have a flexing dynamic band. A stock locked at the lower circuit can't be sold at any price, and that's when a holder most wants to sell. A stock at its upper circuit has buyers and no sellers, so the last traded price is a ceiling rather than a clearing price.
4 min read, on its own page
4.14 The verdict, stated plainly
Keep five things.
Breadth, as a gauge of how much of the market is participating in a move, because it aggregates hundreds of series and has almost no parameters to tune. Relative strength as a screening ratio, provided you remember it is bilateral and not a factor. The two-hundred-day average and other widely-watched levels, not because the arithmetic is meaningful but because other people's orders sit there. Volume, delivery share and open interest as liquidity and commitment information, which is what they actually measure.
And the stop-and-sizing arithmetic, which is risk management wearing a technical costume.
Discard four.
Measured-move targets used as forecasts rather than as one leg of a distribution with a stated hit rate. Oscillator thresholds used as decisions, since the reading pins in exactly the conditions where you most want it to work. Wave counts and fixed-length cycles, because no observation can refute them. And any rule whose backtest you cannot deflate, which in practice means any rule whose author cannot tell you how many configurations were tried.
Then the rule that governs the lot. No chart pattern changes an intrinsic value. A chart can tell you what other participants are watching, what a position will cost to build, and when somebody else is being forced. If it ever tells you that a business is worth more or less than your own work says it is, the chart is not the thing that has gone wrong.
Common mistakes & how experts think differently
- Reading a chart drawn with hindsight as though it had been available at the time. Every annotated exhibit was drawn after the outcome. A swing high needs a five-session forward window to exist under the definition used here, so the divergence you can see was visible five sessions after the price it points at. Experts date every signal by the session it could first have been computed on, and treat any exhibit without such dating as decoration.
- Quoting a signal's success rate without a trial count. A 1.42 annualised Sharpe from 120 configurations deflates to 0.0692; the same number from four configurations gives 0.7221. Experts ask how many variants were tried before this one, count the discarded ones and the ones the person who handed them the idea tried, and treat the answer as the statistic that decides what the Sharpe means.
- Treating a moving-average crossover as free. Five round trips on ₹3,00,000 cost ₹2,900.86 in statutory charges alone, before spread and impact, and the rule finished 46.66 percentage points behind holding. Experts price the turnover from the actual rate card before evaluating the rule, and compute the break-even turnover a claimed edge can support, which for a 4.2% gross edge at the Indian delivery stack is 18.46 round trips a year.
- Believing the trend rule bought protection it did not deliver. The intuition that standing aside cuts drawdowns is strong and was false in the worked series, where the rule's peak-to-trough loss was 38.76% against buy-and-hold's 35.24%, because it sold near the low and rebought higher. Experts measure the drawdown of the rule's own equity curve rather than assuming the protection, and report both numbers.
- Fitting a filter to the whipsaws visible in the sample. A thirty-session minimum-holding filter removed one round trip from the worked series and cost ₹1,898.83. Experts treat every added parameter as one more trial in the deflation and expect an in-sample repair to fade out of sample.
- Reading a frozen Indian chart as a price chart. Five consecutive upper circuits produce a 27.6282% rise with almost no volume and five gaps that any pattern vocabulary will misread. Experts check whether the sessions on a chart actually cleared before computing anything on them, and flag the affected window.
- Taking a single measured-move target as the forecast. The two published projection conventions differ by 34.00 points, or 2.48%, on the same pattern. Experts state which projection they used, attach the stop, and convert the pair into a break-even hit rate, which for that trade is 16.3636%.
- Treating volume as directional. "More buyers than sellers" is arithmetically impossible, since every trade has both. Experts read volume as a measure of how many holders changed their minds and as liquidity information, and in India read delivery share alongside it while stating the caveat that algorithmic activity suppresses the ratio.
- Using a price stop where a thesis stop belongs. A price stop on a concentrated fundamental position converts a temporary quotation into a permanent loss for a reason unconnected to the business. Experts separate the two instruments explicitly, size the position so a stop is affordable, and note that a gap can overshoot the risk budget by 45.35% as it does in the practice set.
- Debating Elliott wave counts on the merits. A framework with a permitted reinterpretation for every outcome makes no prediction. Experts ask once what price would falsify the count and whether the number will be written down in advance, and spend the remaining hours on breadth.
Worked examples
Every figure below was computed in Python before it was written down, and the two price series are reproducible from the recipes stated. Companies and indices are synthetic. All Indian rate-card figures are illustrative for mid-2026 and must be verified against the current circulars.
Worked example 1: The 50/200 crossover, priced in rupees (India, ₹)
Sahyadri Ceramics (synthetic) has 800 daily closes from a geometric random walk seeded at 239, starting at ₹240.00 and rounded to the paisa. Four regimes: sessions 1 to 249 at a drift of +0.00090 per session and a daily volatility of 0.0130; 250 to 499 at zero drift and 0.0175; 500 to 619 at −0.00150 and 0.0210; 620 to 799 at +0.00115 and 0.0150. The series runs from ₹240.00 to ₹435.08, a rise of 81.28%, at an annualised volatility of 25.94%, with a high of ₹438.39 at session 798 and a low of ₹219.25 at session 654.
Hold ₹3,00,000. Go long when the 50-session simple average is above the 200-session average and stand aside otherwise, reading the signal at the close of session t and filling at the close of session t+1. Charge the Indian delivery rate card on every fill. STT 0.10% each side, exchange 0.00297% each side, SEBI 0.0001% each side, stamp duty 0.015% on the buy only, a ₹13.50 depository charge on the sell, GST at 18% on the exchange, SEBI and depository lines, brokerage zero.
Solution. Step 1, the cost function. The proportional buy rate is 0.0010 + 0.0000297 + 0.000001 + 0.00015 + 0.18 × (0.0000297 + 0.000001) = 0.001186226, or 0.118623%. The sell rate is the same without stamp duty, 0.001036226, plus a flat ₹15.93 for the depository charge with its GST. Tie it out against the programme's own contract note: a ₹3,00,000 buy costs ₹355.87, a ₹3,15,000 sell costs ₹342.34, and the round trip is ₹698.21, or 0.2327% of the capital committed.
Both figures match to the paisa.
Step 2, where the rule starts. The 200-session average first exists at session 199, where the 50-session average stands at 289.1230 against 277.5195. The fast average is already above the slow one, so the rule opens long at the session-200 close of ₹282.76 without any crossover having occurred. This is not a detail: a backtest that only counts trades after the first crossing silently starts flat and gets a different answer.
Step 3, the eight crossovers.
| Session | Type | Close | SMA50 | SMA200 | Gap |
|---|---|---|---|---|---|
| 332 | death | 279.39 | 297.1986 | 297.8275 | −0.6289 |
| 453 | golden | 309.72 | 293.2420 | 293.1715 | +0.0705 |
| 510 | death | 238.92 | 285.3680 | 286.3493 | −0.9813 |
| 577 | golden | 286.31 | 283.2188 | 283.0761 | +0.1427 |
| 588 | death | 280.14 | 283.6928 | 283.7984 | −0.1056 |
| 591 | golden | 282.31 | 283.7794 | 283.7021 | +0.0773 |
| 593 | death | 272.85 | 283.4982 | 283.5749 | −0.0767 |
| 726 | golden | 299.77 | 267.8566 | 267.5824 | +0.2742 |
The gaps between consecutive crossings are 121, 57, 67, 11, 3, 2 and 133 sessions. Three crossings, at 577, 588 and 591, were reversed inside thirty sessions.
Step 4, the five round trips.
| # | In | Price in | Out | Price out | Held | Gross ₹ | Costs ₹ | Net ₹ |
|---|---|---|---|---|---|---|---|---|
| 1 | 200 | 282.76 | 333 | 278.64 | 133 | −4,366.02 | 677.35 | −5,043.37 |
| 2 | 454 | 307.61 | 511 | 235.41 | 57 | −69,148.07 | 599.03 | −69,747.09 |
| 3 | 578 | 291.85 | 589 | 281.64 | 11 | −7,869.33 | 507.70 | −8,377.03 |
| 4 | 592 | 271.49 | 594 | 279.80 | 2 | +6,629.13 | 504.13 | +6,125.00 |
| 5 | 727 | 301.90 | 799 | 435.08 | 72 | +98,238.82 | 612.65 | +97,626.17 |
Three of five lost money. Total charges ₹2,900.86, which is 0.9670% of capital.
Step 5, the scorecard. The rule finishes at ₹3,20,583.67, a return of +6.86%. Buying at the same session-200 fill and holding to the last close finishes at ₹4,60,566.40, or +53.52%. The shortfall is ₹1,39,982.73, or 46.66 percentage points. Before costs the rule would have returned +8.09%, so the cost drag including its compounding effect is ₹3,685.54, and the remaining 45.43 points of shortfall is pure opportunity cost from being out of the market for 324 of the 599 sessions in the window.
Step 6, the whipsaws, priced. The two round trips held thirty sessions or fewer paid ₹1,011.83 in charges and lost ₹2,252.03 between them. The reason they happened is visible in the averages: across the 601-session window the two lines were within half a percent of each other on 38 sessions, and 23 of those 38 fell in the sixty sessions from 560 to 619. A crossover rule inside a converged pair is a coin that charges an entry fee.
Step 7, the two independent checks. First, the protection check. Buy-and-hold's worst peak-to-trough loss over the window was −35.24%, with the trough at session 654. The rule's own equity curve fell −38.76%, with its trough at session 584. The rule did not reduce the drawdown; it deepened it, by selling at session 511 near ₹235.41 and not rebuying until session 727 at ₹301.90, having taken one further loss in between. Second, the filter check. Refusing any reversal inside thirty sessions removes one round trip and finishes at +6.23%, which is ₹1,898.83 worse than the unfiltered rule.
Read it. This is one path of one synthetic series, so the specific shortfall is not an estimate of anything. What generalises is the structure. A trend rule is long an option and pays the premium in turnover and in absent days, and in a series that rises 81.28% overall, being out of the market 54% of the time is a large premium. The result that should stay with you is the protection check. The intuition that standing aside must reduce drawdowns is so strong that almost nobody measures it, and here it was false.
Report the rule's own drawdown, always, and never the price series' drawdown as a proxy for it.
Worked example 2: RSI and MACD by hand, ten sessions (US, $)
The Ridgeline 500 (synthetic index) has 320 daily closes, seeded at 728, starting at 4,200.00, with a decelerating rally to session 209 (drift 0.00135 × (1 − t/230), volatility 0.0075 + 0.0035 × t/210), a decline from 210 to 264 at −0.00170 drift and 0.0140 volatility, then a recovery at +0.00090 and 0.0105. It peaks at 4,592.89 at session 210, bottoms at 3,693.71 at session 251, a fall of 19.58%, and ends at 4,490.29.
Compute the 14-session relative strength index with Wilder smoothing and the 12/26/9 MACD for sessions 205 to 214.
Solution. Step 1, the ten sessions in full.
| t | Close | Change | Avg gain | Avg loss | RS | RSI | EMA12 | EMA26 | MACD | Signal | Hist |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 205 | 4,459.14 | −51.68 | 20.6777 | 19.3941 | 1.0662 | 51.60 | 4,483.5222 | 4,444.9176 | 38.6046 | 42.8309 | −4.2263 |
| 206 | 4,442.23 | −16.91 | 19.2007 | 19.2166 | 0.9992 | 49.98 | 4,477.1696 | 4,444.7185 | 32.4510 | 40.7549 | −8.3039 |
| 207 | 4,463.71 | +21.48 | 19.3635 | 17.8440 | 1.0852 | 52.04 | 4,475.0989 | 4,446.1253 | 28.9736 | 38.3987 | −9.4251 |
| 208 | 4,466.87 | +3.16 | 18.2061 | 16.5695 | 1.0988 | 52.35 | 4,473.8329 | 4,447.6619 | 26.1709 | 35.9531 | −9.7822 |
| 209 | 4,492.38 | +25.51 | 18.7278 | 15.3859 | 1.2172 | 54.90 | 4,476.6863 | 4,450.9744 | 25.7119 | 33.9049 | −8.1930 |
| 210 | 4,592.89 | +100.51 | 24.5694 | 14.2869 | 1.7197 | 63.23 | 4,494.5638 | 4,461.4867 | 33.0771 | 33.7393 | −0.6622 |
| 211 | 4,368.36 | −224.53 | 22.8144 | 29.3043 | 0.7785 | 43.77 | 4,475.1478 | 4,454.5884 | 20.5594 | 31.1033 | −10.5439 |
| 212 | 4,275.04 | −93.32 | 21.1848 | 33.8768 | 0.6253 | 38.47 | 4,444.3620 | 4,441.2885 | 3.0735 | 25.4974 | −22.4239 |
| 213 | 4,283.67 | +8.63 | 20.2881 | 31.4571 | 0.6449 | 39.21 | 4,419.6402 | 4,429.6131 | −9.9729 | 18.4033 | −28.3762 |
| 214 | 4,189.68 | −93.99 | 18.8389 | 35.9237 | 0.5244 | 34.40 | 4,384.2617 | 4,411.8402 | −27.5786 | 9.2069 | −36.7855 |
Step 2, reproduce one row by hand. Take session 211. The previous average gain was 24.5694 and the previous average loss 14.2869. Session 211 fell 224.53, so today's gain is 0 and today's loss is 224.53. Wilder's recursion gives an average gain of (24.5694 × 13 + 0) ÷ 14 = 22.8144 and an average loss of (14.2869 × 13 + 224.53) ÷ 14 = 29.3043. RS is 22.8144 ÷ 29.3043 = 0.7785, and RSI is 100 − 100 ÷ 1.7785 = 43.77. A single session took the reading from 63.23 to 43.77.
Step 3, the MACD signal and its timing. The histogram is already negative at session 205, so the MACD line crossed below its signal on or before that session, which is the standard sell trigger. The index then rose a further +3.00% to its peak at session 210 before turning. Anyone acting on the crossover spent five sessions being wrong by three percent.
Followed all the way, the index sat −17.17% below the signal price at the session-251 low, and the MACD line only crossed back above its signal at session 235, with the index at 4,055.26, which is 11.71% below the peak and 9.79% above the low.
Step 4, the relative strength index at the top. The index made successive highs at sessions 192 (4,554.00), 202 (4,586.73) and 210 (4,592.89), with RSI readings of 69.52, 65.29 and 63.23. Prices rose 0.72% and then 0.13%; the oscillator fell 4.23 and then 2.06 points.
Those are two bearish divergences, one after the other, ending at the exact high.
Read it. Two facts are doing all the work and neither is the picture. The Wilder recursion, not a simple average, is why a single 224.53-point session moves the reading nearly twenty points; a plain fourteen-session mean would have moved it far less, and anyone comparing an "RSI" from two platforms without checking the smoothing is comparing two different statistics. And the MACD's five sessions of being wrong before being right is the general case for every crossing rule.
The signal arrives where the averages meet, never at the extreme, so the entry is always worse than the picture makes it look.
Worked example 3: What the divergence rule was actually worth (US, $)
Take the divergence idea from Worked Example 2 and test it honestly. Rule: after a bearish divergence, hold a short position in the index for hold sessions; after a bullish one, hold a long position. Both signals are dated at the confirmation session, which is k sessions after the second swing extreme, so no future information enters, and the position goes on at the close after that. Split the 320 sessions at 60%, giving an in-sample window of sessions 1 to 191 and an out-of-sample window of 192 to 319.
Two details finish the specification, because a detector left loose is a detector two people will implement differently. A swing extreme must also turn, so a swing high has to close above the session before it as well as above the whole window. And the two extremes of a divergence must sit between 5 and 45 sessions apart, which rules out a pair too close together to be two separate pushes and a pair too far apart to be one episode.
Solution. Step 1, count the divergences on the whole series. Four bearish, at 34→40, 154→169, 192→202 and 202→210, and three bullish, at 100→115, 221→233 and 233→241. The last column measures the twenty sessions after the second extreme rather than after the confirmation date, which is the flattering way the result is normally presented and the reason Step 2 exists.
| Kind | From → to | Price | RSI | Next 20 sessions |
|---|---|---|---|---|
| bearish | 34 → 40 | 4,336.27 → 4,339.03 (+0.06%) | 69.58 → 66.89 | −5.48% |
| bearish | 154 → 169 | 4,373.94 → 4,384.15 (+0.23%) | 57.92 → 56.92 | +1.79% |
| bearish | 192 → 202 | 4,554.00 → 4,586.73 (+0.72%) | 69.52 → 65.29 | −11.89% |
| bearish | 202 → 210 | 4,586.73 → 4,592.89 (+0.13%) | 65.29 → 63.23 | −12.24% |
| bullish | 100 → 115 | 4,159.91 → 4,108.61 (−1.23%) | 36.05 → 37.54 | +5.69% |
| bullish | 221 → 233 | 3,987.36 → 3,875.60 (−2.80%) | 27.26 → 28.96 | −4.08% |
| bullish | 233 → 241 | 3,875.60 → 3,849.07 (−0.68%) | 28.96 → 34.44 | +2.31% |
Bearish signals averaged −6.95% over the following twenty sessions and were negative in three of four. Bullish signals averaged +1.30% and were positive in two of three. On this evidence the idea looks excellent, and the two divergences into the top look uncanny.
Step 2, search the parameter grid and record the count. Sweep the holding period over {5, 10, 15, 20, 25, 30}, the fractal width over {3, 4, 5, 6, 7} and the RSI length over {7, 9, 14, 21}. Of the 120 cells, 94 produced at least twenty in-sample sessions with a position on and a non-zero return dispersion. Across those 94, the in-sample per-session Sharpe ratio runs from −0.112432 to +0.228279, with a mean of 0.062615 and a standard deviation of 0.079392.
Step 3, the winner. Holding period 10, fractal width 4, RSI length 7. Its in-sample Sharpe is 0.228279 per session, which annualises to 3.6238. Skewness 2.2225, kurtosis 14.2436, 191 observations, with a position on for 50 of them.
Step 4, out of sample. The same configuration on sessions 192 to 319 returns a per-session Sharpe of 0.026379, or 0.4188 annualised, with a position on for 36 of 128 sessions. The Sharpe fell by a factor of 8.65.
Step 5, deflate it. With N = 94 trials and a grid dispersion of 0.079392, the expected maximum under the null is
SR₀ = 0.079392 × [0.4227843 × Φ⁻¹(1 − 1/94) + 0.5772157 × Φ⁻¹(1 − 1/(94e))] = 0.199176 per session, which is 3.1618 annualised.
The winner beat that bar, but barely: 0.228279 against 0.199176. Feeding both into the deflated Sharpe with T = 191, skew 2.2225 and kurtosis 14.2436 gives a numerator of 0.401167, a denominator of 0.815585, and
DSR = Φ(0.491876) = 0.6886.
Step 6, the verification. Two independent checks. The winner sits 2.0867 standard deviations above the grid mean, which is close to what an extreme-value calculation predicts for the maximum of about ninety correlated draws, so nothing anomalous happened.
And the out-of-sample Sharpe of 0.4188 is exactly what a null result looks like at this sample size.
Read it. A 3.62 annualised Sharpe is the sort of number that ends arguments in a meeting. It came from a provably searched grid on a series generated with no signal in it whatsoever, and the expected maximum from that search alone was 3.16. The deflated Sharpe of 0.6886 fails at any bar you would act on, and it fails despite the winner beating the null bar, because beating a bar you set by searching is not evidence. None of this says divergence is worthless.
It says the test could not have told you either way, and a test that could not have told you either way is the normal output of an unrecorded search.
Worked example 4: A head and shoulders, both conventions and the failure (India, ₹)
Trisul Pharma (synthetic) forms a left shoulder at ₹1,842.00, a head at ₹1,968.00 on session 43, and a right shoulder at ₹1,851.00. The two neckline troughs are ₹1,704.00 at session 34 and ₹1,668.00 at session 52. The price closes below the neckline at session 60, at ₹1,646.00. A stop is placed at ₹1,700.00.
Solution. Step 1, the geometry. Shoulder symmetry is 9.00 points, or 0.49%, which is close enough that no textbook would reject the pattern. The neckline slope is (1,668.00 − 1,704.00) ÷ (52 − 34) = −2.000000 points per session. Extended to the head at session 43 it sits at 1,704.00 − 2.00 × 9 = ₹1,686.00; extended to the break at session 60 it sits at 1,704.00 − 2.00 × 26 = ₹1,652.00.
Step 2, the depth and the two targets. Depth = 1,968.00 − 1,686.00 = 282.00 points. Projected down from the break level: 1,652.00 − 282.00 = ₹1,370.00. Projected down from the neckline under the head: 1,686.00 − 282.00 = ₹1,404.00. The conventions differ by 34.00 points, which is 2.48% of the lower target. From the break close of ₹1,646.00 the lower target is a fall of 16.77%.
Step 3, price the trade. Short at ₹1,646.00, stop ₹1,700.00, target ₹1,370.00. Reward 276.00, risk 54.00, ratio 5.1111 to one. Break-even hit rate = 54 ÷ (276 + 54) = 16.3636%. Expected outcome per trade: +12.00 points at a 20% hit rate, +45.00 at 30%, +78.00 at 40%.
Step 4, the failure branch. The decline stops at ₹1,598.00, which is 48.00 points, or 17.02% of the measured move, then reverses and closes at ₹1,712.00, taking the stop. Best open profit 48.00 points, or 2.92%. Realised loss 66.00 points, or 4.01%. One full target would have paid for 5.11 such stops; this attempt produced 17.02% of one.
Read it. Every published criterion was satisfied. The direction was even briefly right. The trade still lost, and there is nothing there to explain away, because the break-even arithmetic had already told you to expect exactly that in 83.64% of outcomes. A pattern that pays at a 20% hit rate is a good pattern and will still lose four times in five. Anyone who cannot hold that sentence steady will abandon a positive-expectancy rule after three losses, which is the most common way this material destroys money.
Worked example 5: Breadth into an index top (India, ₹)
A broad Indian index (synthetic) over fifteen sessions, with advancing and declining issues and the counts of new 52-week highs and lows on the exchange.
Solution. Step 1, build the line.
| Session | Close | Adv | Dec | Net | A-D line | A/D | NH | NL | NH−NL |
|---|---|---|---|---|---|---|---|---|---|
| W1 Mon | 21,840.15 | 1,180 | 720 | +460 | +460 | 1.639 | 96 | 18 | +78 |
| W1 Tue | 21,902.60 | 1,120 | 782 | +338 | +798 | 1.432 | 88 | 21 | +67 |
| W1 Wed | 21,968.05 | 1,042 | 858 | +184 | +982 | 1.214 | 79 | 24 | +55 |
| W1 Thu | 22,011.40 | 980 | 921 | +59 | +1,041 | 1.064 | 71 | 29 | +42 |
| W1 Fri | 22,078.95 | 942 | 962 | −20 | +1,021 | 0.979 | 66 | 33 | +33 |
| W2 Mon | 22,140.30 | 905 | 998 | −93 | +928 | 0.907 | 61 | 38 | +23 |
| W2 Tue | 22,096.75 | 812 | 1,090 | −278 | +650 | 0.745 | 52 | 47 | +5 |
| W2 Wed | 22,186.50 | 878 | 1,024 | −146 | +504 | 0.857 | 58 | 44 | +14 |
| W2 Thu | 22,245.85 | 840 | 1,062 | −222 | +282 | 0.791 | 54 | 51 | +3 |
| W2 Fri | 22,301.20 | 796 | 1,106 | −310 | −28 | 0.720 | 49 | 58 | −9 |
| W3 Mon | 22,358.65 | 770 | 1,132 | −362 | −390 | 0.680 | 45 | 63 | −18 |
| W3 Tue | 22,402.10 | 742 | 1,160 | −418 | −808 | 0.640 | 41 | 69 | −28 |
| W3 Wed | 22,374.55 | 688 | 1,214 | −526 | −1,334 | 0.567 | 36 | 78 | −42 |
| W3 Thu | 22,289.30 | 604 | 1,298 | −694 | −2,028 | 0.465 | 28 | 96 | −68 |
| W3 Fri | 22,118.75 | 512 | 1,390 | −878 | −2,906 | 0.368 | 19 | 128 | −109 |
Step 2, date the divergence. The advance-decline line peaks at +1,041 on W1 Thu, the fourth session. The index peaks at 22,402.10 on W3 Tue, the twelfth. The divergence therefore runs eight sessions, during which the index gained +1.77% while the line fell by 1,849 net issues.
Step 3, the confirming series. New highs fell from 71 at the line's peak to 41 at the index peak, a drop of 42.3%. The new-high-minus-new-low spread went from +42 to −28, and reached −109 on the last session. The first session with more decliners than advancers was W1 Fri, seven sessions before the index high. Of the twelve sessions up to the index peak, eight had negative breadth.
Step 4, what happened. The index fell 1.26% from its high over the last three sessions, and on the final session 1,390 issues declined against 512 advancing. Holding the line flat that day would have required 1,390 advancers.
Read it. Nothing in the index's own price said anything was wrong; it made its high on the twelfth of fifteen sessions. Two independent breadth series, one built from daily direction and one from 52-week context, both turned down eight and seven sessions earlier, and they agreed. That agreement is the value: two statistics with no shared parameters pointing the same way is evidence in a way one chart pattern is not.
What it is not is a date. Eight sessions of narrowing preceded the turn here; in another episode it is thirty, or eighty, or none. Read it as a statement that the risk you carry has changed character, and size accordingly.
Worked example 6: Point and figure against the candlestick, same data (US, $)
Calder Instruments (synthetic) has fifty closes running from $412.40 to $456.90, ranging over $44.50. Build a point-and-figure chart with a $2.50 box and a three-box reversal, then read the same fifty closes as a bar chart, and compare the conclusions. The fifty closes, in order:
412.40 415.80 419.20 416.10 421.70 425.30 423.10 428.90 432.60 430.20
427.40 424.80 429.60 433.10 436.70 434.20 431.50 428.30 425.10 430.40
434.90 438.20 441.60 439.30 436.10 432.70 428.40 424.20 419.80 422.60
426.10 429.80 433.40 437.10 440.80 444.30 442.10 438.60 435.20 439.70
443.40 447.10 450.80 448.20 444.90 441.30 445.80 449.60 453.20 456.90
Solution. Step 1, the columns. A close belongs to box floor(price ÷ 2.50). Extend the current column while price makes a new box in its direction; reverse when it retraces three full boxes, starting the new column one box back from the old extreme.
| # | Direction | From session | Low | High | Boxes |
|---|---|---|---|---|---|
| 1 | X | 0 | 410.00 | 435.00 | 10 |
| 2 | O | 10 | 422.50 | 432.50 | 4 |
| 3 | X | 13 | 425.00 | 437.50 | 5 |
| 4 | O | 17 | 425.00 | 435.00 | 4 |
| 5 | X | 20 | 427.50 | 442.50 | 6 |
| 6 | O | 25 | 417.50 | 440.00 | 9 |
| 7 | X | 30 | 420.00 | 445.00 | 10 |
| 8 | O | 38 | 435.00 | 442.50 | 3 |
| 9 | X | 40 | 437.50 | 452.50 | 6 |
| 10 | O | 44 | 440.00 | 450.00 | 4 |
| 11 | X | 47 | 442.50 | 457.50 | 6 |
Eleven columns, six of X and five of O. 34 of the 49 day-on-day moves put ink on the chart and 15 did not, which is 30.6% of sessions discarded entirely. The bar chart draws fifty bars; this chart draws eleven columns, 78.0% fewer marks.
Step 2, the signals the chart generates. Successive X-column tops sit at 435.00, 437.50, 442.50, 445.00, 452.50 and 457.50, so each X column exceeded the previous one: five double-top buy signals. Successive O-column bottoms sit at 422.50, 425.00, 417.50, 435.00 and 440.00, giving one double-bottom sell signal, at column 6. The vertical count from the final six-box X column is 6 × 2.50 × 3 + 442.50 = $487.50, which is 6.70% above the last close.
Step 3, the same data as a bar chart. Net move +$44.50, or +10.79%. Twenty-eight up sessions against twenty-one down. Daily standard deviation 0.8184%, which annualises to 12.99%. The largest single-session fall is −1.04% at session 28. Three pullbacks are visible: $432.60 to $425.10 (−1.73%), $441.60 to $419.80 (−4.94%) and $450.80 to $441.30 (−2.11%).
Step 4, compare the conclusions. The bar chart says: a steady 10.79% advance at low volatility with three modest pullbacks, the largest of which was 4.94%. The point-and-figure chart says: an uninterrupted sequence of higher column tops with five buy signals, one sell signal, and a target of $487.50. Both are true. They disagree about emphasis because the point-and-figure chart compresses the 2.11% pullback into the four boxes of column 10 and would not have drawn it at all had it been slightly smaller. A three-box reversal needs $7.50, which at that price level is 1.66%, so a 2.11% move barely registers while a 1.50% move would vanish.
Read it. The box size is a free parameter and it sets the answer. Halve it and every one of those pullbacks becomes a column, the eleven columns become perhaps twenty, and the signal count changes completely. That is the general property of every filtered chart: what you are shown is a function of a parameter that the person showing you rarely states. Ask for the box size before you look at the picture, and if the answer is "the default", the chart is telling you about the software.
Worked example 7: Circuit bands, delivery share and open interest (India, ₹)
Three Indian data series that no Western chart carries, on a derivative-eligible stock closing at ₹486.30 on the first day.
Solution. Step 1, the bands. From ₹486.30 the daily limits are ₹461.99 to ₹510.62 on a 5% band, ₹437.67 to ₹534.93 on a 10% band, and ₹389.04 to ₹583.56 on a 20% band. Band eligibility, the dynamic band for derivative names, and the market-wide breaker levels are set by circular and change; verify before using any of them.
Step 2, what a frozen chart shows. Five consecutive upper circuits on a 5% band print ₹510.62, ₹536.15, ₹562.95, ₹591.10 and ₹620.66, a cumulative rise of 27.6282%. Almost nothing traded on any of the five sessions, so every one of those closes is a ceiling rather than a clearing price. A twenty-session simple average absorbing those five closes rises by 19.4985 points from them alone.
Every indicator computed on that window is computed on prices at which the book never cleared.
Step 3, delivery share over ten sessions.
| Day | Close ₹ | Volume | Delivery share | Delivered shares |
|---|---|---|---|---|
| D1 | 486.30 | 1,842,000 | 41.2% | 758,904 |
| D2 | 492.75 | 2,106,000 | 39.8% | 838,188 |
| D3 | 501.40 | 3,418,000 | 33.1% | 1,131,358 |
| D4 | 498.20 | 2,874,000 | 35.2% | 1,011,648 |
| D5 | 511.85 | 5,260,000 | 28.6% | 1,504,360 |
| D6 | 524.60 | 7,112,000 | 24.3% | 1,728,216 |
| D7 | 519.30 | 6,480,000 | 25.9% | 1,678,320 |
| D8 | 531.75 | 8,940,000 | 21.4% | 1,913,160 |
| D9 | 528.40 | 7,620,000 | 23.8% | 1,813,560 |
| D10 | 516.90 | 9,180,000 | 19.6% | 1,799,280 |
Mean delivery share falls from 35.58% across the first five sessions to 23.00% across the last five, a drop of 12.58 percentage points, while mean volume rises 153.75%. The price rises 6.29% over the ten sessions, peaking at ₹531.75 on D8 and ending 2.79% below that.
Step 4, decompose the volume before concluding anything. Delivered shares did rise, from 5,244,458 in the first five sessions to 8,932,536 in the last five, a gain of 70.32%. Non-delivery volume rose from 10,255,542 to 30,399,464, a gain of 196.42%. So the falling ratio is not people abandoning the stock; it is intraday activity growing nearly three times as fast as positioning.
That distinction is invisible in the percentage alone and it is the whole reason to compute both legs.
Step 5, open interest. At 8,460 contracts of 1,250 shares each against ₹528.40, notional open interest is ₹5,58,78,30,000, or ₹558.78 crore, representing 10,575,000 shares, which is 22.60% of a 46,800,000-share free float. Read the four cells against the price change. Price up with open interest up is a long build-up: session A, +2.4% and +18.2%. Price up with open interest down is short covering: B, +1.9% and −12.6%. Price down with open interest up is a short build-up: C, −3.1% and +21.4%. Price down with open interest down is long unwinding: D, −2.2% and −15.8%.
Read it. The four-cell table is the only reading in this entire node that distinguishes new commitment from position closing, and it does so because open interest is a stock rather than a flow. That is a genuine informational advantage over any price chart, and it exists only because the exchange publishes the number. Two cautions travel with it. Lot sizes are revised by circular, so a contract count means nothing until you have the current lot. And during a ban period, when a stock breaches its market-wide position limit and only offsetting trades are allowed, both open interest and price are distorted.
An indicator computed through that window should be discarded rather than explained.
Verify block
Every headline figure, at the precision the computation produced.
India series, 800 closes, seed 239, start ₹240.00: last close 435.0800000000, 50-session average at session 799 379.0908000000, 200-session average 295.9466000000, crossovers 8, round trips 5, strategy final value 320,583.6715387708, buy-and-hold final value 460,566.4026207107. Buy rate 0.001186226000, sell rate 0.001036226000 plus ₹15.93.
US series, 320 closes, seed 728, start 4,200.00: last close 4,490.2900000000, RSI-14 at session 210 63.2313868354, MACD line at 210 33.0771214172, signal 33.7393197434, histogram −0.6621983262. Grid trials 94, grid Sharpe dispersion 0.079392, expected maximum 0.199176 per session, in-sample Sharpe 0.228279, deflated Sharpe 0.6886.
Head and shoulders: neckline at break 1,652.0000, depth 282.0000, targets 1,370.0000 and 1,404.0000, reward-to-risk 5.1111, break-even hit rate 16.3636%.
Breadth: line peak +1,041, index peak 22,402.10, divergence 8 sessions, line change −1,849.
Point and figure: 11 columns, 34 of 49 sessions drawing, vertical count 487.50.
Practice set
Work each problem before reading its solution. A calculator is assumed and no software is needed. Unless a problem says otherwise, answers within 0.5% of the stated figure count as correct; where a problem asks for a count or a signal, the answer is exact. Indian charges use the same illustrative rate card as the worked examples, which must be verified against current circulars before any real use.
P1 (guided). Simple against exponential, on ten closes. The closes are 102.40, 103.10, 101.80, 104.60, 106.20, 105.40, 107.90, 109.30, 108.10, 110.60. Compute the five-session simple average at closes 5, 6 and 10. Then seed a five-session exponential average on the first simple average and roll it forward to close 10. State the gap between the two at close 10 and say which one turned faster.
Solution. Simple average at close 5 = (102.40 + 103.10 + 101.80 + 104.60 + 106.20) ÷ 5 = 103.6200. At close 6, drop 102.40 and add 105.40: 104.2200. At close 10, the mean of the last five (105.40, 107.90, 109.30, 108.10, 110.60) = 108.2600. Exponential with k = 2 ÷ 6 = 0.333333, seeded at 103.6200: close 6 gives 105.40 × 0.333333 + 103.6200 × 0.666667 = 104.2133, then 105.4422, 106.7281, 107.1854, 108.3236. The gap at close 10 is +0.0636 in favour of the exponential average, which turned faster because it weights the most recent close at a third rather than a fifth. Note the mechanism on the simple average too: the close dropping out at position 5 was 106.20 and the one arriving was 110.60, so that single swap moved the average by (110.60 − 106.20) ÷ 5 = +0.8800.
P2 (guided). The relative strength index, and its asymmetry. A 14-session Wilder average gain of 1.8640 and average loss of 0.9925. Compute RS and RSI. Then compute the RSI after one further session that rises 2.30, and separately after one that falls 3.10, and state the swing between the two.
Solution. RS = 1.8640 ÷ 0.9925 = 1.878086; RSI = 100 − 100 ÷ 2.878086 = 65.2547. After a session up 2.30: average gain = (1.8640 × 13 + 2.30) ÷ 14 = 1.895143, average loss = (0.9925 × 13 + 0) ÷ 14 = 0.921607, RSI = 67.2812. After a session down 3.10 instead: average gain = 1.730857, average loss = 1.143036, RSI = 60.2269. The swing is 7.0543 RSI points from a 5.40-point difference in one session's close, which is why an oscillator reading must always be dated and never compared across platforms without confirming the smoothing convention.
P3 (guided). The MACD histogram, and where it flips. A stock's 12-session exponential average is ₹1,846.20, its 26-session average is ₹1,802.75, and yesterday's signal line was 38.40. Compute today's MACD line, signal and histogram, then state the level of the 12-session average at which the histogram would turn negative, holding the 26-session average and the signal constant.
Solution. MACD line = 1,846.20 − 1,802.75 = 43.4500. Signal = 43.4500 × 0.2 + 38.40 × 0.8 = 39.4100. Histogram = 43.4500 − 39.4100 = +4.0400. The histogram turns negative when the line falls below the signal of 39.4100, which needs the 12-session average to fall below 1,802.75 + 39.4100 = ₹1,842.1600, a decline of 0.2188% from today. A four-rupee move in a 1,846-rupee average flips the sign, which is the general warning about histogram-crossing rules on a slow-moving pair.
P4. Whipsaw arithmetic (India, ₹). Using the illustrative delivery rate card, compute the cost of one flat round trip on ₹3,00,000 (buying and selling at the same value), then the cost of 4, 7 and 12 such round trips as a share of capital, and state what a gross 18.5% annual return becomes after seven round trips.
Solution. Buy cost = 3,00,000 × 0.001186226 = ₹355.87. Sell cost = 3,00,000 × 0.001036226 + 15.93 = ₹326.80. Round trip ₹682.67, or 0.2276% of capital. Four round trips ₹2,730.66 (0.9102%); seven ₹4,778.66 (1.5929%); twelve ₹8,191.99 (2.7307%). A gross 18.5% becomes 16.9071% after seven round trips, which is 8.6% of the return handed over for the privilege of changing your mind seven times.
P5. Measured move and break-even hit rate (India, ₹). A head at ₹2,642.00 over a flat neckline at ₹2,480.00, with a stop at ₹2,521.00. Compute the depth, the target, the reward-to-risk ratio, the break-even hit rate, and the expected points per trade at hit rates of 20%, 30% and 40%.
Solution. Depth = 2,642.00 − 2,480.00 = 162.00. Target = 2,480.00 − 162.00 = ₹2,318.00, a fall of 6.5323%. Reward 162.00, risk 41.00, ratio 3.9512 to one. Break-even hit rate = 41 ÷ 203 = 20.1970%. Expected points: −0.4000 at 20%, +19.9000 at 30%, +40.2000 at 40%. At a 20% hit rate this trade is very slightly negative, which is the point of computing the break-even rate rather than admiring the ratio.
P6. An advance-decline line (US, $). On a composite of about 1,900 issues, five sessions record advances of 1,420, 1,180, 990, 860 and 720 against declines of 480, 720, 910, 1,040 and 1,180. Build the cumulative line and the A/D ratio, and say when the line peaked and what the last session's advance count would have had to be to hold the line flat.
Solution. Net advances: +940, +460, +80, −180, −460. Cumulative line: 940, 1,400, 1,480, 1,300, 840. Ratios: 2.9583, 1.6389, 1.0879, 0.8269, 0.6102. The line peaks on session 3 at 1,480 and has given back 640 by session 5, while remaining positive at 840. Holding it flat on session 5 would have needed advances to equal declines at 1,180, against 720 actual. Note that the line was still rising on session 3 while the ratio had already collapsed from 2.96 to 1.09; the ratio turns first because it is a level and the line is a cumulative sum.
P7. Point-and-figure box arithmetic (India, ₹). On a 20-point box with a three-box reversal, an X column runs from 2,440 to 2,680. Give the number of boxes in the column, the price that must print to start an O column, and what a fall to 2,665 draws. Then compute the vertical count target and express it as a percentage above the column top.
Solution. Column = (2,680 − 2,440) ÷ 20 = 12 boxes. A reversal needs 3 × 20 = 60 points, so an O column starts on a print at or below 2,620. A fall to 2,665 is 15 points, which is 0.75 of a box: nothing is drawn, and the session leaves no mark. Vertical count = 12 × 20 × 3 + 2,440 = 3,160, which is +17.91% above the column top. That target is generated purely by the box size and the reversal rule, so halving the box would halve the column count and change the target completely.
P8. Deflating a Sharpe ratio (US, $). A strategy shows an annualised Sharpe of 1.42 over 504 daily observations. The grid it was chosen from had a Sharpe dispersion of 0.06 per session. Compute the expected maximum under the null at 24 and at 120 trials, then the deflated Sharpe at 120 trials assuming zero skew and a kurtosis of 3, and compare it with the answer you would get by claiming only 4 trials.
Solution. At N = 24 the bar is 0.118786 per session, which is 1.8857 annualised; at N = 120 it is 0.155646, or 2.4708 annualised. The observed 1.42 annualised is 1.42 ÷ √252 = 0.089452 per session, which is below the 120-trial bar, so the numerator is negative and DSR = 0.0692. Claiming only four trials moves the bar to 0.063127 and gives DSR = 0.7221. The trial count alone moves the verdict by 65.29 percentage points of confidence, and it is the one input nobody can audit for you.
P9. Circuit bands (India, ₹). A stock closes at ₹1,244.50. Give the daily limits under 5%, 10% and 20% bands. Then compute the level after three consecutive 5% upper circuits, and how much a 20-session simple average rises from those three closes alone.
Solution. 5% band: ₹1,182.27 to ₹1,306.73. 10%: ₹1,120.05 to ₹1,368.95. 20%: ₹995.60 to ₹1,493.40. Three consecutive upper circuits give 1,244.50 × 1.05³ = ₹1,440.6643, a rise of 15.7625%. The three closes exceed the starting price by 62.2250, 127.5612 and 196.1643 rupees, so a twenty-session average absorbing them rises by 385.9506 ÷ 20 = 19.2975 points from those sessions alone, on volume that barely existed.
P10. Relative strength against price (India, ₹). A stock and its index, both rebased to 100, print 100.0, 108.4, 114.9, 119.6, 126.3 and 100.0, 105.2, 110.8, 118.9, 128.4 respectively. Compute the relative strength ratio at each date, the total return of each, and the change in the ratio. Then state what happened over the last two periods alone.
Solution. Ratios: 1.000000, 1.030418, 1.037004, 1.005887, 0.983645. The stock returns +26.30% and the index +28.40%, so the ratio falls 1.6355%. Over the last two periods the stock gained +9.92% while the ratio fell 5.1455%. A holder reading only the price sees a strong position; a holder reading the ratio sees capital that would have been better placed in the index, and the divergence is entirely invisible on a price chart.
P11. Turnover against a claimed edge. A rule claims a gross edge of 4.2% a year. Using the Indian round-trip cost from P4 and the US round-trip figure of 0.0530% from the transaction-cost work, compute the net edge at 4, 12 and 20 round trips a year in India, and the break-even turnover in each market.
Solution. The Indian round trip costs 0.2276%. At 4 round trips the cost is 0.9102% and the net edge is +3.2898%; at 12 it is 2.7307% and +1.4693%; at 20 it is 4.5511% and −0.3511%. Break-even turnover in India = 4.2% ÷ 0.2276% = 18.46 round trips a year. In the US at 0.0530% it is 79.25. The same claimed edge supports four times the turnover in the market with the cheaper stack, which is why a rule imported from a US backtest can be arithmetically dead in India before it is tested.
P12. Stop discipline and position size (India, ₹). Capital is ₹12,00,000 and you will risk 0.75% of it on one position. Entry ₹764.50, stop ₹712.00. Compute the share count, the position value as a share of capital, and the stop distance in percent. Then compute what an overnight gap to ₹688.00 does to the risk budget.
Solution. Risk per share = 764.50 − 712.00 = ₹52.50. Risk budget = 12,00,000 × 0.0075 = ₹9,000.00. Shares = 9,000 ÷ 52.50 = 171.4286, so 171 whole shares. Position = 171 × 764.50 = ₹1,30,729.50, which is 10.8941% of capital. The stop sits 6.8672% below entry. A gap to ₹688.00 realises (764.50 − 688.00) × 171 = ₹13,081.50, which is 1.0901% of capital and 45.35% more than budgeted. A stop is an instruction, not a guarantee, and the gap risk is why a position sized to the stop must still be sized to survive the gap.
Applied mini-project
Compute five indicators on one real series, backtest one of them honestly, and write the verdict.
Choose one liquid security with at least three years of daily closes, from either market. Trace the data to a named primary source with the retrieval date recorded, state the adjustment convention for splits and dividends, and label any synthetic construction as synthetic. Four artefacts, each with an explicit test it must pass.
Part 1, five indicators computed from raw closes (2 tests). From the raw prices only, in a spreadsheet or in Python, compute five things. A 50-session and a 200-session simple moving average. A 14-session relative strength index with Wilder smoothing. The 12/26/9 MACD line with its signal and histogram. A 14-session stochastic %K and %D. And one breadth or relative-strength series appropriate to your security. Test 1: reproduce ten consecutive sessions of the relative strength index and the MACD by hand and match your code to four decimal places, showing both computations. Test 2: state, for every indicator, the first session on which it is defined and why, and confirm that no value appears before that session.
Part 2, the signal, dated honestly (2 tests). Define one rule precisely enough that another person would produce identical signals from your written specification. State the confirmation lag: for any rule using swing points, the signal date must be the fractal width later than the extreme it depends on. Test 3: assert in code that no signal date precedes the session on which its inputs were fully known, and demonstrate that the assertion fires when you deliberately remove the lag. Test 4: produce a table of every signal with its date, its price, and the reason it fired.
Part 3, the backtest with its full cost stack (2 tests). Run the rule with fills at the next session's close and the real transaction stack for your market, itemised from a rate card you cite. Report gross and net terminal value, the number of round trips, the total charges in currency, the share of sessions holding a position, the rule's own maximum drawdown, and buy-and-hold on the same window for comparison. Test 5: the round-trip charges recomputed by hand for one trade must match the code to the paisa or cent. Test 6: report the rule's drawdown from its own equity curve, not the security's, and show both.
Part 4, the selection audit (1 test). Record every configuration you tested, including the ones you discarded and any variant you tried before settling on this rule. Report the count, the dispersion of Sharpe ratios across the grid, the expected maximum under the null, and the deflated Sharpe of your chosen configuration, with all Sharpes stated per observation as well as annualised. Test 7: feed an obviously null series, such as a shuffled version of your own returns, through the identical pipeline and confirm that its deflated Sharpe fails.
Deliverable. One workbook or notebook plus a one-page verdict. The verdict states what the indicator would have to do to win a place in your process, as a number you wrote down before you looked; whether it did; the seven test results; and the one assumption your conclusion is most sensitive to, with the sensitivity quantified. It must name your trial count in a sentence, and it must say what you will do about the rule now.
Rubric (20 points; pass at 16, with no zero on any row).
| # | Criterion | 0 | 1 | 2 | 3 |
|---|---|---|---|---|---|
| 1 | Indicators from raw data (Tests 1-2) | taken from a platform menu | computed, no hand check | hand check matches to 4 dp | plus the first-defined-session table |
| 2 | Signal specification and lag (Tests 3-4) | undated or hindsight-dated | dated, no assertion | assertion present and passing | assertion demonstrated to fire when the lag is removed |
| 3 | Cost stack (Test 5) | ignored or assumed | applied at a flat rate | itemised from a cited rate card | plus a hand-recomputed trade matching exactly |
| 4 | Drawdown honesty (Test 6) | not reported | security drawdown only | both reported | both reported and the difference explained |
| 5 | Trial count and deflation (Test 7) | count not kept | count stated, no deflation | deflated Sharpe computed | plus the null-series control failing as it should |
| 6 | Units discipline | Sharpes unlabelled | annualised only | both stated | both stated and the conversion shown |
| 7 | The verdict | absent or unfalsifiable | states a view | states the bar in advance and the outcome | plus the sensitivity quantified and the decision recorded |
Any artefact whose test fails scores zero on that row, however good the write-up looks. A backtest with a beautiful chart and no trial count is the exact object this node exists to teach you to refuse.
Reading & resources
The primary technical texts, read as sources rather than as authorities:
- Robert D. Edwards and John Magee, Technical Analysis of Stock Trends, first published 1948 and continuously revised. The book that defined the pattern vocabulary everyone still uses; read it for the definitions and hold the claims at arm's length. [Paid] [Beginner-Intermediate]
- J. Welles Wilder, New Concepts in Technical Trading Systems (1978). The source of the relative strength index, average true range and the parabolic stop, with the smoothing recursion stated exactly as it must be implemented. [Paid] [Intermediate]
- Steve Nison, Japanese Candlestick Charting Techniques (1991). The standard Western reference for candlestick construction and naming. [Paid] [Beginner]
- Thomas N. Bulkowski, Encyclopedia of Chart Patterns. The serious attempt to count pattern outcomes rather than assert them; read the methodology section before the tables, and notice how much identification discretion remains. [Paid] [Intermediate-Advanced]
- John J. Murphy, Technical Analysis of the Financial Markets. The standard survey, including the clearest treatment of intermarket relationships. [Paid] [Beginner-Intermediate]
The critique, which must be read alongside the above:
- Narasimhan Jegadeesh and Sheridan Titman, "Returns to Buying Winners and Selling Losers" (Journal of Finance, 1993). The paper that turned momentum from folklore into a documented anomaly. [Free working paper versions] [Advanced]
- Andrew W. Lo, Harry Mamaysky and Jiang Wang, "Foundations of Technical Analysis" (Journal of Finance, 2000). The best-known attempt to define chart patterns algorithmically so they can be tested at all; the definitional work is the valuable part. [Free working paper] [Advanced]
- David H. Bailey and Marcos López de Prado, "The Deflated Sharpe Ratio" (Journal of Portfolio Management, 2014). The source of the formula applied in Worked Example 3, including the skew and kurtosis correction. [Free working paper] [Advanced]
- Marcos López de Prado, Advances in Financial Machine Learning, chapters 11 and 12. Backtest overfitting and why a backtest is not a research tool. [Paid] [Advanced]
Indian primary sources, which is where the India-specific data actually lives:
- NSE and BSE daily bhavcopy and security-wise delivery position files: the primary source for closes, volumes and delivery percentages, published daily and free. Build your own series from these rather than from a screener. [Free] [Beginner-Intermediate]
- NSE derivatives daily reports: open interest, client-category positions, market-wide position limits and the ban list, plus the circulars that set lot sizes. Every open-interest figure in this node would be computed from these. [Free] [Intermediate]
- SEBI circulars on price bands, dynamic bands and market-wide circuit breakers, which are the primary source for every band percentage quoted here and the reason those percentages must be verified rather than memorised. [Free] [Intermediate]
One exercise is worth more than any of the reading above. Take a liquid stock you already follow, pull sixty daily closes from the exchange's own file, and compute a fourteen-session relative strength index by hand in a spreadsheet, with the Wilder recursion written out in cells rather than a library function. Then compute the same thing using a simple fourteen-session mean and plot both. The lines look similar and disagree at exactly the moments a threshold rule fires, which is the cheapest possible demonstration that an indicator is a definition rather than a measurement.
Teach it back & journal
Feynman prompt. Sit with someone who trades from charts and ask them to explain a crossover signal to you. Then take the conversation somewhere they will not expect. Ask what the rule's own maximum drawdown was, as distinct from the security's, and watch whether the distinction lands. Ask how many round trips it made last year and what the statutory charges came to in rupees, using their broker's actual rate card rather than a guess. Ask how many parameter combinations they or anyone else tried before settling on fifty and two hundred. If they say "those are the standard numbers", ask who standardised them and on what sample. None of this is an ambush, and the tone matters: you are asking the three questions a research process would ask, and most people have never been asked them because most people are shown a picture rather than a table.
Then take the other side properly, because a straw man teaches nothing. Explain to a colleague who dismisses all of this why the advance-decline line deserves respect where the head and shoulders does not. Make them state the difference in terms of parameters, and have them count the free parameters in each: zero in a cumulative sum of advances minus declines, and an unbounded number in a pattern whose identification criteria two analysts will apply differently. If they end by asking, unprompted, "how many things did you try before this one?" the next time somebody shows them a backtest, the idea has installed.
Journal prompt. For the next month, every time you meet a chart claim in a broker's note, a message, a video or a conversation, write down four things before you respond to it. The exact rule, in words another person could apply identically. The date the signal could first have been computed. The cost of acting on it, in currency, from a real rate card. And the number of configurations the author says they tried. Then count how many of the four you could actually fill in.
At the end of the month, answer three things in writing. Count how many claims survived all four columns. Name the column that was missing most often on the ones that did not, and say what that tells you about where this material fails, as opposed to where it is attacked. The harder one comes last. On the positions you hold right now, write down any decision you have made or deferred because of a line on a chart, naming the position, the line, and what the underlying business is worth by your own work. If the two disagree, write the paragraph explaining which one you will obey, and why, and keep it.
In three months you will know whether you were right, and the paragraph is the only record that will tell you honestly.
Finally, one entry about process rather than analysis. This node's most transferable habit is not an indicator; it is the reflex of asking for the trial count. Where else in your own work do you look at a result that was selected from many candidates and report it as though it were the only one you ran? A screen that returned forty names and you presented three. A valuation with a discount rate you adjusted until the answer looked reasonable. A checklist item you dropped because it kept failing. Write those down, honestly, and pick one to fix this month.
This module's flashcards and mastery quiz are wired into the app: see the node's Quiz and Reviews.