Intrabar spike
Intrabar spike is an alert that checks every 1 hour and fires at most once per bar.
inside the bar
1
alert "Intrabar spike"2
check: every 1h3
repeat: once per bar close4
5
inner = intrabar(bars: 1m)6
spike = inner.high.max() - inner.low.min()7
8
when inner.len > 0 and spike > atr(14) * 1.5:9
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}".