Inverted Hammer
By LuxAlgoJun 21, 2026
Inverted Hammer detects the single-candle bottom-reversal candidate with measurable proportions, then manages what matters most: confirmation. A qualifying inverted hammer needs an upper shadow at least twice the real body, a lower shadow within 10% of the range, a real body of at least 5%, and a decline into the candle.
How to Trade the Inverted Hammer?
- Tentative IH tag: a candidate only — the candle closes weak by construction, so nothing is implied until follow-through appears.
- Confirmation triangle: fires when the next candle gaps above the body or closes bullish, or price trades above the pattern high in the window.
- Trigger and stop lines: entry above the pattern high, invalidation below the pattern low — drawn while it is pending.
Each pattern resolves within the window as confirmed, invalidated, or expired; set the window to 1 for the strict next-candle reading.
Inverted Hammer Settings
- Minimum Upper Shadow / Body Ratio (default 2), Maximum Lower Shadow (%) (default 10), Minimum Real Body (%) (default 5): the shape tests — shadow multiple, shaved-low tolerance, and the body floor that excludes gravestone-style doji.
- Bullish Body Only (default disabled): classical references accept either body color.
- Decline Detection (default Price Below SMA) with SMA Length (default 50) and Decline Lookback (default 5): how the decline into the candle is established.
- Confirmation Window (default 3): bars allowed before an unconfirmed pattern is set aside; the gap-up, bullish-close, and trade-above-high rules all default on.
- Volume Grading (default Highlight), Volume Average Length (default 20), Elevated Volume Multiple (default 1.5): participation grading — an IH+ tag marks elevated volume; bypassed without volume data.
- Labels, levels, resolution markers, and colors are style options.
Frequently Asked Questions
Why isn't the same shape detected after a rally?
Location defines the pattern: after an advance the identical candle is a shooting star, which this script deliberately ignores. The decline test is measured one bar back, so the pattern candle never shapes its own baseline.
How does it relate to the Morning Star?
A confirmed inverted hammer with a gap down before and a strong close after approximates the three-bar Morning Star structure. The single-candle form gives earlier notice at lower reliability — hence confirmation, not detection, is the actionable event.
What invalidates a pending pattern?
Price trading below the pattern low before any confirmation rule fires — marked with a cross and alerted. Unconfirmed patterns that outlive the window are set aside as noise.
The Library is free. Quant makes it yours.
Pull any concept or indicator into Quant: rebuild it, retune it, or turn it into a backtested strategy of your own.
