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

ThreeWhiteSoldiers — Three White Soldiers

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

Three consecutive white bars, each opening inside the previous body and closing higher than the last: a steady, broad advance with no gaps and no giveback. Returns +1.

Signature

ThreeWhiteSoldiers(lookback, on=<source>)
Argument Type Required Notes
lookback int Param Yes Pinned at 1; three bars are kept in state. Bounds 1–1.
on= symbol No Source symbol. Defaults to the trade symbol. Reads open and close.

Formula

Three white bodies with rising opens and rising closes, each open inside the prior body.

Warmup

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

Notes

  • The opens-inside-the-prior-body condition is what distinguishes this from any three up bars; without it the pattern is meaningless.