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

DojiStar — Doji Star

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

A doji that gaps away from the previous long body: the trend ran out of participants between sessions. Returns +1 after a black bar (potential bottom) and −1 after a white one (potential top).

Signature

DojiStar(lookback, body_ratio, on=<source>)
Argument Type Required Notes
lookback int Param Yes Pinned at 1; the recogniser needs no window. Bounds 1–1.
body_ratio float Param or literal Yes Largest body, as a fraction of the range, still counted as a doji. Default 0.05, bounds 0.001–0.5.
on= symbol No Source symbol. Defaults to the trade symbol. Reads open, high, low, close.

Formula

A doji whose entire body sits beyond the previous bar’s close, in the direction of the prior move.

Warmup

One bar of state.

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 DojiStarWatch(Strategy):
"""Act on the pattern only in the direction of the longer trend."""
trade = Symbol()
sizing = FixedCapital()
def execute(self):
p = DojiStar(1, 0.05, on=self.trade)
sma = SMA(50, on=self.trade)
if p.value > 0 and self.trade.is_flat:
self.buy(self.trade, reason="Bullish doji star")
if self.trade.is_long and self.trade.close < sma.value:
self.sell(self.trade, self.trade.position, reason="Trend lost")

Notes

  • The two-bar precursor to the morning and evening star. Confirmation from a third bar is what MorningStar and EveningStar add.