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

HangingMan — Hanging Man

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

Hammer geometry appearing after an advance: the same long lower shadow, read as a warning that sellers have started showing up rather than as a bottom. Returns −1.

Signature

HangingMan(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 high, long lower shadow, and the close above the close trend_period bars ago.

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 HangingManExit(Strategy):
"""Act on the pattern only in the direction of the longer trend."""
trade = Symbol()
sizing = FixedCapital()
def execute(self):
p = HangingMan(5, 0.33, 2.0, on=self.trade)
sma = SMA(50, on=self.trade)
if p.value == 0 and self.trade.close > sma.value and self.trade.is_flat:
self.buy(self.trade, reason="No warning present")
if p.value < 0 and self.trade.is_long:
self.sell(self.trade, self.trade.position, reason="Hanging man")

Notes

  • Identical shape to Hammer; only the trend context differs. If both fire on the same bar your trend_period is too short to separate them.