# Intrabar spike

> Intrabar spike is an alert that checks every 1 hour and fires at most once per bar.

Source: https://algobarsx.com/docs/ex-41-intrabar-spike-alert/

```algobarsx
alert "Intrabar spike"
    check: every 1h
    repeat: once per bar close

inner = intrabar(bars: 1m)
spike = inner.high.max() - inner.low.min()

when inner.len > 0 and spike > atr(14) * 1.5:
    notify "Minute-level spike of {spike:0.00} inside the hour on {market.symbol}"
```
What this script says

Intrabar spike is an alert that checks every 1 hour and fires at most once per bar.

It calculates `inner` as the bars inside this bar (bars 1 minute) and `spike` as `inner.high.max()` minus `inner.low.min()`.

When the number of `inner` is above 0 and `spike` is above 1.5 × the 14-bar ATR, it sends the notification "Minute-level spike of {spike:0.00} inside the hour on {market.symbol}".
