BeltHold — Belt Hold
תוכן זה אינו זמין עדיין בשפה שלך.
A long body that opened at its own extreme and never traded back through it — bullish opens at the low, bearish at the high. The session’s direction was set at the bell.
Signature
BeltHold(lookback, body_ratio, shadow_ratio, on=<source>)| Argument | Type | Required | Notes |
|---|---|---|---|
lookback |
int Param | Yes | Pinned at 1. Bounds 1–1. |
body_ratio |
float Param or literal | Yes | Minimum body as a fraction of the range. Default 0.7, bounds 0.3–1.0. |
shadow_ratio |
float Param or literal | Yes | Largest shadow on the opening side, as a fraction of the range. Default 0.05, bounds 0.0–0.3. |
on= |
symbol | No | Source symbol. Defaults to the trade symbol. Reads open, high, low, close. |
Formula
A long body with no shadow on the side it opened from; +1 when white, −1 when black.
Warmup
None.
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 BeltHoldEntry(Strategy): """Act on the pattern only in the direction of the longer trend.""" trade = Symbol() sizing = FixedCapital()
def execute(self): p = BeltHold(1, 0.7, 0.05, 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="Bullish belt hold") if self.trade.is_long and self.trade.close < sma.value: self.sell(self.trade, self.trade.position, reason="Trend lost")Notes
- A marubozu with only one clean end; strictly weaker, and it fires more often.