DarkCloudCover — Dark Cloud Cover
תוכן זה אינו זמין עדיין בשפה שלך.
A black bar that opens above the previous white bar’s high and closes back below the midpoint of its body: the gap up was sold into. Returns −1.
Signature
DarkCloudCover(lookback, on=<source>)| Argument | Type | Required | Notes |
|---|---|---|---|
lookback |
int Param | Yes | Pinned at 1; the recogniser keeps the previous bar in state. Bounds 1–1. |
on= |
symbol | No | Source symbol. Defaults to the trade symbol. Reads open, high, low, close. |
Formula
Prior bar white; this bar opens above its high and closes below the midpoint of its body but above its open.
Warmup
One bar of state.
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 DarkCloudExit(Strategy): """Act on the pattern only in the direction of the longer trend.""" trade = Symbol() sizing = FixedCapital()
def execute(self): p = DarkCloudCover(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 distribution") if p.value < 0 and self.trade.is_long: self.sell(self.trade, self.trade.position, reason="Dark cloud cover")Notes
- The bearish mirror of
PiercingLine.