Tokyo open gap

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

state

tokyo-open-gap.abx
1alert "Tokyo open gap"
2check: every 1m
3repeat: every time
4
5state tokyo_open_price: price = na
6
7on session open "tokyo":
8tokyo_open_price = open
9notify "Tokyo session opened at {open:0.000} on {market.symbol}"
10
11when tokyo_open_price > 0 and abs(close - tokyo_open_price) > atr(14) * 3:
12notify "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".

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account