Appearance
Mass Index
Sum of the EMA range ratio, flags reversals when the range widens.
Kind indicator · Drawn in its own pane
Try it
On the chart, press / and choose Mass Index under Oscillators. To change it, copy the source below into the AlphaScript editor.
Inputs
| Input | Type | Default |
|---|---|---|
| Length | int | 10 |
| Color | color | "#2962FF" |
Source
From packages/alphascript/indicators/massindex.as.js.
js
indicator({ name: "Mass Index", shortTitle: "Mass", overlay: false, precision: 2 });
const length = input.int("Length", 10, { min: 1 });
const span = ta.calc([candle.high, candle.low], (h, l) => h - l);
const e1 = ta.ema(span, 9), e2 = ta.ema(e1, 9);
plot(ta.sum(ta.calc([e1, e2], (a, b) => a / b), length), { title: "Mass Index", color: input.color("Color", "#2962FF", { group: "Style" }) });