# X-Ray Flow Bands

> X-Ray Flow Bands is an indicator drawn over the price chart.

Source: https://algobarsx.com/docs/ex-43-xray-flow-bands/

```algobarsx
indicator "X-Ray Flow Bands"
    bars: xray(20)

input band_length = 30

center = hma(close, band_length)
width = stdev(close, band_length) * 2
up_band = center + width
down_band = center - width

channel upper: up_band, lower: down_band, fill: linear_gradient(start: green.fade(80), end: red.fade(80))
plot center, color: white, width: 2
mark triangle_up, at: below, when: crosses_above(close, down_band), color: green, size: tiny
mark triangle_down, at: above, when: crosses_below(close, up_band), color: red, size: tiny
```
What this script says

X-Ray Flow Bands is an indicator drawn over the price chart.

You can change one input: `band_length` (default 30).

It calculates `center` as the HMA of the close over `band_length` bars, `width` as 2 × the standard deviation of the close over `band_length` bars, `up_band` as `center` plus `width` and `down_band` as `center` minus `width`.

On the chart, it draws a channel, plots `center`, marks triangle up below the bar when the close crosses above `down_band` and marks triangle down above the bar when the close crosses below `up_band`.
