Direct answer
A worked example of swing highs and swing lows is a fully specified scenario where you state the rule for what counts as a “swing,” then you label turning points from a sequence of candlestick highs and lows. Because the labeling depends on choices you make (for example, how many bars you treat as the lookback window), the example should include every assumption so another reader can reproduce the same labels from the same input.
Mechanism or definition
Swing highs and swing lows are descriptive chart turning points. In a simple “window” method, you label:
- a swing high at bar i if its high is the highest high inside a chosen window around i (for example, from i−L to i+L),
- a swing low at bar i if its low is the lowest low inside that same window.
Key assumptions you must state in any worked example:
- Bar structure: you use discrete bars (candles), each with a high and a low.
- Lookback window: you choose a fixed window size L.
- Strictness: if two highs tie for the maximum, you must define whether both are allowed or how you break ties.
- Repainting behavior (practical labeling issue): swing points may only be confirmed after later bars arrive, so labels can change when new data appears.
Evidence or example (fully numeric and reproducible)
Assumptions for this worked example (to remove ambiguity):
- We have 11 bars, indexed 1 to 11.
- For each bar, you are given the high and low.
- We use window size L = 2. That means to label bar i as a swing high/low, you compare it to bars i−2, i−1, i, i+1, i+2.
- Strict rule with no ties: if a bar’s high is the single maximum in that 5-bar window, it is a swing high; if it’s the single minimum in that window, it is a swing low.
- You only consider swing labels for bars 3 through 9 (because bars 1–2 and 10–11 don’t have a full window).
Input data (high, low): 1: (105, 100) 2: (108, 101) 3: (107, 99) 4: (110, 102) 5: (109, 97) 6: (111, 98) 7: (108, 96) 8: (106, 103) 9: (104, 95) 10:(107, 99) 11:(109, 101)
Now label swings:
Swing highs
- Bar 4 (high = 110): window bars 2–6 highs are 108, 107, 110, 109, 111. The maximum is 111 at bar 6, not bar 4, so bar 4 is not a swing high.
- Bar 5 (high = 109): window 3–7 highs are 107, 110, 109, 111, 108. Maximum is 111 at bar 6, so bar 5 is not.
- Bar 6 (high = 111): window 4–8 highs are 110, 109, 111, 108, 106. The maximum is 111 at bar 6, so bar 6 is a swing high.
- Bar 7 (high = 108): window 5–9 highs are 109, 111, 108, 106, 104. Maximum is 111 at bar 6, so not.
So the only swing high under these assumptions is: Swing high at bar 6.
Swing lows
- Bar 3 (low = 99): window 1–5 lows are 100, 101, 99, 102, 97. The minimum is 97 at bar 5, so bar 3 is not.
- Bar 4 (low = 102): window 2–6 lows are 101, 99, 102, 97, 98. Minimum is 97 at bar 5, so not.
- Bar 5 (low = 97): window 3–7 lows are 99, 102, 97, 98, 96. Minimum is 96 at bar 7, so bar 5 is not.
- Bar 6 (low = 98): window 4–8 lows are 102, 97, 98, 96, 103. Minimum is 96 at bar 7, so not.
- Bar 7 (low = 96): window 5–9 lows are 97, 98, 96, 103, 95. Minimum is 95 at bar 9, so bar 7 is not.
- Bar 8 (low = 103): window 6–10 lows are 98, 96, 103, 95, 99. Minimum is 95 at bar 9, so not.
- Bar 9 (low = 95): window 7–11 lows are 96, 103, 95, 99, 101. The minimum is 95 at bar 9, so bar 9 is a swing low.
So the only swing low under these assumptions is: Swing low at bar 9.