Edo Range State

768
Edo Range State — Range Phases Confirmed by Compactness, Efficiency and Rotation, with Fixed Boxes, Origin Bias and Breakouts in Progress, Confirmed or Failed

لقطة

لقطة

لقطة



Most range tools draw a band or a box as soon as price flattens out and erase it when price moves, so the range is never measured, only drawn. Edo Range State treats the range as a phase with a start, a life and an end. It confirms a range only when a window of closed bars passes three tests at once, draws a box that stays fixed, measures the live range while it lasts and closes it with a verdict when price really leaves: green if it broke up, red if it broke down, noting whether it left the way its origin candle pointed or against it, and a breakout that comes back inside is recorded as failed while the range goes on. The indicator is fully self-contained: everything is derived from the price series of the chart, with no volume, no higher timeframe data and no dependency on any other tool.

On the chart a confirmed range is a box with a dashed midline, tinted by its origin (green, red or indigo, see below), small dots on the candles that test the top or the bottom, and labels on the right edge with the price of the top, the midline and the bottom and their distance to price in ATR. Finished ranges stay on the chart, filled green or red, with a label such as "Range · 48 bars · broke up · against its origin". Triangles mark the first close outside the box and orange crosses mark a breakout that fails. A panel in Full or Compact version shows the state, the range, its age, where price stands, the tests, the origin bias, the history of finished ranges, the volatility and the last event, and it picks its own corner so it does not cover the drawing.

THE THREE TESTS

On every closed bar the indicator examines the latest window of closed bars, 20 by default. The window is a range if it is compact, has no direction and has rotation. Compact means that the distance between its highest and lowest edge is at most 5 times the 50-bar ATR. No direction means that its efficiency, the net change of the close over the window divided by the sum of every close-to-close change, is at most 0.30: close to 0 price went back and forth, close to 1 it moved in a straight line. Rotation means that price visited the top zone at least twice and the bottom zone at least twice, where each zone is the outer 20 % of the height and a visit is one or more consecutive candles whose wick reaches it. Height and efficiency alone cannot tell a range from a quiet staircase or from two long candles in opposite directions; the rotation test can.

WINDOW AND AUTOMATIC THRESHOLDS

The window can be changed from 8 to 200 bars. The height and efficiency limits are set for 20 bars and scale with the square root of window divided by 20, the way a random walk changes with its length: with 50 bars the maximum height rises to about 7.9 ATR and the maximum efficiency falls to about 0.19. The panel shows the value in use, so you can change the window alone and still know what is being applied.

THE BOX

The range is confirmed on the close of the bar that completes the window, and its box is drawn from the first bar of that window to the confirmation bar. It appears on the confirmation bar and never moves afterwards: top and bottom stay fixed, and later wicks are tests or breakouts, not a reason to stretch it. An optional input, off by default, lets a candle that closes inside but pokes beyond an edge stretch the box. The edges can be taken from wicks or from candle bodies. The box is projected a few bars to the right while the range is active. Before confirmation, a dashed provisional box can show a range that is forming; it follows the latest bars and disappears if the range is not confirmed, so it is a warning and not a range. It is drawn with a dashed, opaque border so it is easy to tell from a confirmed box.

WHAT IS MEASURED WHILE IT LASTS

The indicator counts the bars the range has lasted and when it becomes mature, after twice the window by default. It counts the separate visits to the top and to the bottom, and the failed breakouts. It measures the percentage of closes inside the box, which describes the live range and is not a detection rule. It also shows the compression of volatility, the 14-bar ATR against the 50-bar one, as compressed, normal or expanding.

ORIGIN BIAS AND HISTORY

When a range is confirmed, the indicator reads its first candle once: green if it closed above its open, red if below, neutral if equal. That colour tints the active box and appears in the Origin row of the panel. Every finished range is then counted over the loaded history: how many there were, their average length and the share that broke the way of their origin candle, and each range ends with a label and an alert that say whether it left with or against its origin. This is a record of how the market behaved, not a forecast: the share tends to sit close to half, and it only counts ranges that ended inside the loaded history, so it changes with how many candles the chart has loaded.

BREAKOUTS

A breakout starts when a candle closes beyond the top or the bottom by at least a buffer of 0.10 ATR; closes inside the buffer still count as inside the range. It is confirmed with three consecutive closes outside, counting the first, or with a single close at 1 ATR or more beyond the edge; both values can be changed. If before that a candle closes back inside the box, the breakout is marked as failed and the range goes on with the same box. This is why the alert "Close above the range" fires earlier than "Range ended": the first reports the attempt, the second the confirmed exit.

STATES

The panel classifies the moment with eight states, three of them with sign, that read as five families: no range, forming, range (active or mature), breakout (in progress, failed or confirmed) and trend. Outside a range, a high efficiency reads as trend up or trend down, and the zone in between is a transition with no defined phase. Hysteresis of two closes keeps the state from flickering around its thresholds. Green and red mean a direction: the origin of the active range, breakouts, trends and finished ranges. Indigo is used for forming ranges, edge tests, range states and ranges whose first candle was a doji.

PANEL

Two columns, a title, up to seven rows and a footer in the Full version, or four rows in the Compact one. Rows: state, range with its height in ATR, age, position of price in the range and distance to the edges, tests with the share of closes inside, origin, history, volatility and last event. When there is no range it shows a Window row with the height, the efficiency and the limits in use. With Keep Panel Off the Drawing on, the panel stays in the chosen corner while it has room and otherwise moves to the corner that does not cover the latest candles, the box or the labels; it also leaves room for the TradingView legend, logo and button. It comes in two sizes and two themes, Dark and Light, with adjustable opacity.

ALERTS

Fourteen predefined alerts: range confirmed, range became mature, range top tested, range bottom tested, close above the range, close below the range, failed breakout up, failed breakout down, range ended up, range ended down, range ended, range ended with its origin, range ended against its origin and back inside the broken range. All of them are evaluated at the close of the bar.

HOW TO READ IT

Start with the state: it says whether the market is in balance, in a breakout or in a trend. Then look at the age and at the tests on both edges: a range that has been tested several times has defined edges. Check how many breakouts failed and what share of the closes stayed inside the box. Keep in mind that the indicator describes facts, such as the range was confirmed, price left or the range ended, and does not predict the direction of the exit: it is context, not a signal.

CLOSED BARS ONLY

Every decision is taken on closed bars. While a candle is forming, the state, the box, the counters and the alerts stay as they were at the previous close. The confirmation box starts in the past because it covers the whole window, but it only appears on the confirmation bar and never changes afterwards. The only provisional element is the dashed box of a forming range.

CONFIGURATION

The inputs are grouped in six blocks. Detection holds the window (20), the maximum height (5 ATR), the maximum efficiency (0.30), the tests required per edge (2), wicks or bodies, the depth of the edge zone (20 %) and the option to grow the box with inside closes (off). Breakouts holds the buffer (0.10 ATR), the closes needed to confirm (3) and the early confirmation distance (1 ATR). States holds the age at which a range is mature (2 windows) and the trend efficiency (0.45). Display holds the forming box, the finished ranges kept (3), the summary label, the edge tests, the breakout markers, the minimum number of bars between markers (5), the projection (10 bars) and the edge labels with their spacing and size. Style holds the colours and the transparency of the fills. Panel controls visibility, Full or Compact detail, preferred corner, automatic avoidance of the drawing, size, theme and opacity. The defaults are calibrated to work without adjustment on stocks, indices, forex, gold and crypto; the inputs most users touch are the window and the edge mode.

KNOWN LIMITS

The automatic panel corner does not count the summary labels of finished ranges, so on a crowded chart the panel can still cover one of them: choose another corner, switch to Compact or turn the summaries off. With a very zoomed-out chart or a very short window, the summary labels of finished ranges pile up. With fewer than 50 bars of history the 50-bar ATR does not exist yet and the panel says the height is not measurable yet. The labels and the panel corner follow the visible part of the chart, so they can move when you zoom or scroll; the state, the boxes, the markers and the alerts do not.

OPEN SOURCE

Edo Range State is published as a free open source indicator. The full Pine Script is publicly accessible on TradingView for study, adaptation and integration into any workflow. Part of the Edolab Markets free tools ecosystem, all available on TradingView.

This indicator is a technical analysis tool for educational and informational purposes only. It does not generate automatic buy or sell signals and should not be considered financial advice. Trading financial markets involves significant risk of capital loss. Past performance does not guarantee future results. Always use proper risk management.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.