דלגו לתוכן
פתיחת RaamTrade

InvertedHammer — Inverted Hammer

תוכן זה אינו זמין עדיין בשפה שלך.

A small body at the bottom of the range with a long upper shadow, appearing after a decline: the rally failed, but the attempt itself shows demand returning. Returns +1.

Signature

InvertedHammer(trend_period, body_ratio, shadow_ratio, on=<source>)
Argument Type Required Notes
trend_period int Param or literal Yes Bars back used to establish the prior trend. Default 5, bounds 1–100.
body_ratio float Param or literal Yes Largest body, as a fraction of the range. Default 0.33, bounds 0.05–0.9.
shadow_ratio float Param or literal Yes Minimum shadow length in body-multiples. Default 2.0, bounds 1.0–10.0.
on= symbol No Source symbol. Defaults to the trade symbol. Reads open, high, low, close.

Formula

Small body near the low, upper shadow at least shadow_ratio × body, lower shadow no larger than the body, in a downtrend context.

Warmup

trend_period bars.

Reading the value

p.value
p > 0

Pattern indicators return a flag, not a level: +1 bullish, -1 bearish, 0 absent. They are zero on most bars by design, so treat them as event triggers rather than as something to smooth or cross.

Example

class InvertedHammerEntry(Strategy):
"""Act on the pattern only in the direction of the longer trend."""
trade = Symbol()
sizing = FixedCapital()
def execute(self):
p = InvertedHammer(5, 0.33, 2.0, on=self.trade)
sma = SMA(50, on=self.trade)
if p.value > 0 and self.trade.is_flat:
self.buy(self.trade, reason="Inverted hammer after a decline")
if self.trade.is_long and self.trade.close < sma.value:
self.sell(self.trade, self.trade.position, reason="Trend lost")

Notes

  • Same geometry as ShootingStar, opposite trend context. Weaker than a plain hammer — most traders wait for the next bar to confirm.