Skip to main content
Track ATR position sizing
19 / 36
Library

2013issue C0550-56

Algorithmic head-and-shoulders construction with bounded exits

A mechanical head-and-shoulders detector can locate milestone-points, draw a neckline when those points satisfy the stated conditions, and place a setup label after the last qualifying bar. Editorial: first make that geometry machine-checkable, then attach a trailing-stop and atr-position-sizing so the same setup can be accepted or rejected before capital is committed.

  • A mechanical detector locates milestone-points, draws a neckline when the stated conditions hold, and places a setup label after the last qualifying bar.
  • Peaks and troughs can be found with a percentage-reversal test; extra pattern filters reduce the number of signals and add a degree of freedom for each extra variable or constant.
  • A complete mechanical rule set can enter when a neckline through the two shoulder troughs, extended to the right, is broken, then exit at a measured objective or on a failed break.
  • After the pattern is coded, it can be reused as a pullback-in-trend long, with a trailing-stop at three times a 39-day average true range from the close, entry on the following day's open, and fixed-fractional atr-position-sizing.
Entries in this reading3 entries

Locate milestone-points and draw the neckline

A mechanical head-and-shoulders detector can locate the pattern's key points, draw a neckline when those points satisfy the stated conditions, and place a setup label after the last qualifying bar. Those key points are the milestone-points the detector must locate and test against pattern conditions before a neckline or setup label is drawn.

A head-and-shoulders top can be stated as three peaks in which the middle peak is higher than the two outer peaks. In the sense used here, head-and-shoulders is a three-peak or three-trough price structure whose middle extreme is more pronounced than the two flanking extremes, with a neckline through the intervening troughs or peaks used as the confirmation line.

Find peaks and troughs with a percentage-reversal

Peaks and troughs for that geometry can be found by requiring a percentage-reversal in the high or low series at least as large as a chosen reversal amount. A percentage-reversal registers a peak or trough only after price retraces at least a stated percentage from a new extreme.

Inspect the same geometry on a chosen interval

Implementations expose chart-level parameters for price source, maximum pattern length, and neckline display so the same geometry can be inspected on a chosen bar interval and lookback. The neckline is the line through the two intervening troughs of a topping structure, or the two intervening peaks of a bottoming structure, extended forward as the confirmation threshold.

Extra filters add degrees of freedom

Adding extra pattern filters can reduce the number of signals and each extra variable or constant adds a degree of freedom to the resulting system.

Enter on a neckline break

A complete mechanical rule set can enter when an imaginary neckline through the two shoulder troughs, extended to the right, is broken, then exit at a measured objective or when price produces a failed break.

Scan completed and emerging patterns

The same geometry can be scanned for completed and emerging tops and for completed and emerging inverse bottoms, with reports that list every nonzero pattern flag. An emerging-pattern is a partially formed head-and-shoulders geometry that a scanner can flag before the neckline break completes.

Head-and-shoulders pattern length by Excel search start bar

On the Eastman Kodak daily window the Excel scanner keeps a ~390-bar head-and-shoulders when the search sits in early March 2011, then a 22-bar nested hit appears in late 2010, then a 128–160 bar family sharing a 27 January 2010 L0. That is the fractal stacking the walk-through describes. Lengths in bars (L0 to L3) are copied from the 17 visible scan-result rows, not read off a price plot.
On the Eastman Kodak daily window the Excel scanner keeps a ~390-bar head-and-shoulders when the search sits in early March 2011, then a 22-bar nested hit appears in late 2010, then a 128–160 bar family sharing a 27 January 2010 L0. That is the fractal stacking the walk-through describes. Lengths in bars (L0 to L3) are copied from the 17 visible scan-result rows, not read off a price plot.Eastman Kodak (EKDKQ) · Daily · 2009-08-11T00:00:00.000Z to 2011-03-11T00:00:00.000Z

The scan counted 35 hits over 692 bars examined (700 visible). Only the 17 rows in the visible pane are plotted; the remaining hits are off-screen.

Reuse the geometry as a pullback in trend

After the pattern is coded, it can be reused as a pullback long when a 50-day simple moving average is above a 200-day simple moving average and the head-and-shoulders setup confirms. That reuse is a pullback-in-trend: a completed topping geometry used as a long entry when a longer moving-average pair still defines an uptrend.

That construction places a trailing-stop at three times a 39-day average true range from the close, with entry on the following day's open. The trailing-stop trails a multiple of average true range from the close so the loss bound moves with realized volatility after entry.

Unit size can be set with a fixed-fractional money manager that risks 0.05% of total equity per trade when the book is a large equity index membership list. That atr-position-sizing rule scales the unit from account equity and a volatility-based stop distance so each trade risks a stated share of equity.

Educational research material, not investment advice. Historical source context does not establish present-day performance.
19 of 36 in the ATR position sizing track
201353-58 pp.Next on ATR position sizingConstructing ATR-scaled swing pivots and linear-regression divergenceA high-low pivot threshold used a nonnegative percent of price, a nonnegative ATR-to-close multiple, or both, and rejected the case where both components were zero.
All readings on this track · 36 readings
  1. 1988Constructing unsigned true range for directional models
  2. 1989Evaluate an always-in ATR breakout as one procedure
  3. 1992Variable lookback and average true range as a trend-filter construction
  4. 1993A random-walk index that uses true range as its scale
  5. 1993A shared harness for trend-filter construction
  6. 1998Finish a trend with a volatility trail, wave permission, and a slower-frame veto
  7. 1999A trend filter that switches tactics and scales ATR targets
  8. 2001Filter higher lows with linear regression, then judge the exit
  9. 2003A Mechanical trading system is a maintained procedure, not only an entry trigger
  10. 2005Construction of a volatility-bounded long entry
  11. 2005Six-zone encoding of open, high, low, and close
  12. 2006Normalized average true range as a pre-entry volatility bound
  13. 2006Chandelier exits, ATR position sizing, and trailing stops
  14. 2007Constructing a rule-based entry with Relative Strength Index and ATR position sizing
  15. 2008Constructing a zero-lag TMA and heikin-ashi crossover as a complete rule set
  16. 2010Use the session-range percent stop as a pre-trade filter
  17. 2011OCA exit groups, trailing limits, and ATR stops
  18. 2011ATR bands around support and resistance for stops and targets
  19. 2013Algorithmic head-and-shoulders construction with bounded exits
  20. 2013Constructing ATR-scaled swing pivots and linear-regression divergence
  21. 2013Constructing volatility bands from typical price
  22. 2014Constructing true-range contraction filters before expansion
  23. 2015Constructing touch plans from modified true range
  24. 2015One checklist for breakout entry and ATR risk
  25. 2015Percentage true-range construction for cross-market volatility filters
  26. 2015Construct a percentage true range for cross-market volatility
  27. 2015Percentage true range as a pre-entry exposure filter
  28. 2016Constructing ATR-filtered breakout entries
  29. 2017A dividend date as a pairs-trading classroom
  30. 2018Range-based volatility as a true-range construction
  31. 2018Moving average support and volatility-band construction
  32. 2018Construct a lifecycle breakout from compression
  33. 2018Pair the book first and let volatility or range set the size
  34. 2019Trend systems need a no-trade rule
  35. 2020Average true range as a shared unit for size, pairs, and stops
  36. 2020Volatility sizing and target-risk leverage as a pre-trade gate
All 43 readings tagged ATR position sizing
Also on ATR position sizing5 readings