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

TweezerTop — Tweezer Top

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

Two consecutive bars with matching highs after an advance: the same level was rejected twice in a row. Returns −1.

Signature

TweezerTop(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 highs 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 highs within tolerance of each other, the first bar white and the second black.

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 TweezerTopExit(Strategy):
"""Act on the pattern only in the direction of the longer trend."""
trade = Symbol()
sizing = FixedCapital()
def execute(self):
p = TweezerTop(1, 0.001, 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 double rejection")
if p.value < 0 and self.trade.is_long:
self.sell(self.trade, self.trade.position, reason="Tweezer top")

Notes

  • tolerance is a relative fraction, so the same setting works on a $10 stock and a $600 index. Exact equality (0.0) is unrealistic on anything but tick-constrained instruments.