# Live Order Blocks

> Live Order Blocks is an indicator drawn over the price chart.

Source: https://algobarsx.com/docs/ex-07-live-order-blocks/

```algobarsx
indicator "Live Order Blocks"
    pane: price

input keep = 10

state zones: list<Zone> = []

for ob in order_blocks(new_only: true):
    zones.push(ob)
zones = zones.filter(z => not z.mitigated).keep_last(keep)

for z in zones:
    box id: z.id, from: (z.formed_bar, z.top), to: (bar.index, z.bottom), color: if z.bullish then green.fade(80) else red.fade(80)
```
What this script says

Live Order Blocks is an indicator drawn over the price chart.

You can change one input: `keep` (default 10).

It remembers `zones` from one bar to the next.

It calculates `zones` as `zones.filter(z => not z.mitigated).keep_last(keep)`.

On each bar, it goes through each `ob` in the order blocks and adds `ob` to `zones`.

On each bar, it goes through each `z` in `zones` and draws a box.
