# Tokyo open gap

> Tokyo open gap is an alert that checks every 1 minute and can fire every time its condition is met.

Source: https://algobarsx.com/docs/ex-45-tokyo-open-gap-alert/

```algobarsx
alert "Tokyo open gap"
    check: every 1m
    repeat: every time

state tokyo_open_price: price = na

on session open "tokyo":
    tokyo_open_price = open
    notify "Tokyo session opened at {open:0.000} on {market.symbol}"

when tokyo_open_price > 0 and abs(close - tokyo_open_price) > atr(14) * 3:
    notify "Price moved more than 3 ATR from the Tokyo open"
```
What this script says

Tokyo open gap is an alert that checks every 1 minute and can fire every time its condition is met.

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

When the Tokyo session opens, it sets `tokyo_open_price` to the open and sends the notification "Tokyo session opened at {open:0.000} on {market.symbol}".

When `tokyo_open_price` is above 0 and the absolute value of the close minus `tokyo_open_price` is above 3 × the 14-bar ATR, it sends the notification "Price moved more than 3 ATR from the Tokyo open".
