TweezerBottom — Tweezer Bottom
תוכן זה אינו זמין עדיין בשפה שלך.
Two consecutive bars with matching lows after a decline: the same level was defended twice. Returns +1.
Signature
TweezerBottom(lookback, tolerance, on=<source>)| Argument | Type | Required | Notes |
|---|---|---|---|
lookback |
int Param | Yes | Pinned at 1. Bounds 1–1. |
tolerance |
float Param or literal | Yes | How close the two lows must be, as a fraction. Default 0.001 (0.1%), bounds 0.0–0.05. |
on= |
symbol | No | Source symbol. Defaults to the trade symbol. Reads open, high, low, close. |
Formula
Two lows within tolerance of each other, the first bar black and the second white.
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 TweezerBottomEntry(Strategy): """Act on the pattern only in the direction of the longer trend.""" trade = Symbol() sizing = FixedCapital()
def execute(self): p = TweezerBottom(1, 0.001, on=self.trade) sma = SMA(50, on=self.trade) if p.value > 0 and self.trade.is_flat: self.buy(self.trade, reason="Tweezer bottom") if self.trade.is_long and self.trade.close < sma.value: self.sell(self.trade, self.trade.position, reason="Trend lost")Notes
- The bullish mirror of
TweezerTop.