ChopZone: Chop Zone
A trend-direction zone from the slope of a typical-price EMA: an integer from −4 (steeply down) through 0 (flat) to +4 (steeply up). The zone itself is the output, which is what a rule actually needs.
Signature
ChopZone(period, on=<source>)| Argument | Type | Required | Notes |
|---|---|---|---|
period |
int Param or literal | Yes | EMA and range window. Default 30, bounds 2–400. |
on= |
symbol | No | Source symbol. Defaults to the trade symbol. Reads high, low, close. |
Formula
On each bar, with n the period:
- The typical price
(H + L + C) / 3feeds ann-bar EMA, seeded from the first typical price. - The EMA’s one-bar change is divided by the window’s range (the highest high minus the lowest
low of the last
nbars) and multiplied byn. - That number becomes an angle in degrees:
$$ \theta = \arctan!\left(\frac{\text{EMA}t - \text{EMA}{t-1}}{\max(H) - \min(L)} \cdot n\right) \cdot \frac{180}{\pi} $$
- The angle is placed in a zone:
| Angle | Zone |
|---|---|
| above 32.14° | +4 |
| above 21.43°, up to 32.14° | +3 |
| above 10.71°, up to 21.43° | +2 |
| above 3.57°, up to 10.71° | +1 |
| from −3.57° to 3.57° | 0 |
| below −3.57°, down to −10.71° | −1 |
| below −10.71°, down to −21.43° | −2 |
| below −21.43°, down to −32.14° | −3 |
| below −32.14° | −4 |
A boundary value belongs to the flatter zone: exactly 10.71° is +1, exactly −3.57° is 0. A window with no range at all reads 0.
Warmup
period bars for the range; the EMA seeds from the first typical price. 0 until started.
Reading the value
cz.valuecz.value >= 2cz.value == 0Example
class ZoneFilter(Strategy): """Trade only in the steeper upward zones.""" trade = Symbol() sizing = FixedCapital()
def execute(self): cz = ChopZone(30, on=self.trade) if cz.value >= 2 and self.trade.is_flat: self.buy(self.trade, reason=f"Zone {cz.value}") if cz.value <= 0 and self.trade.is_long: self.sell(self.trade, self.trade.position, reason="Zone flattened")Notes
- The chop zone comes from Ken Wood’s Woodie’s CCI method, which colours each bar by the slope angle of an EMA so a trader can see at a glance whether the market is trending or chopping.
- The scaling and the four thresholds above are this indicator’s own. The angle is computed from the numbers alone (the EMA’s change against the window’s range), so the zone never depends on how a chart happens to be drawn. Read the zones as ordinal: a higher zone is a steeper rise, not a measured angle on any particular chart.
- Proven by an assert-via-trade run on SPY daily (stayed inside −4…+4 on every bar; zero alarm trades).