Technical Analysis
Market mechanics, Dow theory and stages, price action, candlesticks, chart patterns with Bulkowski statistics, indicators with Python code, Wyckoff and breadth, strategies, risk and position sizing, psychology, backtesting and algo trading.
00Technical analysis atlas: topics and routes
The whole sheet on one screen. Select an area or topic to jump to it, and hover diagram boxes for explanations. This is an educational reference, not investment advice.
Technical analysis topic atlas#
How to use this sheet#
- Learning: read market mechanics, trend and cycles, then price action. Every indicator and pattern is a summary of price and volume, so these come first.
- Building a method: pick one strategy, one or two indicators, and the risk rules. Write them down as a trading plan.
- Before a trade: run the top-down flow below, size the position, then use the pre-trade checklist at the end.
- Improving: journal every trade, backtest rule changes, and change one thing at a time.
Top-down analysis flow#
flowchart TD HTF["Higher timeframe trend"] --> LVL["Key levels"] LVL --> REG["Regime: trend or range"] REG --> SET["Setup that fits the regime"] SET --> TRG["Entry trigger"] TRG --> RISK["Stop and position size"] RISK --> MAN["Manage: partials, trail"] MAN --> REV["Journal and review"]
Each step can veto the trade. If you cannot name the level, the stop or the size, there is no trade.
Check yourself 2 questions
What comes right after the higher-timeframe trend?
Show answer
Marking the key levels.
Why decide the regime before the setup?
Show answer
Trend and range need different setups and tools.
Takeaway Higher-timeframe trend, key levels, regime, a setup that fits, a trigger, stop and size, then manage.
The three questions behind every chart#
| Question | Tools | Where it's covered |
|---|---|---|
| Which way is the path of least resistance? | Structure (HH/HL), moving averages, higher-timeframe trend, market stage | Trend and cycles, price action |
| Where would I be wrong? | Support and resistance, swing points, pattern boundaries, ATR | Price action, chart patterns, risk |
| Is the move supported? | Volume, breadth, momentum divergence, intermarket confirmation | Indicators, advanced |
Check yourself 2 questions
Which tools answer 'where would I be wrong?'
Show answer
Support and resistance and swing points: they place the stop.
Which tools answer the direction question?
Show answer
Structure, moving averages, the higher-timeframe trend and market stage.
Takeaway Which way is least resistance, where would I be wrong, and is the reward worth the risk?
01Market mechanics: how price moves
TradingOverview/technical-analysis/handbook/01-market-basics
Price discovery and the order book#
- Price is the last trade, not fair value. It moves when aggressive orders exhaust the liquidity resting at the best price.
- Liquidity is the ability to trade size without moving price; thick books mean tight spreads and small slippage.
- Order flow imbalance drives short-term moves: more market buys than resting asks lifts price.
Bids (buyers) Asks (sellers) 100 @ 50.00 200 @ 50.01 300 @ 49.99 150 @ 50.02 500 @ 49.98 400 @ 50.03 Market buy 350 → 200 @ 50.01, 150 @ 50.02 Best ask is now 50.03: price moved 2 ticks.
This is why large orders are sliced (TWAP, VWAP algorithms) and why a thin book lets one order spike price.
Check yourself 2 questions
What makes price move?
Show answer
Aggressive orders exhausting the liquidity resting at the best price.
What does a thick order book give you?
Show answer
Tight spreads and small slippage.
Takeaway Price is the last trade, not fair value; it moves when aggressive orders exhaust the liquidity at the best price.
Who is on the other side#
| Participant | Goal | Footprint on the chart |
|---|---|---|
| Retail | Profit from moves | Small size; reactive to news, patterns, social media |
| Institutions (funds) | Long-term returns vs a benchmark | Steady accumulation or distribution over days; volume at key levels |
| Market makers | Earn the spread | Quote both sides; widen or pull quotes in stress |
| HFT / algos | Arbitrage, rebates, speed | Tight spreads in calm markets; liquidity vanishes in shocks |
| Hedgers | Offset business risk | Large, price-insensitive flow |
| Central banks | Policy goals | Rare, overwhelming moves in rates and FX |
Check yourself 2 questions
What's the chart footprint of institutional buying?
Show answer
Steady accumulation over days, with volume at key levels.
How does retail typically trade?
Show answer
Small size, reacting to news, patterns and social media.
Takeaway Retail reacts, institutions accumulate or distribute over days, and market makers and algos provide liquidity.
Bid, ask, spread and slippage#
- Bid = best price buyers pay; ask = best price sellers accept; spread = ask − bid, the cost of an instant round trip.
- Slippage = fill worse than the quote, from thin size at the quote, fast markets or a large order.
- Spreads widen with low volume, news, small caps, exotic pairs and off-hours.
- Budget at least half the spread on entry and exit; scalping in wide-spread names can erase the whole edge.
Check yourself 2 questions
Define the spread.
Show answer
Ask − bid: the cost of buying and instantly selling.
Name two causes of slippage.
Show answer
Any two of: thin size at the quote, fast markets, a large order.
Takeaway The spread is the cost of an instant round trip; slippage is a fill worse than the quote, and both widen in thin or fast markets.
Order types#
| Type | Fills | Use | Risk |
|---|---|---|---|
| Market | Now, at best available | Speed matters more than price | Slippage in thin or fast markets |
| Limit | At your price or better | Entries at levels, exits at targets | May never fill |
| Stop (stop-market) | Becomes a market order at the trigger | Stop-losses, breakout entries | Gaps fill far beyond the stop |
| Stop-limit | Becomes a limit order at the trigger | Trigger with a price cap | No fill in a gap, so you stay in the loser |
| Bracket / OCO | Entry plus linked stop and target | Automating exits | Check broker support for gaps |
Check yourself 2 questions
What's the risk of a limit order?
Show answer
It may never fill.
What does a stop-market order become when triggered?
Show answer
A market order.
Takeaway Market for speed, limit for price, stop to force an exit, stop-limit for a price floor that may not fill.
Sessions and timing#
| Market | Hours | Behaviour |
|---|---|---|
| India (NSE/BSE cash) | 09:15–15:30 IST, pre-open 09:00–09:15 | Opening gap and first 15–30 minutes are noisy; closing auction volume |
| US equities | 09:30–16:00 ET | Open and close carry most volume; midday drift |
| FX London | ~07:00–16:00 UTC | Most FX volume; EUR and GBP pairs |
| FX New York | ~13:00–22:00 UTC | London overlap 13:00–16:00 UTC is the most liquid window |
| Crypto | 24/7 | Liquidity still clusters around equity sessions; weekend wicks |
Mark the open, prior high and low, and VWAP intraday. Size down or stand aside in thin hours and before scheduled news.
Check yourself 2 questions
Indian cash market hours?
Show answer
9:15 am to 3:30 pm IST, with pre-open from 9:00.
When do US equities trade most volume?
Show answer
At the open and close.
Takeaway Opens and closes carry the most volume; India's first 15–30 minutes are noisy.
Microstructure in one card#
- Price-time priority: best price fills first; at the same price, earlier orders fill first.
- Maker vs taker: limit orders that rest add liquidity (often cheaper); market orders take it.
- Gaps form when news arrives while the market is closed; stops can fill far away.
- Venues: exchanges (central order book), ECNs, OTC dealers, dark pools for block trades.
- Your edge as a retail trader is in setup selection and risk control, not speed.
Check yourself 2 questions
Price-time priority means what?
Show answer
Best price fills first; at the same price, earlier orders first.
Maker versus taker?
Show answer
Makers rest limit orders and add liquidity; takers hit them with market orders.
Takeaway Price-time priority, makers add liquidity, takers remove it, and gaps form while the market is closed.
India market specifics#
| Rule | Detail |
|---|---|
| Settlement | T+1 for cash equities |
| Pre-open | 09:00–09:15: orders 09:00–09:08, call-auction matching sets the open |
| Official close (NSE) | Not the last trade. From 3 Aug 2026, stocks with derivatives close through a closing auction (continuous trading stops 15:15; matching by 15:35 within ±3% of the 15:00–15:15 VWAP). Other stocks: volume-weighted average of the last 30 minutes. From 7 Dec 2026 the auction moves to 15:30–15:40 (continuous trading to 15:30, reference = 15:15–15:30 VWAP) |
| Stock price bands | 2%, 5%, 10% or 20% daily circuits for non-F&O stocks; F&O stocks have wider dynamic bands |
| Market-wide circuit breakers | 10%, 15% and 20% moves in Nifty 50 or Sensex halt trading |
| F&O ban | Stock over 95% of market-wide position limit: no fresh positions |
| Costs | Brokerage, STT, exchange fees, GST, stamp duty; intraday and F&O costs add up fast |
Circuits matter for stops: a stock locked at its lower circuit cannot be sold, so size small in names with tight bands.
Check yourself 2 questions
Settlement cycle for Indian cash equities?
Show answer
T+1.
Is NSE's official close the last trade?
Show answer
No; it's a VWAP or, for F&O stocks from August 2026, a closing auction.
Takeaway T+1 settlement, a 9:00–9:15 pre-open call auction, and an official close that isn't simply the last trade.
Asset classes compared#
| Market | Hours | Typical leverage | Main drivers | Chart quirks |
|---|---|---|---|---|
| Equities | Exchange session | Low to moderate (margin) | Earnings, sector rotation, macro | Overnight gaps; VWAP and session levels matter |
| Index futures and options | Extended sessions | High | Macro, flows, volatility | Expiry effects, open interest |
| Forex | 24/5 | High | Rate differentials, central banks | Session ranges; round numbers |
| Commodities | Sessions plus electronic | Moderate to high | Supply and demand, USD, real yields | Contract rolls; seasonality |
| Crypto | 24/7 | Very high | Sentiment, flows, regulation | Large wicks; thin weekend books |
Check yourself 2 questions
Which chart quirk matters most for equities?
Show answer
Overnight gaps.
Which market drivers matter for equities?
Show answer
Earnings, sector rotation and macro.
Takeaway Equities gap overnight, futures and options carry leverage and expiries, FX trades nearly round the clock.
02Trend, Dow theory and market cycles
TradingOverview/technical-analysis/book-summary (Technical Analysis Explained, Technical Analysis of the Futures Markets, Multiple Timeframes)
Dow theory: six tenets#
- The averages discount everything: all known information is in the price.
- Three movements: primary trend (1+ years), secondary reactions (weeks to months, retracing about a third to two thirds), minor moves (days).
- Primary trends have three phases: accumulation, public participation, excess (and distribution, public selling, panic in bear markets).
- Averages must confirm each other (originally Industrials and Transports).
- Volume confirms the trend: it expands in the direction of the primary trend.
- A trend persists until a clear reversal (a failed swing that breaks the sequence of highs and lows).
Check yourself 2 questions
How much does a secondary reaction usually retrace?
Show answer
About a third to two-thirds.
How long does a primary trend last?
Show answer
A year or more.
Takeaway The averages discount everything, three movements run at once, primary trends have phases, averages and volume must confirm.
The four stages of a stock#
| Stage | Looks like | Action |
|---|---|---|
| 1 Accumulation (base) | Sideways after a decline; flat 30-week MA; volume dries up | Watch; buy the breakout from the base |
| 2 Markup (advance) | Higher highs and lows; rising MA; volume on up moves | Hold and add on pullbacks |
| 3 Distribution (top) | Sideways after an advance; MA flattens; wide swings | Tighten stops, take profits |
| 4 Markdown (decline) | Lower highs and lows; falling MA | Avoid longs; short or stay out |
From Weinstein and Shannon. Most money is made in stage 2; most losses come from buying stage 4 because it "looks cheap".
Check yourself 2 questions
What does stage 1 look like?
Show answer
Sideways after a decline, a flat 30-week MA and drying volume.
What do you do in stage 2?
Show answer
Hold and add on pullbacks.
Takeaway Accumulation, markup, distribution, markdown: buy breakouts from stage 1, hold stage 2, avoid 3 and 4.
Stage cycle#
flowchart TD S1["Stage 1: accumulation"] --> S2["Stage 2: markup"] S2 --> S3["Stage 3: distribution"] S3 --> S4["Stage 4: markdown"] S4 --> S1
Check yourself 2 questions
Which stage follows distribution?
Show answer
Stage 4, markdown.
Which stage follows markdown?
Show answer
Stage 1, accumulation.
Takeaway Stage 1 → 2 → 3 → 4 → back to 1.
Multiple-timeframe framework#
| Role | Swing trader | Intraday trader | Question it answers |
|---|---|---|---|
| Trend (higher) | Weekly | Daily / 1H | Which direction am I allowed to trade? |
| Setup (middle) | Daily | 15m | Is there a pullback or pattern at a level? |
| Trigger (lower) | 4H / 1H | 5m / 1m | Exactly where do I enter and put the stop? |
- Use a ratio of roughly 4–6× between timeframes.
- Trade in the direction of the higher timeframe; a level visible on several timeframes is stronger.
Check yourself 2 questions
Swing trader's trend timeframe?
Show answer
Weekly.
What does the lowest timeframe decide?
Show answer
The exact entry trigger.
Takeaway The higher timeframe allows a direction, the middle finds the setup, the lower times the trigger.
Trend vs range: what changes#
| Range (contraction) | Trend (expansion) | |
|---|---|---|
| Structure | No clean HH/HL or LH/LL; flat boundaries | Clear HH/HL or LH/LL |
| Strategy | Fade the edges or wait for a breakout | Buy pullbacks / sell rallies; break of structure |
| Indicators | Oscillators (RSI, Stochastic) | MAs, ADX, trendlines |
| Main risk | Breakout stops out the fades | Late entries, false breakouts |
| Volatility | Contracting (squeeze) | Expanding on impulse legs |
Check yourself 2 questions
Which indicators suit ranges?
Show answer
Oscillators such as RSI and stochastics.
What structure defines a trend?
Show answer
Clear HH/HL or LH/LL sequences.
Takeaway Ranges call for fading edges and oscillators; trends for buying pullbacks, breaks of structure and trend tools.
Trend or range? A quick test#
Check yourself 2 questions
Bands and ATR contracting with no structure: what then?
Show answer
A squeeze: wait for a breakout.
Price bouncing between flat levels: tactic?
Show answer
Fade the edges with tight stops.
Takeaway Clean structure means trend; flat levels mean range; contracting bands mean a squeeze.
03Price action: levels, trendlines and structure
TradingOverview/technical-analysis/handbook/02-price-action
Support and resistance#
- Support: where buying has appeared before (prior lows, round numbers, volume nodes). Resistance: where selling has appeared.
- Why levels work: memory, unfilled orders left behind, and attention on obvious numbers.
- Strength: sharp reversals, high volume, several timeframes, and recent tests. Many tests can also exhaust a level.
- Role reversal: broken resistance tends to become support, and broken support resistance.
- Treat levels as zones, not exact prices.
Check yourself 2 questions
Why do levels work?
Show answer
Memory, unfilled orders left behind, and attention on obvious numbers.
Name two sources of support.
Show answer
Any two of: prior lows, round numbers, volume nodes.
Takeaway Levels work through memory, unfilled orders and attention; strength comes from sharp reversals, touches and volume.
Trendlines and channels#
- Uptrend line joins higher lows; downtrend line joins lower highs. Two touches draw it, a third validates it.
- Do not force lines through every wick. Steeper lines break sooner.
- Channels: a parallel line through the opposite swings. Buy the lower rail, sell the upper, or trade a break with confirmation.
- A break of a trendline signals the trend is weakening, not necessarily reversing.
- Dynamic levels: 20/50/200 EMAs and VWAP act as moving support in uptrends.
Check yourself 2 questions
What does an uptrend line connect?
Show answer
Higher lows.
Why avoid forcing lines through every wick?
Show answer
It creates false precision; steeper forced lines break sooner.
Takeaway Two touches draw a line, a third validates it; steeper lines break sooner.
Market structure vocabulary#
| Term | Meaning | Use |
|---|---|---|
| HH / HL | Higher high / higher low | Uptrend; buy pullbacks to the HL |
| LH / LL | Lower high / lower low | Downtrend; sell rallies to the LH |
| BOS | Break of structure: close beyond the last HH (or LL) | Trend continuation or entry confirmation |
| MSS / CHoCH | Market structure shift / change of character: first LL in an uptrend (first HH in a downtrend) | Early warning of reversal or a deeper pullback |
| Swing point | Pivot with lower highs (or higher lows) on both sides | Define consistently, e.g. 2–3 bars each side |
Check yourself 2 questions
What's a break of structure (BOS)?
Show answer
A close beyond the last higher high (or lower low).
In an uptrend, where do you buy?
Show answer
Pullbacks to the higher low.
Takeaway HH/HL is an uptrend, LH/LL a downtrend; BOS continues the trend, CHoCH warns of a change.
Liquidity grabs and stop hunts#
- Stops cluster just beyond obvious highs, lows and round numbers.
- Price often sweeps those levels, triggers the stops, then reverses, leaving a long wick.
- Setup: sweep below support, strong close back inside, then long with the stop below the wick.
- Defence: place stops beyond the obvious level with a buffer (or use a close beyond the level as the exit).
- Most "manipulation" is ordinary liquidity mechanics; plan for it instead of blaming it.
Check yourself 2 questions
Where do stops cluster?
Show answer
Just beyond obvious highs, lows and round numbers.
Describe the sweep long setup.
Show answer
A sweep below support, a strong close back inside, then long with the stop beyond the wick.
Takeaway Price often sweeps stop clusters beyond obvious levels, then reverses, leaving a long wick.
Price-action entries and exits#
| Situation | Entry | Stop | Target |
|---|---|---|---|
| Long at support | Bullish candle at the level; enter over its high | Below the level (with buffer) | Next resistance or 1:2 |
| Short at resistance | Bearish rejection; enter under its low | Above the level | Next support |
| Breakout | Close beyond the level, or the retest | Back inside the range | Range height projected |
| Trend pullback | Rejection at the HL, trendline or EMA | Below the HL | Prior high, then trail |
| After bearish MSS | Retest of broken HL from below | Above the MSS high | Next support / LL |
| Liquidity sweep | Close back inside after the wick | Beyond the wick | Opposite side of the range |
Check yourself 2 questions
Long at support: where's the entry?
Show answer
Over the high of a bullish candle at the level.
Where does the stop go?
Show answer
Below the level, with a buffer.
Takeaway Enter on a confirming candle at the level, stop beyond it with a buffer, target the next level or 1:2.
04Candlesticks: anatomy, patterns and context
TradingOverview/technical-analysis/handbook/03-candlestick-analysis · book-summary/japanese-candlestick-charting-techniques (Nison)
Candle anatomy and psychology#
- Body = open to close; green or white when close > open. Body size shows conviction.
- Upper wick = high − max(open, close): sellers rejected higher prices.
- Lower wick = min(open, close) − low: buyers rejected lower prices.
- Close near the high = buyers in control; close near the low = sellers in control.
- Small body (doji-like) = indecision. It matters only after a strong move or at a level.
Check yourself 2 questions
Upper wick formula?
Show answer
High − max(open, close).
A long lower wick shows what?
Show answer
Buyers rejected lower prices.
Takeaway Body shows conviction, upper wicks rejected highs, lower wicks rejected lows, and the close location tells who won.
Context beats the pattern#
- Level: a hammer at support or a higher low means far more than one mid-range.
- Trend: a reversal candle against the higher-timeframe trend is a lower-odds trade.
- Volume: above-average volume on the signal candle adds conviction.
- Sequence: a doji after three large down candles at support is exhaustion; after one candle it is noise.
- Confirmation: wait for the next candle to close in the signal's direction before entering.
Check yourself 2 questions
A hammer mid-range versus at support: which matters?
Show answer
At support (or a higher low).
How does volume change a signal candle?
Show answer
Above-average volume adds conviction.
Takeaway Level, trend, volume and sequence decide whether a candle pattern means anything.
Single-candle patterns#
| Pattern | Shape | Where it counts | Bias | Entry and stop |
|---|---|---|---|---|
| Doji | Open ≈ close; wicks vary | After a strong move, at S/R | Indecision; reversal only if confirmed | Trade the next candle's break; stop beyond the doji |
| Hammer | Small body at top, lower wick ≥ 2× body, tiny upper wick | After a decline, at support | Bullish | Buy over the high; stop under the low |
| Hanging man | Hammer shape | After a rally, at resistance | Bearish warning | Sell under the low; stop over the high |
| Inverted hammer | Small body at bottom, long upper wick | After a decline | Bullish if confirmed | Buy over the high; stop under the low |
| Shooting star | Inverted-hammer shape | After a rally, at resistance | Bearish | Sell under the low; stop over the high |
| Marubozu | Full body, no wicks | Breakouts, trend legs | Direction of the body | Momentum confirmation; stop beyond the candle |
| Spinning top | Small body, wicks both sides | After a run | Loss of momentum | Not a trigger on its own |
Check yourself 2 questions
Is a doji a reversal signal on its own?
Show answer
No; indecision, a reversal only if confirmed.
How do you trade a doji?
Show answer
On the next candle's break, stop beyond the doji.
Takeaway Doji, hammer, shooting star and marubozu: trade the next candle's break with the stop beyond the pattern.
Two-candle patterns#
| Pattern | Rule | Bias |
|---|---|---|
| Bullish engulfing | Bullish body fully engulfs the prior bearish body | Bullish |
| Bearish engulfing | Bearish body fully engulfs the prior bullish body | Bearish |
| Piercing line | Gaps down, closes above the midpoint of the prior red body | Bullish (weaker than engulfing) |
| Dark cloud cover | Gaps up, closes below the midpoint of the prior green body | Bearish |
| Tweezer top / bottom | Two candles with matching highs (lows) | Bearish / bullish at S/R |
| Harami | Small body inside the prior large body ("pregnant") | Trend pausing; reversal if confirmed |
| Harami cross | Harami whose second candle is a doji | Stronger than a plain harami |
| Counterattack lines | Opposite colours closing at the same price | Reversal; weaker than engulfing |
Check yourself 2 questions
Define a bullish engulfing.
Show answer
A bullish body fully engulfing the prior bearish body.
Piercing line rule?
Show answer
Gaps down, then closes above the midpoint of the prior bearish candle.
Takeaway Engulfing, piercing, dark cloud, harami and tweezers: a second candle that overrides the first.
Three-candle patterns#
| Pattern | Sequence | Bias |
|---|---|---|
| Morning star | Large red, small body (gap), large green closing past the midpoint of candle 1 | Bullish |
| Evening star | Large green, small body, large red into candle 1's body | Bearish |
| Abandoned baby | Star is a doji gapped away on both sides | Rare, strong reversal |
| Three white soldiers | Three greens, each opening in the prior body and closing near its high | Bullish |
| Three black crows | Three reds, each closing lower near its low | Bearish |
| Inside bar | High and low inside the prior ("mother") bar | Coil; trade the break of the mother bar |
| Outside bar | Range engulfs the prior bar | Direction of the close |
Check yourself 2 questions
Morning star sequence?
Show answer
Large red, small-bodied star, then large green closing past candle 1's midpoint.
What makes an abandoned baby?
Show answer
A doji star gapped away on both sides.
Takeaway Morning and evening stars, abandoned babies, three soldiers and crows add confirmation across three bars.
Nison's extra patterns#
- Belt-hold: opens on its extreme and runs the other way (bullish opens on the low); stronger the longer the body.
- Upside-gap two crows: after a rally, a small red gaps up and a second red engulfs it but stays above the first candle; bearish.
- Tasuki gaps: a gap in the trend direction, then a counter candle that does not close the gap; continuation.
- Rising / falling three methods: a long candle, three small counter candles inside its range, then a long candle to a new close; continuation.
- Doji family: long-legged (big wicks both sides), gravestone (open = close = low; bearish at tops), dragonfly (open = close = high; bullish at bottoms), four-price (no range; illiquid).
- Nison's rule: candles give early warnings, Western tools give targets. Pair a candle with a trendline, MA or level.
Check yourself 2 questions
What is a bullish belt-hold?
Show answer
A candle opening on its low and running up.
Where does upside-gap two crows appear?
Show answer
After a rally; bearish.
Takeaway Belt-holds, upside-gap two crows and other Nison patterns refine the main set.
Should I trade this candle?#
Check yourself 2 questions
A pattern in the middle of a range: trade it?
Show answer
Skip it: noise.
Counter-trend candle: how do you handle it?
Show answer
Half size, and wait for a confirming close.
Takeaway Trade candles only at pre-marked levels, with the higher-timeframe trend, with a defined stop.
05Chart patterns: reversals, continuations and breakouts
TradingOverview/technical-analysis/handbook/04-chart-patterns · patterns-cheat-sheet · book-summary/encyclopedia-of-chart-patterns (Bulkowski)
Reversal patterns#
| Pattern | Shape | Confirms on | Measured target | Stop | Volume tell |
|---|---|---|---|---|---|
| Head and shoulders top | Three peaks, middle highest; neckline through the two lows | Close below the neckline | Head-to-neckline height, projected down | Above the right shoulder | Heavier on the left shoulder, light on the right, expands on the break |
| Inverse H&S | Three troughs, middle lowest | Close above the neckline | Height projected up | Below the right shoulder | Expands on the breakout |
| Double top | Two similar highs ("M") | Close below the middle low | Top-to-valley height, down | Above the tops | Lower on the second peak |
| Double bottom | Two similar lows ("W") | Close above the middle high | Height, up | Below the bottoms | Higher on the breakout |
| Triple top / bottom | Three tests of one level | Break of the swing low (high) | Height | Beyond the pattern | Confirm with breakout volume |
| Rounding bottom (saucer) | Slow U-shaped turn | Close above the rim | Depth, up | Below the low or the last pullback | U-shaped volume too |
| Rising wedge | Converging lines both rising | Break below the lower line | Back to the wedge start | Above the wedge high | Shrinks into the apex |
| Falling wedge | Converging lines both falling | Break above the upper line | Back to the wedge start | Below the wedge low | Expands on the break |
Check yourself 2 questions
Head and shoulders target?
Show answer
Head-to-neckline height projected down from the neckline.
Where's the stop on a head and shoulders short?
Show answer
Above the right shoulder.
Takeaway Head and shoulders, double and triple tops and bottoms confirm on a neckline close, with height-based targets.
Continuation patterns#
| Pattern | Shape | Trade | Target | Notes |
|---|---|---|---|---|
| Bull / bear flag | Sharp pole, then a small channel sloping against it | Break of the flag in the pole's direction | Pole length from the breakout | Flags longer than about 3 weeks underperform |
| Pennant | Pole, then a small symmetrical triangle | Break in the pole's direction | Pole length | Short (1–3 weeks); volume dries up inside |
| Ascending triangle | Flat top, rising lows | Close above the flat top | Triangle height | Buyers more aggressive each test |
| Descending triangle | Flat bottom, falling highs | Close below the flat bottom | Height | Bearish bias; can still break up |
| Symmetrical triangle | Converging lines | Either direction; usually with the prior trend | Widest part | Breakouts two-thirds to three-quarters of the way to the apex are best |
| Rectangle | Flat support and resistance | Close outside the box | Box height | Fade the edges inside, trade the break outside |
| Cup and handle | U-shaped cup, shallow handle in its upper half | Break above the handle (rim) | Cup depth | O'Neil: cup 7–65 weeks, depth 12–33%, handle 1–2 weeks |
Check yourself 2 questions
Flag target?
Show answer
Pole length from the breakout.
What happens to flags lasting longer than about 3 weeks?
Show answer
They underperform.
Takeaway Flags, pennants, triangles and rectangles usually continue the prior move; targets use the pole or height.
Breakout confirmation#
- Close beyond the level, not just a wick; wicks are often stop runs.
- Volume above average (≥ 1.5× the 50-day average is a common bar).
- Retest: broken resistance holds as support; entering there tightens the stop.
- Timeframe: a daily close outranks a 5-minute break.
- Invalidation: a close back inside the pattern means the breakout failed; exit or reverse.
Check yourself 2 questions
Is a wick beyond resistance a breakout?
Show answer
No; wait for a close beyond it.
Common volume bar for a valid breakout?
Show answer
At least 1.5× the 50-day average.
Takeaway Close beyond the level, volume at least 1.5× average, and ideally a retest that holds.
False breakouts#
- Why: stops cluster beyond obvious levels; there is no follow-through; or the break shows only on a noisy timeframe.
- Defend: wait for the close, put the stop beyond the level plus a buffer, enter half size and add on the retest.
- Exploit: a failed break that closes back inside often runs to the other side of the range (Wyckoff spring or upthrust).
- Bulkowski: about 2 in 3 breakouts throw back to the breakout level, so expect a retest rather than panicking.
Check yourself 2 questions
How do you defend against false breakouts?
Show answer
Wait for the close, buffer the stop, enter half size and add on the retest.
How can you exploit a failed breakout?
Show answer
Trade the reversal back inside the range.
Takeaway Stops beyond obvious levels and no follow-through create fakeouts; wait for closes, buffer stops, add on the retest.
Pattern statistics (Bulkowski, US stocks)#
| Pattern (breakout) | Average move | Failure rate* | Throwback / pullback | Comment |
|---|---|---|---|---|
| Cup with handle (up) | +54% bull market | 5% | 62% | Ranked 3rd of 39 in bull markets |
| Rounding bottom (up) | +48% bull / +37% bear | 4% / 6% | 64% | Ranked 1st of 20 in bear markets |
| Rectangle bottom (up) | +48% bull | 15% | — | Down breakouts in bull markets bust 43% of the time |
| Head and shoulders bottom (up) | +45% bull / +28% bear | 11% / 9% | 65% | One of the most reliable reversals |
| Triple bottom (up) | +46% bull / +27% bear | 13% | 65% within 12 days | — |
| Adam & Eve double bottom (up) | +42% | 12% | 67% | 48% of candidates never confirm: wait for the breakout |
| Falling wedge (up) | +38% bull / +26% bear | 26% | 62% | — |
| Descending triangle | +38% up / −15% down (bull) | — | — | Breaks either way; wait for it |
| Symmetrical triangle (up) | +34% bull / +26% bear | 25–37% | 62–65% | Down breakouts −12% bull |
| Head and shoulders top (down) | −24% bear / −16% bull | 5% / 19% | 68% | Ranked 4th of 19 in bear markets |
| Rising wedge (down) | −9% bull / −17% bear | 51% / 28% | 70–72% | Poor in bull markets; take profits fast |
| Flag (up) | +9% bull | Only 46% hit target | 67% | Short-term trade, not a big mover |
| Pennant | Continues the trend 75–76% of the time | Misses target 54% bull / 40% bear | — | Measure rule works only 32–46% |
*Failure = price moves less than 5% after the breakout. Historical base rates from US stocks; use them to set expectations, not as a promise for any one chart.
Check yourself 2 questions
Average move of a cup with handle in bull markets?
Show answer
About +54%.
Do these statistics apply directly to Indian stocks?
Show answer
Not necessarily; they're from US stocks.
Takeaway Bulkowski's US data ranks patterns: cup with handle and rounding bottoms rate highly, but throwbacks are common.
Gaps#
| Gap | Where | Meaning | Fill tendency |
|---|---|---|---|
| Common / area | Inside a range, low volume | Noise | 85–92% close within a week |
| Breakaway | Out of a base or pattern, high volume | New trend starting | Rarely closes soon (≈1% within a week) |
| Runaway (measuring) | Mid-trend | Trend accelerating; often near the halfway point | Takes months to fill, if ever |
| Exhaustion | Late in a trend, climactic volume | Last burst before reversal | 60–75% close within a week |
| Island reversal | Gap, a few bars, opposite gap | Trapped traders; strong reversal | — |
Check yourself 2 questions
How often do common gaps close within a week?
Show answer
About 85–92%.
Breakaway gaps close soon how often?
Show answer
Rarely, about 1% within a week.
Takeaway Common gaps fill fast, breakaway gaps rarely close soon, runaway gaps mark mid-trend, exhaustion gaps end moves.
Measuring targets#
- Bulkowski's Big W: full-height target hit 74% of the time in bull markets; half height 88%.
- Take partial profits at half height and trail the rest.
- Targets are guides; the next higher-timeframe level often stops price first.
Check yourself 2 questions
Triangle target?
Show answer
Breakout ± the widest height.
Which is hit more often, half or full height?
Show answer
Half height.
Takeaway Targets project the pattern's height; half-height targets are hit far more often than full height.
06Indicators: trend, momentum, volatility and volume
TradingOverview/technical-analysis/handbook/05-technical-indicators · indicators-quick-reference
Indicator quick reference#
| Indicator | Family | Default | Formula sketch | Read | Fails when |
|---|---|---|---|---|---|
| SMA / EMA | Trend | 20 / 50 / 200 | EMA = α·P + (1 − α)·EMA₋₁, α = 2/(N+1) | Price above a rising MA = bullish; crosses | Ranges whipsaw crossovers |
| VWAP | Trend / volume | Session | Σ(typical price × vol) / Σ vol | Above = buyers in control intraday; institutional benchmark | Resets daily; little use on daily charts |
| ADX / DMI | Trend strength | 14 | Smoothed |+DI − −DI| / (+DI + −DI) | ADX above 25 = trending; below 20 = range | Says nothing about direction |
| Ichimoku | Trend system | 9 / 26 / 52 | Tenkan, Kijun, cloud spans shifted +26, Chikou −26 | Price above the cloud = bullish; cloud = S/R | Choppy markets; many lines |
| Parabolic SAR | Trailing stop | 0.02 step, 0.2 max | SAR += AF × (EP − SAR) | Dots flip sides = trend change | Ranges: constant flips |
| Supertrend | Trailing stop | 10, 3 | (H+L)/2 ± 3 × ATR(10), ratcheted | Line below price = long bias | Ranges; gaps through the line |
| RSI | Momentum | 14 | 100 − 100 / (1 + avg gain / avg loss) | 70 / 30 in ranges; 40–80 band in uptrends | Stays overbought in strong trends |
| MACD | Momentum / trend | 12, 26, 9 | EMA12 − EMA26; signal = EMA9; histogram = difference | Signal cross, zero line, divergence | Lags; false crosses in chop |
| Stochastic | Momentum | 14, 3, 3 | %K = (C − L₁₄) / (H₁₄ − L₁₄) × 100 | 80 / 20; %K/%D cross | Noisy in trends |
| CCI | Momentum | 20 | (TP − SMA) / (0.015 × mean deviation) | ±100 extremes | Unbounded; trends |
| Rate of change | Momentum | 10–12 | (C / C₋ₙ − 1) × 100 | Zero-line cross, divergence | No fixed extremes |
| Bollinger Bands | Volatility | 20, 2 | SMA20 ± 2σ | Squeeze → expansion; walking the band = strong trend | Band touch is not a signal alone |
| ATR | Volatility | 14 | Wilder average of true range | Stops and sizing (1.5–3 × ATR) | No direction |
| Keltner Channels | Volatility | EMA20 ± 2 × ATR10 | ATR-based envelope | Bollinger inside Keltner = squeeze (TTM) | No direction |
| Donchian Channels | Breakout | 20 / 55 | Highest high, lowest low of N bars | Turtle breakout entries and exits | Ranges |
| OBV | Volume | — | ± volume by close direction, cumulative | Divergence vs price | Only the slope matters |
| A/D line | Volume | — | Σ ((C − L) − (H − C)) / (H − L) × vol | Accumulation or distribution | Ignores gaps |
| MFI | Volume momentum | 14 | RSI computed on typical price × volume | 80 / 20 | Same as RSI |
| Volume profile | Volume at price | Session / range | Histogram of volume by price | POC, value area (70%), HVN/LVN | Needs good volume data |
| Anchored VWAP | Volume | From an event | VWAP from a chosen bar | Average cost of everyone since the event | Anchor choice is subjective |
Check yourself 2 questions
EMA smoothing factor?
Show answer
α = 2 ÷ (N + 1).
When do moving average crossovers fail?
Show answer
In ranges: whipsaws.
Takeaway Know each indicator's family, default, formula, read and failure mode.
Which indicator for which job?#
Check yourself 2 questions
Which indicator says whether there's a trend at all?
Show answer
ADX: above 25 trending, below 20 ranging.
Which tools give direction?
Show answer
Moving averages and the Ichimoku cloud.
Takeaway Direction → moving averages; trend or not → ADX; momentum → RSI or MACD; volatility → ATR or bands; conviction → volume.
Divergences#
| Type | Price | Oscillator | Meaning |
|---|---|---|---|
| Regular bullish | Lower low | Higher low | Selling momentum fading; possible reversal up |
| Regular bearish | Higher high | Lower high | Buying momentum fading; possible reversal down |
| Hidden bullish | Higher low | Lower low | Uptrend continuation (pullback buy) |
| Hidden bearish | Lower high | Higher high | Downtrend continuation |
- Divergence is a warning, not a trigger: wait for a structure break or trendline break.
- Strong trends can print several divergences before turning.
Check yourself 2 questions
Regular bullish divergence?
Show answer
Price makes a lower low while the oscillator makes a higher low.
What does hidden bullish divergence suggest?
Show answer
Trend continuation up.
Takeaway Regular divergence warns of reversal; hidden divergence signals trend continuation.
Moving-average playbook#
- Trend filter: trade longs only above a rising 200-day SMA (the most watched line for stocks and indices).
- Pullback zones: 20 EMA in strong trends, 50 in normal ones.
- Golden cross (50 over 200) and death cross are slow regime markers, not entries.
- Three-MA alignment (price > 20 > 50 > 200, all rising) is the textbook stage-2 picture.
- EMAs react faster but whipsaw more; SMAs are slower but the 50/200-day lines are the market convention.
Check yourself 2 questions
Pullback zone in a strong trend?
Show answer
The 20 EMA.
What are golden and death crosses good for?
Show answer
Slow regime markers, not precise entries.
Takeaway Trade longs above a rising 200-day SMA, buy pullbacks to the 20 or 50 EMA, and treat crosses as slow regime markers.
RSI in context#
- Range regime: RSI oscillates 30–70; fade the extremes at range edges.
- Bull regime: RSI holds 40–80; dips to 40–50 are buyable pullbacks (Cardwell / Brown ranges).
- Bear regime: RSI holds 20–60; rallies to 55–60 fail.
- Failure swing: RSI breaks its own prior swing before price does.
- RSI(2) below 10 in an uptrend is a classic short-term mean-reversion entry (Connors).
Check yourself 2 questions
In a bull regime, where are RSI dips buyable?
Show answer
Around 40–50.
In a bear regime, where do rallies usually fail?
Show answer
Around 55–60.
Takeaway RSI ranges shift with regime: 30–70 in ranges, 40–80 in bull trends, 20–60 in bear trends.
Volatility toolkit#
- Squeeze: bandwidth at a 6-month low, or Bollinger inside Keltner, means a big move is coming; direction unknown.
- Chandelier exit: highest high since entry − 3 × ATR.
- Volatility contraction pattern (Minervini): successive pullbacks shrink, e.g. 25% → 15% → 8%, before a breakout.
Check yourself 2 questions
True range formula?
Show answer
max(H − L, |H − prev C|, |L − prev C|).
What signals a squeeze?
Show answer
Bandwidth at a six-month low, or Bollinger inside Keltner.
Takeaway True range, ATR, %B and bandwidth; a squeeze means a big move is coming, direction unknown.
Volume rules#
- Volume confirms price: up moves on rising volume, pullbacks on falling volume = healthy trend.
- Breakouts need volume (≥ 1.5× average); a breakout on light volume is suspect.
- Climax volume after a long run often marks exhaustion.
- Volume profile: price moves fast through low-volume nodes and stalls at high-volume nodes; the POC acts like a magnet.
- Relative volume (today vs the same time on recent days) finds stocks in play intraday.
Check yourself 2 questions
Healthy uptrend volume pattern?
Show answer
Rising on up moves, falling on pullbacks.
A breakout on light volume is…?
Show answer
Suspect.
Takeaway Volume confirms healthy trends, breakouts need it, and climax volume after a long run often marks exhaustion.
Common indicator mistakes#
- Stacking three momentum oscillators: they are the same information three times.
- Selling "overbought" in a strong trend.
- Optimising parameters until the backtest shines (curve fitting).
- Ignoring the regime: trend tools in ranges and oscillators in trends.
- Treating crossovers as entries without a level, stop or size.
- Rule of thumb: one trend tool + one momentum or volume tool + ATR is enough.
Check yourself 2 questions
Why is stacking three momentum oscillators a mistake?
Show answer
It's the same information three times.
What is curve fitting?
Show answer
Optimising parameters until the backtest shines, which fails live.
Takeaway Stacking oscillators, selling overbought in trends, curve-fitting, and ignoring the regime.
Indicators in Python (pandas)#
import pandas as pd def ema(s, n): return s.ewm(span=n, adjust=False).mean() def rsi(close, n=14): d = close.diff() gain = d.clip(lower=0).ewm(alpha=1/n, adjust=False).mean() # Wilder smoothing loss = (-d.clip(upper=0)).ewm(alpha=1/n, adjust=False).mean() return 100 - 100 / (1 + gain / loss) def macd(close, fast=12, slow=26, signal=9): line = ema(close, fast) - ema(close, slow) sig = ema(line, signal) return line, sig, line - sig # line, signal, histogram def atr(high, low, close, n=14): prev = close.shift() tr = pd.concat([high - low, (high - prev).abs(), (low - prev).abs()], axis=1).max(axis=1) return tr.ewm(alpha=1/n, adjust=False).mean() def bollinger(close, n=20, k=2): mid = close.rolling(n).mean() sd = close.rolling(n).std(ddof=0) # population std, as charting tools use return mid - k * sd, mid, mid + k * sd def vwap(high, low, close, volume): # one session of intraday bars tp = (high + low + close) / 3 return (tp * volume).cumsum() / volume.cumsum()
Checked against the ta library: MACD, Bollinger and VWAP match exactly; RSI and ATR match after the warm-up bars. Wilder smoothing is an EMA with α = 1/N.
Check yourself 2 questions
pandas EMA one-liner?
Show answer
s.ewm(span=n, adjust=False).mean().What smoothing does RSI use?
Show answer
Wilder smoothing: ewm with alpha = 1/n.
Takeaway EMA via ewm(span=n), RSI with Wilder smoothing via ewm(alpha=1/n).
07Fibonacci, Elliott waves, point and figure
TradingOverview/technical-analysis/book-summary (Technical Analysis of the Futures Markets, Technical Analysis Explained, Encyclopedia of Chart Patterns)
Fibonacci retracements and extensions#
| Level | Use |
|---|---|
| 23.6% | Shallow pullback in a very strong trend |
| 38.2% | Normal pullback in a strong trend |
| 50% | Not Fibonacci, but widely watched (Dow's half retracement) |
| 61.8% | Deep pullback; last line for the trend to stay intact |
| 78.6% | Very deep; harmonic patterns use it |
| 127.2% / 161.8% | Extension targets beyond the prior swing |
Draw from swing low to swing high in an uptrend. Levels work best where they coincide with prior S/R, a moving average or a trendline (confluence).
Check yourself 2 questions
Which retracement suits a very strong trend?
Show answer
23.6% to 38.2%.
What does a break of 61.8% suggest?
Show answer
The trend may not stay intact.
Takeaway 38.2% for strong trends, 61.8% as the last line, 50% widely watched though not Fibonacci.
Elliott wave basics#
- Impulse: 5 waves with the trend (1-2-3-4-5), then a correction of 3 waves (A-B-C).
- Hard rules: wave 2 never retraces beyond the start of wave 1; wave 3 is never the shortest; wave 4 does not overlap wave 1's price territory.
- Guidelines: wave 3 is often 1.618 × wave 1; waves 2 and 4 alternate (sharp vs sideways); wave 5 often equals wave 1.
- Corrections: zigzag (5-3-5, sharp), flat (3-3-5, sideways), triangle (3-3-3-3-3).
- Typical retracements: wave 2 retraces 50–62%, wave 4 about 38%.
- Useful as a map of where you are in a trend; counts are subjective, so trade the invalidation levels.
Check yourself 2 questions
Name the three hard rules.
Show answer
Wave 2 never retraces beyond wave 1's start; wave 3 is never the shortest; wave 4 doesn't overlap wave 1.
How many waves in a correction?
Show answer
Three: A-B-C.
Takeaway Five impulse waves, three corrective; wave 2 never passes wave 1's start, wave 3 is never shortest, wave 4 doesn't overlap wave 1.
Elliott wave cycle#
flowchart TD W1["Wave 1: early buyers"] --> W2["Wave 2: retrace 50–62%"] W2 --> W3["Wave 3: longest, strongest"] W3 --> W4["Wave 4: shallow, sideways"] W4 --> W5["Wave 5: final push, divergence"] W5 --> WA["Wave A: first drop"] WA --> WB["Wave B: bull trap"] WB --> WC["Wave C: completes correction"]
Check yourself 2 questions
Typical retrace of wave 2?
Show answer
50–62%.
Which wave often shows divergence?
Show answer
Wave 5.
Takeaway Wave 3 is the longest and strongest; wave 5 is the final push, often with divergence.
Point and figure charts#
- Plot only price: X columns for rises, O columns for falls. Time and small moves are ignored.
- Box size sets the minimum move counted (e.g. ₹1 for a ₹100 stock, or ATR-based).
- 3-box reversal: a new column starts only after a reversal of three boxes.
- Double-top buy: an X column exceeds the prior X column. Double-bottom sell: an O column breaks the prior O column.
- Count method: width of a congestion area × box size × reversal gives a price target.
- Great for clean S/R and trendlines (45° lines) without noise.
Check yourself 2 questions
What does P&F ignore?
Show answer
Time and small moves.
When does a new column start?
Show answer
After a reversal of three boxes.
Takeaway Point and figure plots only price in X and O columns, ignoring time; box size and a 3-box reversal set sensitivity.
Futures-specific signals (Murphy)#
| Price | Volume | Open interest | Read |
|---|---|---|---|
| Up | Up | Up | Strong: new longs entering |
| Up | Down | Down | Weak: short covering rally |
| Down | Up | Up | Strong: new shorts entering |
| Down | Down | Down | Weak: long liquidation, may be near a low |
COT report: commercials (hedgers) are the "smart money" at extremes; large speculators are trend followers who are most crowded at turns.
India: NSE publishes F&O open interest and participant-wise OI (FII, DII, pro, client) daily.
Check yourself 2 questions
Price up, volume and OI down?
Show answer
Weak: a short-covering rally.
Price down, volume and OI up?
Show answer
Strong: new shorts entering.
Takeaway Price, volume and open interest together separate strong new positioning from weak covering or liquidation.
Other classic tools#
- Pivot points: P = (H + L + C) / 3; R1 = 2P − L; S1 = 2P − H. Intraday levels many traders watch.
- Heikin-Ashi: averaged candles that smooth trends; not real prices, so do not place orders from them.
- Renko: fixed-size bricks, time ignored; clean trends, but late signals.
- Seasonality and cycles: presidential cycle, "sell in May", Diwali / budget effects in India; weak alone, useful as a tie-breaker.
- Market profile (TPO): time spent at each price; value area and initial balance.
Check yourself 2 questions
Pivot point formula?
Show answer
P = (H + L + C) ÷ 3.
Why not place orders from Heikin-Ashi prices?
Show answer
They're averaged, not real prices.
Takeaway Pivot points, Heikin-Ashi, Renko and others; Heikin-Ashi candles aren't real prices.
08Advanced: smart money, Wyckoff, intermarket and breadth
TradingOverview/technical-analysis/handbook/06-advanced-concepts · book-summary/technical-analysis-explained (Pring)
Smart money concepts (SMC)#
| Concept | Definition | How it is traded |
|---|---|---|
| Order block | Last opposite candle before a strong impulsive move | Enter on the retest of that candle's range; stop beyond it |
| Fair value gap (FVG) | Three-candle imbalance: candle 1 and candle 3 ranges do not overlap | Price often returns to fill it; enter in the trend direction inside the gap |
| Liquidity pool | Equal highs or lows where stops cluster | Wait for the sweep and a close back inside, then trade the reversal |
| BOS / CHoCH | Break of structure (continuation) / change of character (first counter break) | CHoCH is the condition before looking for reversal entries |
| Premium / discount | Above or below the 50% level of the current swing | Buy in discount, sell in premium |
SMC renames classic ideas (supply and demand zones, gaps, stop runs). Judge it by the same rules: level, confirmation, stop, size.
Check yourself 2 questions
What is an order block?
Show answer
The last opposite candle before a strong impulsive move.
Define a fair value gap.
Show answer
A three-candle imbalance where candle 1 and candle 3's ranges don't overlap.
Takeaway Order blocks, fair value gaps and liquidity sweeps describe where large players left footprints; trade their retests with stops beyond.
Wyckoff accumulation sequence#
flowchart TD PS["Preliminary support"] --> SC["Selling climax"] SC --> AR["Automatic rally"] AR --> ST["Secondary test"] ST --> SP["Spring"] SP --> SOS["Sign of strength"] SOS --> LPS["Last point of support"] LPS --> MU["Markup"]
Distribution mirrors it: preliminary supply, buying climax, automatic reaction, secondary test, upthrust, sign of weakness, last point of supply, markdown.
Check yourself 2 questions
What is the spring in Wyckoff accumulation?
Show answer
A shakeout below the range that quickly reverses.
What follows the last point of support?
Show answer
Markup.
Takeaway Preliminary support, selling climax, automatic rally, secondary test, spring, sign of strength, last point of support, markup.
Wyckoff in practice#
- Three laws: supply and demand (price), cause and effect (the length of the range sets the size of the move), effort vs result (volume vs price progress).
- Phases A–E: A stops the prior trend, B builds the cause, C tests (spring or upthrust), D shows strength or weakness, E is the trend out of the range.
- Spring trade: long after the false break below the range closes back inside; stop under the spring low; target the range top, then the measured cause.
- Upthrust trade: the mirror image at the top of a distribution range.
- Effort vs result: heavy volume with little price progress means the other side is absorbing.
Check yourself 2 questions
Wyckoff's cause and effect law?
Show answer
The length of the range (cause) sets the size of the move (effect).
What does effort versus result compare?
Show answer
Volume against price progress.
Takeaway Three laws: supply and demand, cause and effect, effort versus result; phases A to E.
Intermarket relationships#
| Relationship | Usual direction | Use |
|---|---|---|
| Bond yields vs equity valuations | Inverse (higher yields compress P/E, esp. growth) | Yields breaking out = headwind for long-duration stocks |
| US dollar (DXY) vs commodities | Inverse | Gold or oil breakout fighting a rising DXY is weaker |
| Gold vs real yields | Inverse | Falling real yields support gold |
| Copper vs growth | Same direction ("Dr Copper") | Equities rising while copper falls is a warning |
| High-yield credit spreads vs stocks | Inverse | Widening spreads often lead equity corrections |
| 2Y–10Y curve | Inversion precedes recessions (6–24 months) | Re-steepening after inversion is the late, risky stage |
| AUD/JPY, CAD/JPY | Rise in risk-on | Quick risk-appetite gauge |
India: watch the 10-year G-sec yield, USD/INR, crude oil (India imports most of its oil) and FII flows alongside the Nifty.
Check yourself 2 questions
Bond yields breaking out: good or bad for long-duration growth stocks?
Show answer
Bad: higher yields compress P/E.
Usual relationship between the US dollar and commodities?
Show answer
Inverse.
Takeaway Higher yields compress valuations, a strong dollar weighs on commodities; intermarket breaks give early warnings.
Breadth indicators#
| Indicator | Formula | Signal |
|---|---|---|
| Advance–decline line | Cumulative (advances − declines) | Index new high without A/D new high = narrow, fragile rally |
| McClellan Oscillator | 19-day EMA − 39-day EMA of net advances | Extremes beyond about ±70 to ±100 = stretched breadth |
| New highs − new lows | 52-week highs minus lows | Shrinking new highs in a rising market = distribution |
| % above 200-day MA | Share of index members above their 200-DMA | Above 70% strong; below 20–30% washed out |
| Arms index (TRIN) | (adv / dec) ÷ (adv vol / dec vol) | Above 1 bearish intraday; very high readings near capitulation |
Check yourself 2 questions
Advance–decline line formula?
Show answer
Cumulative (advances − declines).
Index makes a new high but the A/D line doesn't. Read?
Show answer
A narrow, fragile rally.
Takeaway Breadth checks how many stocks join a move; an index high without an A/D high is a narrow, fragile rally.
Sentiment (contrarian at extremes)#
- Put/call ratio: very high = fear (bullish contrarian); very low = complacency.
- Volatility index: VIX or India VIX spikes mark panic lows more reliably than they mark tops.
- Surveys: AAII bulls vs bears; extreme readings are contrarian.
- Insider buying: clusters of insider purchases are more informative than sales.
- Margin debt and IPO frenzy rise into tops.
- Dow Theory and O'Neil: a follow-through day (a big index gain on higher volume, usually 4–10 days after a low) confirms a new uptrend; 4–5 distribution days (index down on higher volume) within a few weeks warn of a top.
Check yourself 2 questions
Very high put/call ratio: contrarian read?
Show answer
Fear, which is contrarian bullish.
Do VIX spikes mark tops or bottoms more reliably?
Show answer
Panic lows.
Takeaway Sentiment works contrarian at extremes: very high put/call or VIX spikes mark fear lows.
Relative strength#
- RS line = stock ÷ index. A rising RS line means the stock is beating the market, even in a falling market.
- RS line at a new high before price is one of the strongest leadership tells (O'Neil, Minervini).
- Mansfield RS = (RS ÷ 52-week average of RS − 1) × 100; above zero = outperforming.
- RS rating (1–99 percentile of 12-month performance): leaders usually rate 80–90+.
- Relative rotation graphs place sectors in leading, weakening, lagging and improving quadrants.
- Top-down: strong market → strong sector → strongest stocks in that sector.
Check yourself 2 questions
What does a rising RS line in a falling market mean?
Show answer
The stock is beating the market.
Strongest RS leadership tell?
Show answer
The RS line making a new high before price does.
Takeaway RS line = stock ÷ index; an RS high before a price high is a strong leadership tell.
India market data to watch#
| Data | Where | Read |
|---|---|---|
| India VIX | NSE | Rising sharply = fear; low and falling = calm trend |
| Nifty option chain PCR and max OI strikes | NSE option chain | Big put OI often acts as support, call OI as resistance near expiry |
| FII / DII cash flows | NSE daily provisional data | Persistent FII selling with DII buying = tug of war |
| Participant-wise F&O OI | NSE daily reports | FII index futures long/short ratio as a positioning gauge |
| Delivery % | NSE security-wise delivery data | High delivery on up days = genuine buying, not intraday churn |
| F&O ban list | NSE (stocks over 95% of market-wide position limit) | No fresh positions; expect erratic moves |
Check yourself 2 questions
Near expiry, what does big put OI at a strike often act as?
Show answer
Support.
India VIX rising sharply signals what?
Show answer
Fear.
Takeaway India VIX, option-chain PCR and max OI strikes, FII/DII flows and breadth round out the Indian picture.
09Strategies and setups
TradingOverview/technical-analysis/handbook/07-trading-strategies · book-summary/how-to-make-money-in-stocks (O'Neil) · getting-started-in-technical-analysis (Schwager)
Strategy styles compared#
| Style | Holding | Charts | Typical win rate | Typical R:R | Works in | Main risk |
|---|---|---|---|---|---|---|
| Scalping | Seconds–minutes | 1m, 5m, tick | 60%+ needed | 1:0.5 – 1:1 | Liquid, active sessions | Costs and slippage eat the edge |
| Intraday momentum | Minutes–hours | 5m, 15m | 45–55% | 1:1.5 – 1:2 | Stocks in play, news days | Fakeouts at the open |
| Swing | Days–weeks | Daily, 4H | 40–55% | 1:2 – 1:3 | Trends and clean ranges | Overnight gaps |
| Position | Weeks–months | Weekly, daily | 35–50% | 1:3 – 1:5+ | Major trends | Wide stops, regime change |
| Trend following | Weeks–months | Daily | 35–45% | 2:1 – 5:1 | Trending markets | Long drawdowns in chop |
| Mean reversion | Hours–days | Hourly, daily | 55–70% | 1:1 – 1:1.5 | Ranges | Strong trends ("oversold gets more oversold") |
| Breakout | Days–weeks | Daily | 35–50% | 1:2+ | After contraction | False breakouts |
Check yourself 2 questions
Main risk of scalping?
Show answer
Costs and slippage eating the edge.
What win rate does scalping typically need?
Show answer
60% or more, with low reward to risk.
Takeaway Scalping, intraday momentum, swing, position and trend following trade off win rate, reward to risk and costs.
Setup library#
| Setup | Context | Trigger | Stop | Exit |
|---|---|---|---|---|
| Trend pullback | HH/HL, price above rising 50-DMA | Bullish candle at the 20/50 EMA or prior HL; buy over its high | Below the pullback low | Prior high, then trail swing lows |
| Base breakout | 5+ week base, tightening, volume drying up | Close above the pivot on ≥ 1.5× volume | Below the base or 7–8% | 20–25% or trail the 50-DMA |
| Failed breakdown (spring) | Range or support | Sweep below support, close back inside | Below the sweep low | Range top |
| Range fade | ADX below 20, tested edges | Rejection candle at the edge | Beyond the edge | Midpoint or opposite edge |
| Opening range breakout | Stock in play, gap with news | Break of the first 15- or 30-minute range | Other side of the range or VWAP | 1–2R or end of day |
| VWAP reclaim | Intraday uptrend that dipped | Close back above VWAP with volume | Below the reclaim low | Day high, then trail |
| RSI(2) pullback | Price above the 200-DMA | RSI(2) below 10 | Time stop or wide stop | Close above the 5-DMA |
| Donchian breakout (Turtle) | Any trending market | New 20- or 55-day high | 2 × ATR | 10- or 20-day low |
Check yourself 2 questions
Trend pullback trigger?
Show answer
A bullish candle at the 20/50 EMA or prior higher low; buy over its high.
Where's the stop on a trend pullback?
Show answer
Below the pullback low.
Takeaway Each setup has context, trigger, stop and exit: trend pullbacks, base breakouts, range fades and more.
Which strategy fits right now?#
Check yourself 2 questions
Clear HH/HL and ADX above 25: which strategy?
Show answer
Trend following: pullbacks and break-of-structure entries.
Clean range with tested edges?
Show answer
Mean reversion: fade the edges, target the midpoint.
Takeaway Trend with ADX above 25 → trend following; clean range → mean reversion; squeeze → breakout; unclear → stand aside.
Breakout trade plan#
flowchart TD B1["Base of 5+ weeks after a prior uptrend"] --> B2["Pullbacks contract, volume dries up"] B2 --> B3["Mark the pivot: top of the handle or base"] B3 --> B4["Buy the close above the pivot on 1.5x volume"] B4 --> B5["Stop under the last contraction, max 7–8%"] B5 --> B6["Add only if it holds the pivot on a retest"] B6 --> B7["Sell into 20–25% or trail the 50-day line"]
Check yourself 2 questions
What volume confirms the breakout?
Show answer
About 1.5× average.
What should pullbacks do inside the base?
Show answer
Contract, with volume drying up.
Takeaway A 5+ week base after an uptrend, contracting pullbacks, a pivot, a close above it on 1.5× volume, stop below the pivot.
CAN SLIM (O'Neil)#
| Letter | Rule |
|---|---|
| C | Current quarterly EPS up ≥ 20–25% year on year (leaders often 40%+), with sales growth too |
| A | Annual EPS growth ≥ 25% over 3–5 years; ROE ≥ 17% |
| N | New product, management or industry change, and price at or near new highs out of a base |
| S | Supply and demand: big volume on up days, share buybacks |
| L | Leader, not laggard: RS rating 80+ (avoid below 70) |
| I | Rising institutional sponsorship, not over-owned |
| M | Market direction: buy only in a confirmed uptrend (follow-through day) |
Sell rules: cut every loss at 7–8% below the buy point; take most gains at 20–25%, but hold 8 weeks if a stock gains 20% within 1–3 weeks of breaking out.
Check yourself 2 questions
What does the C stand for?
Show answer
Current quarterly EPS up at least 20–25% year on year.
What does the M stand for?
Show answer
Market direction.
Takeaway O'Neil's CAN SLIM combines earnings growth, new highs, supply and demand, leadership, institutional support and market direction.
Pyramiding and scaling (Schwager)#
- Add only to positions that already show a profit.
- Do not add if the new combined stop would turn the whole position into a loss.
- Each added unit is no larger than the first (a pyramid, not an inverted one).
- Add at logical points: a breakout from a consolidation, or a retest of a broken level.
- Exit adds on tighter conditions than the core position.
- Never average down a losing trade; scaling in is only for confirmed trades with total risk fixed in advance.
Check yourself 2 questions
Should you add to a losing position?
Show answer
No; add only to positions already in profit.
Why should each added unit be no larger than the first?
Show answer
A pyramid, not an inverted one, keeps average cost and risk under control.
Takeaway Add only to winners, never so the combined stop turns the position into a loss, and each add no larger than the first.
Exits and trailing stops#
| Method | Rule | Fits |
|---|---|---|
| Fixed target | Next level or 2R | Ranges, mean reversion |
| Partial + trail | Take half at 1–2R, move stop to breakeven, trail the rest | Swing trades |
| Structure trail | Below each new higher low | Trends |
| MA trail | Close below the 20 EMA (fast) or 50-DMA (slow) | Momentum leaders |
| Chandelier / ATR | Highest high − 3 × ATR | Volatile trends |
| Time stop | Exit if no progress in N bars | Breakouts that stall |
Check yourself 2 questions
Partial-plus-trail method?
Show answer
Take half at 1–2R, move the stop to breakeven, trail the rest.
Structure trail in a trend?
Show answer
Below each new higher low.
Takeaway Fixed targets suit ranges; partial-plus-trail suits swings; structure and MA trails suit trends.
10Risk management and position sizing
TradingOverview/technical-analysis/handbook/08-risk-management · general-trading/risk-management-formulas
Position size from the stop#
| Worked example | Value |
|---|---|
| Account | ₹10,00,000 |
| Risk per trade (1%) | ₹10,000 |
| Entry / stop | ₹500 / ₹480 → ₹20 per share |
| Shares | 10,000 ÷ 20 = 500 |
| Position value | ₹2,50,000 (25% of capital, but only 1% at risk) |
| Target ₹540 | R:R = 40 ÷ 20 = 2 |
Always pick the stop first, then the size. Futures and options: risk per unit = stop distance × lot size (or point value).
Main card on position sizing: Risk management → Also in OV technicals · Futures · Options basics · Options strategies · Algo trading · Stock basics · AmiBroker AFL.
Check yourself 2 questions
₹10 lakh account, 1% risk: rupee risk?
Show answer
₹10,000.
R:R formula?
Show answer
(Target − entry) ÷ (entry − stop).
Takeaway Shares = account × risk% ÷ |entry − stop|, rounded down.
Win rate needed to break even#
| Reward : risk | Break-even win rate | With 0.1R costs |
|---|---|---|
| 0.5 : 1 | 66.7% | 73.3% |
| 1 : 1 | 50.0% | 55.0% |
| 1.5 : 1 | 40.0% | 44.0% |
| 2 : 1 | 33.3% | 36.7% |
| 3 : 1 | 25.0% | 27.5% |
Costs hurt small-target styles most: a scalper at 0.5R needs 73% winners once costs reach 0.1R.
Main card on expectancy and win rate: Risk management → Also in this sheet · OV technicals.
Check yourself 2 questions
Break-even win rate at 2:1?
Show answer
33.3% (about 36.7% with 0.1R costs).
At 0.5:1 reward to risk?
Show answer
66.7%.
Takeaway Break-even win rate = 1 ÷ (1 + R); costs push it higher.
Expectancy and Kelly#
| Win rate | Avg win | Expectancy | Full Kelly |
|---|---|---|---|
| 40% | 2R | +0.20R | 10% |
| 50% | 1.5R | +0.25R | 16.7% |
| 60% | 1R | +0.20R | 20% |
| 35% | 3R | +0.40R | 13.3% |
| 50% | 2R | +0.50R | 25% |
Full Kelly is far too aggressive for real, uncertain edges. Use ¼–½ Kelly as a ceiling, or simply a fixed 0.5–2% per trade.
Main card on expectancy and win rate: Risk management → Also in this sheet · OV technicals.
Check yourself 2 questions
40% wins at 2R: expectancy?
Show answer
+0.20R.
Kelly formula?
Show answer
f* = (p·b − q) ÷ b, with b = average win ÷ average loss.
Takeaway Expectancy in R measures edge; Kelly f* = (p·b − q) ÷ b gives the growth-optimal fraction, usually bet at a fraction.
Drawdowns: the asymmetry#
| Drawdown | Gain needed to recover |
|---|---|
| 10% | 11.1% |
| 20% | 25.0% |
| 30% | 42.9% |
| 40% | 66.7% |
| 50% | 100% |
| 60% | 150% |
| 75% | 300% |
| 90% | 900% |
Main card on drawdown recovery: Risk management → Also in Risk management · OV technicals.
Check yourself 2 questions
Gain needed after a 40% drawdown?
Show answer
66.7%.
After 75%?
Show answer
300%.
Takeaway Gain needed = 1 ÷ (1 − drawdown) − 1: a 50% drawdown needs 100%.
Losing streaks are normal#
| Win rate | ≥ 4 losses | ≥ 6 | ≥ 8 | ≥ 10 | ≥ 12 |
|---|---|---|---|---|---|
| 35% | 100% | 96% | 69% | 37% | 17% |
| 40% | 100% | 87% | 49% | 20% | 8% |
| 50% | 97% | 55% | 17% | 4% | 1% |
| 60% | 80% | 21% | 4% | 1% | 0% |
Chance of at least one losing streak of that length somewhere in 100 trades. A 40% trend follower should expect 6+ losses in a row.
Check yourself 2 questions
40% win rate: chance of at least 8 losses in a row in 100 trades?
Show answer
About 49%.
Why does this matter for sizing?
Show answer
Size must survive streaks you will certainly meet.
Takeaway Over 100 trades, long losing streaks are near certain at typical win rates.
Ten straight losses at each risk level#
| Risk per trade | After 10 losses | After 20 losses |
|---|---|---|
| 0.5% | −4.9% | −9.5% |
| 1% | −9.6% | −18.2% |
| 2% | −18.3% | −33.2% |
| 5% | −40.1% | −64.2% |
| 10% | −65.1% | −87.8% |
Compounded on the remaining balance. At 1% a bad streak is an annoyance; at 5–10% it ends the account.
Check yourself 2 questions
Ten straight losses at 2% risk?
Show answer
About −18%.
At 10% risk?
Show answer
About −65%.
Takeaway At 1% risk ten losses cost about 10%; at 10% they cost about two-thirds.
Portfolio and daily limits#
| Rule | Typical setting | Why |
|---|---|---|
| Risk per trade | 0.5–2% (1% common; 0.5% while learning) | Survive streaks |
| Max open risk | 5–6% across all positions | All stops can hit on the same day |
| Correlated positions | Treat as one position (e.g. three IT stocks) | They fall together |
| Max daily loss | 2–3%; stop trading for the day | Prevents revenge cascades |
| Drawdown brake | Halve risk after a 10% drawdown until a new equity high | Shrinks the second leg of a drawdown |
| Leverage | Minimal while learning; F&O only with defined risk | Leverage magnifies mistakes faster than skill |
| Event risk | Flat or reduced size into earnings, RBI policy, budget, CPI | Gaps jump past stops |
Check yourself 2 questions
Typical max open risk across positions?
Show answer
5–6%.
How should three correlated positions be treated?
Show answer
As one position.
Takeaway 0.5–2% per trade, 5–6% max open risk, correlated positions counted as one, plus daily loss caps.
11Trading psychology, plan and journal
TradingOverview/technical-analysis/handbook/09-trading-psychology · general-trading/general-tips
Biases that cost money#
| Bias | Looks like | Counter |
|---|---|---|
| Loss aversion | Holding losers, cutting winners early | Stop and target set before entry |
| Confirmation | Reading only bullish views while long | Write the invalidation level first |
| Recency | "Three wins in a row, I'm on a roll" | Same size and rules every trade |
| Anchoring | "I'll sell when it gets back to my price" | Use levels, not your entry price |
| Overconfidence | Bigger size after a streak | Fixed risk % |
| FOMO | Chasing extended moves | No setup, no trade |
| Sunk cost | Averaging down to "get back" | Each trade judged on its own |
Check yourself 2 questions
Counter to confirmation bias?
Show answer
Write the invalidation level first.
Counter to loss aversion?
Show answer
Set the stop and target before entry.
Takeaway Loss aversion, confirmation, recency, overconfidence and anchoring each have a rule-based counter.
Fear, greed and revenge#
- Fear: skipping valid setups, closing winners early, moving the stop to breakeven too soon.
- Greed: oversizing, adding without a plan, holding past the target hoping for more.
- Revenge trading: forcing a trade right after a loss, often larger. Rule: 30–60 minutes off after an emotional loss.
- Overtrading: boredom or FOMO trades. Cap trades per day; "no setup" is a valid outcome.
- Ask: "Would I have written this exception into my plan when I was calm?" If not, don't.
Check yourself 2 questions
Name a fear behaviour.
Show answer
Any of: skipping valid setups, closing winners early, moving the stop to breakeven too soon.
What is revenge trading?
Show answer
Forcing a trade right after a loss to win it back.
Takeaway Fear skips setups and cuts winners, greed oversizes, revenge forces trades after losses.
Written trading plan#
- Markets and timeframes: what you trade and which charts set trend, setup and trigger.
- Setups: exact entry conditions, one sentence each.
- Risk: % per trade, max open risk, max daily loss, max trades per day.
- Orders: limit at a level or stop on a break; where the stop goes.
- Exits: targets, partials, trailing rules, time stops.
- When not to trade: first 15 minutes, before major news, after 3 losses, when tired or upset.
- Review: weekly journal review; change the plan monthly, with data.
Check yourself 2 questions
Name three risk items in the plan.
Show answer
Any three of: % per trade, max open risk, max daily loss, max trades per day.
How long should each setup description be?
Show answer
One sentence of exact entry conditions.
Takeaway Markets and timeframes, exact setups, risk limits, order rules and review routines, written down.
Journal and performance metrics#
- Log every trade: setup, timeframe, entry, stop, target, exit, P&L in ₹ and in R, emotion, rule followed (yes/no), screenshot.
- Weekly: win rate, average R, number of rule breaks, best and worst trade.
- Monthly: expectancy, max drawdown, profit factor, results by setup type.
- Study losers: bad setup, bad execution or bad luck? Only the first two need fixing.
- Change one thing at a time and judge it over 20+ trades.
Check yourself 2 questions
Name three fields to log per trade.
Show answer
Any three of: setup, timeframe, entry, stop, target, exit, P&L in ₹ and R, emotion, rule followed, screenshot.
What's reviewed monthly?
Show answer
Expectancy, max drawdown and similar performance metrics.
Takeaway Log every trade with R, emotion and rule adherence; review weekly and monthly.
12Backtesting, walk-forward and forward testing
TradingOverview/technical-analysis/handbook/10-backtesting
Backtest steps#
- Rules: unambiguous entry, stop, exit and size. Every vague word becomes a bug.
- Data: enough history (5–10 years daily), adjusted for splits and dividends, survivorship-free if picking stocks.
- Simulate: signal on bar t, fill on bar t+1 open; include brokerage, taxes (STT in India), spread and slippage.
- Record: every trade, then compute metrics.
- Validate: out-of-sample, walk-forward, other symbols, parameter neighbourhoods.
- Forward test: paper or minimum size before scaling.
Check yourself 2 questions
How much daily history is enough?
Show answer
About 5–10 years, adjusted for splits and dividends.
When should a signal on bar t fill?
Show answer
On bar t+1.
Takeaway Unambiguous rules, clean adjusted data, signals on bar t filled on bar t+1, full costs, then metrics.
Backtest pitfalls#
| Pitfall | How it sneaks in | Fix |
|---|---|---|
| Look-ahead bias | Signal and fill on the same close | Shift signals one bar |
| Survivorship bias | Testing today's index members only | Point-in-time constituents incl. delisted stocks |
| Overfitting | RSI 17, ATR × 2.37 "work best" | Few parameters; robust neighbourhoods |
| Ignoring costs | Zero brokerage, no slippage | 1–2 ticks per side plus all charges |
| Unrealistic fills | Filled at the exact high or low | Conservative fills; gap through stops |
| Data snooping | Trying hundreds of ideas, keeping the best | Hold out data from the start; count your trials |
Main card on honest backtesting: Quant trading → Also in Algo trading · Algo trading · Quant trading · AmiBroker AFL.
Check yourself 2 questions
Fix for look-ahead bias?
Show answer
Shift signals one bar.
Fix for survivorship bias?
Show answer
Point-in-time constituents including delisted stocks.
Takeaway Look-ahead, survivorship and overfitting each inflate backtests; each has a fix.
Metrics to report#
| Metric | Formula | Healthy |
|---|---|---|
| CAGR | (end ÷ start)^(1/years) − 1 | Beats buy and hold after costs |
| Max drawdown | min(equity ÷ running peak − 1) | Within your tolerance |
| Sharpe | √252 × mean daily return ÷ std | Above 1 is good for a single strategy |
| Sortino | Sharpe using downside deviation | Higher than Sharpe |
| MAR / Calmar | CAGR ÷ |max drawdown| | Above 0.5 |
| Profit factor | Gross profit ÷ gross loss | Above 1.3 out of sample |
| Expectancy | Average R per trade | Positive with 100+ trades |
| Exposure | Share of time in the market | Context for returns |
Check yourself 2 questions
Max drawdown formula?
Show answer
min(equity ÷ running peak − 1).
What Sharpe is good for a single strategy?
Show answer
Above 1.
Takeaway CAGR, max drawdown, Sharpe and more; a strategy must beat buy-and-hold after costs.
Walk-forward testing#
flowchart TD W1["Optimise 2015–2018"] --> T1["Test 2019"] T1 --> W2["Optimise 2016–2019"] W2 --> T2["Test 2020"] T2 --> W3["Optimise 2017–2020"] W3 --> T3["Test 2021"] T3 --> ST["Stitch the test years"]
- Rolling windows keep a fixed in-sample length; anchored windows grow from one start date.
- In-sample : out-of-sample of 3:1 to 5:1; at least 30 trades per test window.
Check yourself 2 questions
After optimising 2015–2018, which year is tested?
Show answer
2019.
What do you stitch together at the end?
Show answer
The out-of-sample test years.
Takeaway Optimise on a window, test the next period, roll forward and stitch the test years.
Walk-forward efficiency (WFE)#
| WFE | Read |
|---|---|
| Above 0.7 | Strong: generalises well |
| 0.5–0.7 | Acceptable decay |
| 0.3–0.5 | Weak: suspect overfitting or regime dependence |
| Below 0.3 or negative | Curve-fit; do not trade |
Also require 60–70% of test windows to be profitable and stable best parameters from window to window.
Check yourself 2 questions
WFE formula?
Show answer
Annualised out-of-sample return ÷ annualised in-sample return.
WFE of 0.4 suggests what?
Show answer
Weak: suspect overfitting or regime dependence.
Takeaway WFE = out-of-sample ÷ in-sample annual return; above 0.7 generalises well, below 0.3 is curve-fit.
Forward testing#
| Style | Minimum trades | Duration |
|---|---|---|
| Scalping | 200–500 | 2–4 weeks |
| Intraday | 100–200 | 1–2 months |
| Swing | 50–100 | 2–4 months |
| Position | 30–60 | 6–12 months |
- Within 20% of backtest metrics: on track.
- 20–40% worse: investigate fills, rule breaks, regime.
- More than 40% worse or negative expectancy: stop.
- Never retune during the test; a change restarts the clock.
Check yourself 2 questions
Minimum forward-test trades for swing trading?
Show answer
About 50–100.
Results 20–40% worse than backtest: what to do?
Show answer
Investigate fills and rule adherence.
Takeaway Paper-trade enough trades for the style; results within 20% of the backtest are on track.
A vectorised backtest without look-ahead (pandas)#
import numpy as np import pandas as pd def backtest_sma(close, fast=20, slow=50, cost_bps=10): """Long when fast SMA > slow SMA. Signal on today's close, trade on the next bar.""" signal = (close.rolling(fast).mean() > close.rolling(slow).mean()).astype(int) position = signal.shift(1).fillna(0) # no look-ahead ret = close.pct_change().fillna(0) trades = position.diff().abs().fillna(0) # 1 on every entry or exit strat = position * ret - trades * cost_bps / 10_000 # cost per side equity = (1 + strat).cumprod() years = len(close) / 252 cagr = equity.iloc[-1] ** (1 / years) - 1 drawdown = equity / equity.cummax() - 1 sharpe = np.sqrt(252) * strat.mean() / strat.std() return {"CAGR": cagr, "MaxDD": drawdown.min(), "Sharpe": sharpe, "Trades": int(trades.sum()), "Exposure": position.mean()} def position_size(account, risk_pct, entry, stop): risk_amount = account * risk_pct per_share = abs(entry - stop) return int(risk_amount // per_share) # round down position_size(1_000_000, 0.01, 500, 480) # 500 shares
The single shift(1) is what separates an honest backtest from a fantasy: the signal uses today's close, the position starts tomorrow. Costs are charged on every entry and exit.
Check yourself 2 questions
How do you avoid look-ahead in a vectorised backtest?
Show answer
Shift the signal one bar before applying returns.
When are costs charged?
Show answer
When the position changes.
Takeaway Compute the signal on today's close, trade on the next bar, and subtract costs on position changes.
Robustness checks#
- Parameter plateau: SMA 18, 20, 22 should all work; a lone spike is noise.
- Other markets: the same rules on several stocks or indices.
- Sub-periods: bull, bear and sideways years separately.
- Monte Carlo: reshuffle trade order to see the range of drawdowns; permutation tests check for a real edge.
- Economic logic: prefer rules with a reason behind them.
- A robust 55%-win, 1:1.5 system beats a fragile 70%-win one.
Check yourself 2 questions
What does a parameter plateau look like?
Show answer
Neighbouring values (SMA 18, 20, 22) all work.
What does a Monte Carlo reshuffle test?
Show answer
How sensitive drawdowns are to trade order.
Takeaway Parameter plateaus, other markets, sub-periods and Monte Carlo reshuffles separate edge from noise.
Tools#
| Tool | Style | Best for |
|---|---|---|
| TradingView / Pine Script | Visual, bar-close fills | Quick idea checks |
| pandas custom loop | Full control | Learning exactly how fills work |
| vectorbt | Vectorised | Parameter scans across many symbols |
| backtrader | Event-driven | Complex order logic |
| Amibroker | Desktop, fast | Popular with Indian EOD traders |
Check yourself 2 questions
Which tool suits parameter scans across many symbols?
Show answer
vectorbt.
Which suits learning exactly how fills work?
Show answer
A custom pandas loop.
Takeaway TradingView for quick checks, a pandas loop to learn fills, vectorbt for scans, backtrader for event-driven tests.
13Algorithmic trading and automation
TradingOverview/technical-analysis/handbook/11-algorithmic-trading
From hypothesis to live#
flowchart TD H["Hypothesis with an economic reason"] --> R["Rules written in plain language"] R --> B["Backtest with costs, 200+ trades"] B --> W["Walk-forward, WFE above 0.5"] W --> P["Paper trade 30–100 trades"] P --> L["Live at minimum size"] L --> SC["Scale with hard limits and a kill switch"]
Check yourself 2 questions
Minimum backtest trades suggested?
Show answer
200 or more.
What WFE should walk-forward reach before paper trading?
Show answer
Above 0.5.
Takeaway Hypothesis with a reason, plain-language rules, a costed backtest with 200+ trades, walk-forward WFE above 0.5, paper trading, then small live size.
Quant strategy families#
| Type | Win rate | Win : loss | Works in | Breaks when |
|---|---|---|---|---|
| Trend following | 35–45% | 2:1 – 5:1 | Trends | Ranges |
| Mean reversion | 55–70% | 1:1 – 1.5:1 | Ranges | Strong trends |
| Statistical arbitrage | 60–75% | 1:1 – 2:1 | Any (market-neutral) | Pairs decouple |
| Market making | 70–85% | 0.5:1 – 1:1 | Liquid, calm markets | Fast one-way moves |
Stat arb tests: cointegration (Engle–Granger, Johansen); trade the z-score of the spread.
Check yourself 2 questions
Typical trend-following win rate?
Show answer
About 35–45%, with 2:1 to 5:1 wins.
When does mean reversion break?
Show answer
In strong trends.
Takeaway Trend following wins rarely but big; mean reversion wins often but small; stat arb is market-neutral until pairs decouple.
Levels of automation#
- Manual with checklist: a script prints signals; you decide and place orders.
- Semi-automated: alerts or one-click orders; you supervise each trade.
- Fully automated: orders through the broker API; you handle exceptions only.
Move up a level only after the strategy is validated and you understand partial fills, rejects and disconnects.
Check yourself 2 questions
What does semi-automated mean?
Show answer
Alerts or one-click orders, with you supervising each trade.
In full automation, what's your job?
Show answer
Handling exceptions.
Takeaway Manual with a checklist, semi-automated with alerts, or fully automated with you handling exceptions.
Production safety#
- Kill switch: flatten all positions and halt at a daily loss limit.
- Hard limits in code: max position, max orders per minute, max daily loss.
- Heartbeat: alert if the bot has not logged activity in N minutes.
- Reconnect logic for data feeds and token refreshes.
- Run on a server (VPS or cloud), not a laptop.
- Version control; separate dev, paper and live; never hot-fix a live bot after a loss.
- Keep API keys out of code and repositories.
Check yourself 2 questions
What does a kill switch do?
Show answer
Flattens all positions and halts at a daily loss limit.
What does a heartbeat alert catch?
Show answer
A bot that has stopped logging activity.
Takeaway Kill switch, hard limits in code, heartbeats and reconnect logic keep a bot safe.
APIs and data sources#
| Need | India | Global |
|---|---|---|
| Broker order APIs | Zerodha Kite Connect, Upstox, Angel One SmartAPI, Dhan, Fyers, ICICI Breeze | Interactive Brokers, Alpaca, OANDA |
| Historical data | Broker historical APIs, NSE bhavcopy (EOD), paid vendors | yfinance, Alpha Vantage, Polygon |
| Macro data | RBI DBIE, MoSPI (CPI, IIP, GDP) | FRED |
| Python wrappers | kiteconnect, smartapi-python | ib_insync, alpaca-py |
India: SEBI's 2025 framework for retail algorithmic trading routes algos through brokers, tags algo orders, and requires registration above an exchange-set orders-per-second threshold, with API access tied to registered static IPs. Check the current circulars before automating.
Check yourself 2 questions
Name two Indian broker order APIs.
Show answer
Any two of: Kite Connect, Upstox, Angel One SmartAPI, Dhan, Fyers, ICICI Breeze.
Free end-of-day source for NSE data?
Show answer
NSE bhavcopy.
Takeaway Indian broker APIs (Kite, Upstox, SmartAPI, Dhan, Fyers, Breeze) and data from broker history, NSE bhavcopy or vendors.
14Common mistakes and fixes
TradingOverview/technical-analysis/handbook/12-common-mistakes · tips-and-tricks
Mistake → consequence → fix#
| Mistake | Consequence | Fix |
|---|---|---|
| No written plan | Random, emotional trades | One page of rules; trade only those setups |
| No stop, or moving it further away | One trade erases months | Stop placed before entry; it only moves toward profit |
| Risking 5–10% per trade | Normal streaks become disasters | 0.5–2% per trade |
| Averaging down | Bigger position in the wrong direction | Add only to winners, within a fixed total risk |
| Trading against the higher timeframe | Low base-rate setups | Check one or two timeframes up |
| Chasing extended moves | Buying the top of the candle | Wait for a pullback or skip |
| Indicator overload | Contradictory signals, late entries | One trend tool, one momentum or volume tool, ATR |
| Trading into news or earnings | Gaps through stops | Check the calendar; reduce or flatten |
| Ignoring costs | Gross edge, net loss | Model every charge; prefer liquid names |
| Too many markets and timeframes | No depth anywhere | One or two markets until consistent |
| Revenge trading | Escalating losses | Cool-down rule and max daily loss |
| No journal | Same mistakes repeated | Log every trade; weekly review |
| Blaming "manipulation" | Nothing learned | Stops beyond obvious levels with a buffer |
Check yourself 2 questions
Consequence of moving the stop further away?
Show answer
One trade can erase months of gains.
Fix for having no written plan?
Show answer
One page of rules, and trade only those setups.
Takeaway No plan, no stop, oversizing and revenge trading each have a predictable consequence and a simple fix.
Tips worth remembering#
- Price and volume first; indicators are derived from them.
- The best trades usually feel uncomfortable to take.
- A breakout that fails quickly is information: the other side is strong.
- Most money is made sitting through trends, not entering and exiting.
- Plan the trade, trade the plan, journal the result.
Check yourself 2 questions
What does a quickly failing breakout tell you?
Show answer
The other side is strong.
Where is most trend money made?
Show answer
By sitting through the trend.
Takeaway Price and volume first, good trades feel uncomfortable, failed breakouts are information, money is made sitting through trends.
Combining with fundamentals#
- Fundamentals for what: screen for quality and value; only trade names you would be willing to own.
- Technicals for when: enter on a pullback or breakout, with a stop and target from the chart.
- Options for how: express the view or define the risk; never to rescue a weak thesis.
- See the Fundamental analysis sheet for the business side.
Check yourself 2 questions
What role do fundamentals play here?
Show answer
Screening for quality and value: what to trade.
What do technicals decide?
Show answer
When to enter and exit, with stop and target from the chart.
Takeaway Fundamentals choose what, technicals choose when, options choose how.
15Last-minute checklists
Run these before every session and every trade.
Before the session#
- Market regime on my timeframe: trend, range or squeeze?
- Higher-timeframe bias and key levels marked.
- Calendar checked: results, RBI policy, CPI, budget, expiry.
- India VIX, FII/DII flows and global cues noted.
- Mental state: calm, rested, no revenge or FOMO.
- Today's max loss and max number of trades set.
Check yourself 2 questions
Name two calendar events to check.
Show answer
Any two of: results, RBI policy, CPI, the Budget, expiry.
What should be marked before the open?
Show answer
Higher-timeframe bias and key levels.
Takeaway Regime, higher-timeframe bias and levels, the event calendar, VIX and flows, and your own state.
Before each trade#
- The setup matches my written plan, in one sentence.
- It sits at a level or structure point, not mid-range.
- Entry, stop and target are defined before the order.
- Size = risk amount ÷ |entry − stop|, rounded down.
- R:R at least 1:1.5 to 1:2 after costs.
- No major event before the planned exit.
Check yourself 2 questions
Where should the setup sit?
Show answer
At a level or structure point, not mid-range.
Minimum reward to risk?
Show answer
At least about 2:1.
Takeaway Plan-matching setup at a level, entry, stop and target defined, size from the stop, R:R at least 2.
During and after#
- Stop order placed immediately; never moved against the trade.
- No adding to losers; partials and trailing per plan.
- Stopped out? Accept it; no immediate re-entry from emotion.
- Log: setup, entry, exit, R multiple, emotion, rule followed.
- Weekly: win rate, average R, rule breaks. Monthly: expectancy, drawdown, by setup.
Check yourself 2 questions
Can you move a stop further away?
Show answer
Never against the trade.
After a stop-out, re-enter immediately?
Show answer
No; no emotional re-entry.
Takeaway Stop placed immediately, never moved against you, no adding to losers, accept stops, log everything.
One-line formulas#
Check yourself 2 questions
Break-even win rate formula?
Show answer
1 ÷ (1 + R).
Typical ATR stop multiple?
Show answer
About 1.5–3 × ATR.
Takeaway Shares, R:R, break-even win rate, expectancy, recovery and ATR stop on one card.
Educational note#
Numbers that expire#
Every figure on this sheet that a regulator, exchange or budget can change, with when it last changed. Last checked 15 Nov 2026; verify before trading.
| What | Current value | As of |
|---|---|---|
| Closing auction (F&O stocks) and derivatives hours | 3 Aug–6 Dec 2026: continuous trading to 15:15, auction to 15:35, derivatives to 15:40 · from 7 Dec 2026: continuous to 15:30, auction 15:30–15:40 (matching to 15:45), derivatives to 15:45 (expiring index contracts stop 15:30) | SEBI circular of 15 Oct 2026 · source |