Phoenix Range Box Breakout (ORB)
A box around the price range of a session's first 15 minutes, plus two moving average lines.
About
Phoenix Range Box Breakout marks the first 15 minutes of a session with a box. It also draws two moving average lines.
ORB stands for opening range breakout. The opening range is the highest and lowest price at the start of a session. A breakout is when the price moves out of that range.
To add it in KAGAMI, click Indicators at the top of the chart. Search for it, then click phoenix range box breakout Ema V.1.1. The list shows the name in small letters, just like this. See Indicators.
This indicator is not in every account's Indicators list yet.
What you see on the chart
A chart shows the price as candles, also called bars. Each candle is one slice of time. The timeframe is how much time each candle covers.
Here a session is a fixed block of hours: 17:00 to 02:00 the next day. The clock is the market's own. For crypto, that is UTC. For US stocks, it is New York time.
- A teal box. Its top is the highest price of the session's first 15 minutes. Its bottom is the lowest price. The box starts at the session's first candle. It grows to the right as candles close, until the session ends.
- A dashed yellow line. It runs through the middle of the box, halfway between top and bottom.
- Three price tags at the right edge of the box. H : shows the top, L : the bottom and M : the middle. They show only while the session is running. When it ends, the tags go. The box and the yellow line stay.
- A red line. This is the fast moving average. A moving average is the average closing price of recent candles, drawn as a line. The red line uses the last 9 candles.
- A blue line. This is the slow moving average. It uses the last 21 candles, so it turns more slowly.
You see the boxes on minute and hour charts. On daily, weekly and monthly charts, you see only the two lines.
On US stocks, 17:00 to 02:00 New York time is outside regular market hours. So on a stock chart, the box may be missing or hard to see. The two lines still show.
How traders often read it
- Many traders watch the top and the bottom of the box as price levels.
- Many traders call a move out of the box a breakout.
- Some traders check if candles close outside the box. Others note candles that only poke out.
- Some traders read a quick move back into the box as a failed breakout.
- Some traders watch the yellow middle line as the centre of the opening range.
- Many traders read the red line above the blue line as rising prices. Below it, they read falling prices.
- Some traders watch the moment the two lines cross.
The indicator does not mark breakouts itself. It only draws the box and the lines.
An indicator only describes past prices. It cannot tell the future.
The settings
This indicator has no settings you can change in KAGAMI. It always uses fixed values:
- One session: 17:00 to 02:00 the next day, on the market's own clock.
- Opening range: the first 15 minutes of that session.
- Middle line: always shown, dashed and yellow.
- Fast line: an exponential moving average (EMA) of the last 9 closing prices, in red. An EMA is an average that counts the newest prices more.
- Slow line: an EMA of the last 21 closing prices, in blue.
When it can mislead
- The hours are fixed. The session may not match the busy hours of your market. On US stocks, it falls outside regular hours.
- Long candles hide detail. On a 30-minute or longer chart, one candle alone sets the box. That candle covers more than 15 minutes.
- Small boxes break easily. In a quiet session, the box is small. The price may move out of it again and again.
- Choppy markets. The price can leave the box and come straight back. This can happen many times in one session.
- The newest candle is still forming. The box and the tags wait until it closes. The two lines move with it before then.
- The lines lag. A moving average follows the price. It turns only after the price has turned.
- Missing candles. Sometimes no candle starts at 17:00. Then the box starts at the first candle that does. The 15 minutes count from there.
- The oldest box. KAGAMI loads a limited number of candles. The box at the far left may start partway through its session.
Charts are for learning, not advice. Read our Risk Disclaimer.
An example
- Open NASDAQ:AAPL in KAGAMI. Pick the 15-minute timeframe.
- Click Indicators and add phoenix range box breakout Ema V.1.1.
- You see a red line and a blue line over the candles.
- Say the red line sits above the blue line. Then the last 9 closes average higher than the last 21.
- You may see no box. The session, 17:00 to 02:00 New York time, is outside regular US market hours.
Here is how a box is built, with made-up numbers. Say the session's first candle has a high of 102 and a low of 98. On this timeframe, that one candle is the first 15 minutes. So the box runs from 98 to 102. The tags read H : 102.00, L : 98.00 and M : 100.00. Later candles may go higher or lower. The box keeps its height. It only grows to the right.
Technical details
This part gives the exact rules, for readers who want them. KAGAMI's servers apply the original Pine script's rules; the chart only draws what they send.
The calculation
The servers replay the script on every closed candle, oldest first. For the session box:
- The clock. Each candle's open time is read on the market's own clock: UTC for crypto, New York time for US stocks and for FX and metals, with daylight saving. This is not the chart's time zone. KAGAMI's chart shows times in UTC at first.
- Inside the session. A candle is inside when its open time is from 17:00 up to, but not including, 02:00. The session runs past midnight, on all seven days of the week.
- The start. The first candle inside, after a candle outside, starts a session. Its open time is the start time. Its high and low start the range.
- The opening range. Every candle inside whose open time is before
start + 15 minuteswidens the range:top = max(top, candle high)andbottom = min(bottom, candle low). After that, the range is locked. Later candles never change it. - While the session runs. On every closed candle inside, the box is drawn again, from the start time to this candle's open time, between
topandbottom. The middle line sits at(top + bottom) ÷ 2, over the same span. The three tags sit at this candle's open time. - The end. The first candle outside, after a candle inside, ends the session. The box and the middle line are drawn one last time, to that candle's open time, and kept. The tags are removed. The range is cleared for the next session.
The two moving averages, on every candle:
EMA = α × close + (1 − α) × EMA of the candle beforeα = 2 ÷ (length + 1), with length 9 for Fast and 21 for Slow- The first value is the simple average of the first
lengthcloses. There is no value before it.
The script has no breakout rule of its own. It draws no marker when the price leaves the box.
Inputs
KAGAMI shows no inputs for this indicator. It always uses the original script's defaults, and none of them can be changed:
| Input in the original script | Value KAGAMI uses | Note |
|---|---|---|
| Show Asia | on | The one session KAGAMI draws |
| Window (HHMM-HHMM), Asia | 1700-0200 | 17:00 to 02:00 |
| ORB Duration (minutes), Asia | 15 | The opening range |
| Box Border, Box Fill (Asia) | teal at 50 % and 80 % transparency | |
| Show London | off | Window 0000-0900, 15 minutes, aqua |
| Show New York | off | Window 0600-1500, 15 minutes, blue |
| ORB Style, ORB Width | solid, 1 | The box border |
| ORB Colors | aqua at 50 % and 80 % transparency | Used only when all three sessions are off |
| Show ORB Middle | on | The yellow middle line |
| Mid Style, Mid Width, Mid Color | dashed, 1, yellow | |
| Keep Label History | off | Changes nothing in this script |
| Font Size | 11 | The tags |
| Anchor Period | Auto | Used only by the fallback box and a timeframe check |
| ORB Timeframe | empty | The chart's own timeframe |
| Type | Exponential | The original also offers Simple, Hull, Weighted, Volume Weighted and Exponential Volume Weighted |
| Fast | 9 | The red line |
| Slow | 21 | The blue line |
| Source | close | |
| Offset | 0 | |
| Show Signal Line?, Zero-Lag Fast?, RSI Filter? | on, off, off | Read by nothing in the original script |
The box, the line and the tags
- The box: border teal
#089981at 50 % transparency, solid, 1 px. Fill teal#089981at 80 % transparency. London would be aqua#00BCD4and New York blue#2962FF, but both are off. - The middle line: yellow
#FFEB3B, dashed, 1 px, from the start time to the box's right edge. - The tags: text only, with no background, at size 11. H : and L : are teal
#089981at full strength. M : is yellow#FFEB3B. Each price is rounded to the symbol's price step: 0.01 for US stocks (0.0001 under $1), and the chart's own price precision for other markets. The tags sit at the box's right edge, with the text running to the right, just above their level. - How many are kept: the original allows 500 boxes, 500 lines and 500 tags; past that, the oldest goes first. KAGAMI keeps exactly the newest 500 of each. With one session a day and the history KAGAMI loads, this limit is never reached.
- Locked drawings: you can't move or edit them, and they are not saved. They hide when you hide the indicator and go when you remove it.
The moving averages
- Fast: red
#F23645, 2 px. Slow: blue#2962FF, 2 px. Both sit on the price pane, use the close and have no offset. - KAGAMI's servers compute them over the candles the chart loads, plus up to 300 earlier candles so the lines are settled at the left edge.
When values change
- Box, middle line and tags: closed candles only. The forming candle is never used. The box's right edge moves one candle at each close. During the first 15 minutes, the range grows only with closed candles.
- Refresh: the page asks for the drawings again when a new candle closes, and every 60 seconds.
- Past boxes: once a session has ended, its box and middle line no longer change. At the far left, a box can change or vanish as older candles drop out of the loaded history.
- Moving averages: they include the forming candle. Their newest point moves until that candle closes. The chart re-reads them on its regular refresh. Values of closed candles stay the same.
Timeframes
- Minute and hour charts (1 minute to 4 hours): boxes and lines.
- How many candles set the range: 1 minute: 15 candles. 3 minutes: 5. 5 minutes: 3. 15 minutes and longer: the first candle only.
- Candles that don't open at 17:00: a session starts at the first candle whose open time is inside. On a crypto 4-hour chart, candles open at 16:00, 20:00, 00:00 and 04:00 UTC. The 16:00 candle opened before 17:00, so it is outside. The box starts at the 20:00 candle and ends at the 04:00 candle.
- Seconds charts (crypto only: 1, 5, 10, 15 and 30 seconds): the servers read at most 2,000 candles, about 33 minutes at 1 second. So a box there usually starts at the first loaded candle, not at 17:00. At 1 second, the opening range spans 900 candles.
- Daily, weekly and monthly charts: no boxes. The two lines still plot.
- US stocks: the session is 17:00 to 02:00 New York time, while regular trading runs from 09:30 to 16:00. A box forms only from candles inside the window, such as late after-hours trades. With none, there is no box. Such a box can run until the next candle outside the window, often early the next morning.
- The timeframe check: the original script stops with an error when the chart's timeframe is at or above its anchor period. With the default Auto anchor, this never happens on KAGAMI's timeframes. If it did, KAGAMI would draw and plot nothing.
Differences from the original Pine script
KAGAMI draws what the original script draws with its default inputs. These are the differences:
- No settings. Every input stays at its default.
- Closed candles only. On TradingView, the running box, its tags and the opening range follow the live, still-forming candle. KAGAMI waits for each candle to close.
- No boxes on daily, weekly and monthly charts. The original's result there depends on TradingView's own daily candle times, which differ from KAGAMI's. The lines still plot.
- No fallback box. When all three sessions are off, the original draws one box per anchor period instead. With the defaults this never happens, and KAGAMI does not draw it.
- No alerts. The original offers Cross Up and Cross Down alerts for the two lines. KAGAMI raises no alerts.
- Shorter history. KAGAMI loads at most 2,000 candles. The oldest box can differ from TradingView's, and the first moving-average values can differ slightly.
- Object limits. TradingView's 500-object limits are approximate. KAGAMI keeps exactly the newest 500 of each kind.
- Tag placement. TradingView centres each tag's text on its price. KAGAMI places it just above.
- Price steps. The tags are rounded to the price step KAGAMI uses for the symbol. For crypto, FX and metals, this is the chart's own price precision, which may differ from TradingView's.
- The time zone. The original's input groups say "Chart TZ", but its code reads the market's own time zone. KAGAMI follows the code.
- Keep Label History. Turning it on would change nothing, on TradingView or in KAGAMI. Every session lets go of its drawings when it ends, so finished boxes stay either way.
Edge cases
- Fewer than 3 closed candles: nothing is drawn.
- History that starts mid-session: the first loaded candle inside the window starts a box. Its range covers the 15 minutes from that candle, not the real opening range.
- A late first candle: if the first candle inside opens after 17:00, the session and its 15 minutes start at that candle.
- A pause inside the session: the box keeps running. The session ends only at the first candle outside the window.
- Flat prices: if the first 15 minutes never move, the box has no height. The three tags show the same price.
- Zero volume: the default lines use prices only, so volume changes nothing.
- Hidden or removed: hiding the indicator hides its drawings and lines. Removing it removes them.