GravestoneDoji — Gravestone Doji
תוכן זה אינו זמין עדיין בשפה שלך.
A doji whose open and close sit at the bottom of the range, with a long upper shadow: buyers took price up through the session and were rejected entirely. Bearish; returns −1.
Signature
GravestoneDoji(lookback, body_ratio, shadow_ratio, on=<source>)| Argument | Type | Required | Notes |
|---|---|---|---|
lookback |
int Param | Yes | Pinned at 1. Bounds 1–1. |
body_ratio |
float Param or literal | Yes | Largest body as a fraction of the range. Default 0.05, bounds 0.001–0.5. |
shadow_ratio |
float Param or literal | Yes | Largest lower shadow as a fraction of the range. Default 0.1, bounds 0.0–0.5. |
on= |
symbol | No | Source symbol. Defaults to the trade symbol. Reads open, high, low, close. |
Formula
Tiny body, lower shadow within shadow_ratio of the range; the rest of the range is the upper shadow.
Warmup
None.
Reading the value
p.valuep < 0Pattern 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 GravestoneExit(Strategy): """Act on the pattern only in the direction of the longer trend.""" trade = Symbol() sizing = FixedCapital()
def execute(self): p = GravestoneDoji(1, 0.05, 0.1, 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 rejection overhead") if p.value < 0 and self.trade.is_long: self.sell(self.trade, self.trade.position, reason="Gravestone doji")Notes
- The mirror of the dragonfly, and geometrically a doji-bodied shooting star.