Appearance
Chop Zone
EMA slope as coloured columns, from trending to choppy.
Kind indicator · Drawn in its own pane
Try it
On the chart, press / and choose Chop Zone under Trend. To change it, copy the source below into the AlphaScript editor.
Source
From packages/alphascript/indicators/chopzone.as.js.
js
indicator({ name: "Chop Zone", shortTitle: "Chop Zone", overlay: false });
const hlc3 = ta.calc([candle.high, candle.low, candle.close], (h, l, c) => (h + l + c) / 3);
const hh = ta.highest(candle.high, 30), ll = ta.lowest(candle.low, 30), e = ta.ema(candle.close, 34);
const zone = ta.calc([hlc3, hh, ll, e], (avg, h, l, m) => {
const span = (25 / (h - l)) * l, y2 = ((e.at(1) - m) / avg) * span, c = math.sqrt(1 + y2 * y2);
const a = math.round((180 * Math.acos(1 / c)) / Math.PI), angle = y2 > 0 ? -a : a;
if (angle !== angle) return NaN;
return angle >= 5 ? 0 : angle >= 3.57 ? 1 : angle >= 2.14 ? 2 : angle > 0.71 ? 3 : angle <= -5 ? 4 : angle <= -3.57 ? 5 : angle <= -2.14 ? 6 : angle <= -0.71 ? 7 : 8;
});
plot(ta.calc([candle.close], () => 1), { title: "Chop Zone", style: "columns",
palette: ["#26C6DA", "#43A047", "#A5D6A7", "#009688", "#D50000", "#E91E63", "#FF6D00", "#FFB74D", "#FDD835"], colorIndex: zone });