Log Regression Channel: Trend Phase & Range [Phase Corridor]

█ Overview
Phase Corridor is a logarithmic (log) regression channel that also classifies the market state. It fits the channel to the logarithm of price, so it follows percentage moves instead of cutting across them like a linear regression channel. On any timeframe it answers three questions. Is the market trending, drifting or ranging? If it is trending, is the pace steady, speeding up, cooling or reversing? And where does price sit inside the channel?
The fit quality (R-squared) acts as a trend-strength gate: a good fit gives a trend phase, a loose fit gives Drifting, and a poor fit gives Ranging. The chip shows the range levels and your position in them. A higher-timeframe row adds context.
It describes what price has done over a chosen window. It does not predict price and does not give entries or exits.

▌ Corridor
A centre line plus an outer and an inner band show the fitted trend and the typical distance of price from it. The colour shows the phase: Steady (teal), Accelerating (amber), Cooling (violet), Rolling over (red), Drifting (soft blue) and Ranging (grey). For Ranging and Drifting the corridor is faded and the centre line is dashed.
▌ Four-line chip
▌ Projection fan
For trending phases only, two labelled scenarios start from the last close: pace holds, and pace fades linearly. The label shows the resulting prices. The fan is hidden for Ranging and Drifting.
▌ Phase ribbon
A row of squares along the bottom of the chart shows the confirmed phase for each bar.

█ How It Works
█ How to Use
█ Settings
Core Logic
Higher-Timeframe Context
Corridor
Projection
Display
Colors
Advanced
█ Alerts
Seven alertcondition() alerts. Each is checked only on a confirmed bar, so each fires at most once per bar, at bar close. Alerts use the rolling fit of the chart timeframe as of that bar, which can differ slightly from the corridor drawn on the latest bar. There is no higher-timeframe alert.
Phase alerts follow the confirmation delay. Alerts track the current rolling state, not drawn objects.
█ Limitations
█ Disclaimer
This indicator is an analytical and educational tool. It is not financial advice and does not guarantee future results. Past behaviour does not predict future price. You are responsible for your own trading decisions.
Phase Corridor is a logarithmic (log) regression channel that also classifies the market state. It fits the channel to the logarithm of price, so it follows percentage moves instead of cutting across them like a linear regression channel. On any timeframe it answers three questions. Is the market trending, drifting or ranging? If it is trending, is the pace steady, speeding up, cooling or reversing? And where does price sit inside the channel?
The fit quality (R-squared) acts as a trend-strength gate: a good fit gives a trend phase, a loose fit gives Drifting, and a poor fit gives Ranging. The chip shows the range levels and your position in them. A higher-timeframe row adds context.
It describes what price has done over a chosen window. It does not predict price and does not give entries or exits.
▌ Corridor
A centre line plus an outer and an inner band show the fitted trend and the typical distance of price from it. The colour shows the phase: Steady (teal), Accelerating (amber), Cooling (violet), Rolling over (red), Drifting (soft blue) and Ranging (grey). For Ranging and Drifting the corridor is faded and the centre line is dashed.
▌ Four-line chip
- Headline: ▲ or ▼ for the window trend direction (● for Ranging) and the phase name, for example "▼ Easing" or "● Ranging". The pace of the fitted trend is in the headline's hover text.
- Line 2: the span and the range, for example "Sideways ~8 d: 80121 – 82891". The range is the outer corridor border at the latest bar. The first word is Rising, Falling or Sideways.
- Line 3: the distance to the nearer border as a share of the range width, for example "13% of range from upper border". If price is outside the range it reads "Outside · 8% of range above upper border" (or below the lower border).
- Line 4 (optional): the phase of the same fit on a higher timeframe, for example "1D ▼ Drifting lower". Phase only, no corridor is drawn.
▌ Projection fan
For trending phases only, two labelled scenarios start from the last close: pace holds, and pace fades linearly. The label shows the resulting prices. The fan is hidden for Ranging and Drifting.
▌ Phase ribbon
A row of squares along the bottom of the chart shows the confirmed phase for each bar.
█ How It Works
- Timeframe profile. Auto reads the chart timeframe: Fast intraday (5m and below), Intraday (above 5m up to 2h), Swing (above 2h up to 1D), Position (above 1D). The profile sets the default window (300, 200, 200, 120 bars), phase confirmation (8, 6, 5, 4 bars) and projection fade (70%, 60%, 50%, 50%). These are design defaults, not optimised values. Anything you set yourself overrides them.
- Fit. Price becomes ln(close). Ordinary least-squares regression over the window gives the fitted end value and slope. R² is the squared correlation between ln(price) and bar number. The residual spread is the standard deviation of ln(price) × √(1 − R²).
- Corridor. Outer band = fit ± Corridor width (default 2.0) × residual spread. The inner band is half of that. Both are converted back to price. The range shown in the chip is the outer band at the latest bar.
- Fit tiers. R² at or above Minimum fit quality (0.70) gives a trend phase. R² between the Loose-trend floor (0.35) and the minimum gives Drifting higher/lower: a direction with a loose fit and no pace phase. Below the floor the phase is Ranging. In Auto-fit mode five windows (35%, 50%, 75%, 100% and 150% of the base window) are tried and the longest that passes is used. Because that is a best-of-five choice, the threshold is raised to at least 0.85.
- Trend phase. The ratio is the slope of the most recent third of the window divided by the whole-window slope. 1.25 or more is Accelerating. 0.75 to 1.25 is Steady. 0 to 0.75 is Cooling. Negative is Rolling over (shown as "Uptrend rolling over" or "Downtrend turning up"). The 25% band is the Phase sensitivity setting. Downtrends use mirrored names: Declining faster, Steady decline, Easing.
- Confirmation. A new phase must persist for the profile's number of consecutive bars before it is shown or alerted.
- Position line. With the lower border at 0% and the upper border at 100% of the range, the chip reports the distance to the nearer border: from the upper border when price is above the centre line, from the lower border when below it. Outside the range it reports the overshoot beyond the border crossed.
- Pace. (e^(slope × unit length in bars) − 1), using the window's average calendar days per bar. Doubling or halving time (hover text) appears only within 10 window lengths. Beyond that, the move over the window is shown.
- Projection. Both scenarios start at the last close and use the fitted slope. "Pace holds" applies it unchanged. "Pace fades" shrinks it linearly by the fade percentage over the horizon. The horizon is capped at half of the fitted window.
- Higher-timeframe row. The same fit, with the same window length in higher-timeframe bars and the same thresholds, is requested with request.security (lookahead off). Unless "Include unfinished higher-timeframe bar" is on, the source is shifted by one higher-timeframe bar, so only closed bars enter the fit. The row uses the raw phase, with no confirmation delay.
- Timing. The corridor, fan and chip are redrawn on the latest bar from the newest window, so they move as new bars arrive. The ribbon and alerts use only data up to each bar.
█ How to Use
- Read the headline first. Teal means the recent pace matches the window pace. Amber means the recent pace is faster. Violet means it is slower. Red means the recent direction opposes the window direction. Soft blue means a direction exists but the fit is loose. Grey means no steady direction.
- Use the position line as range context. A small percentage means price is near that border and testing it. 50% is the centre line. "Outside" means the close is beyond the corridor.
- Treat Ranging as information. The chip then gives the levels of the range and where price sits in it.
- Use the higher-timeframe row as a backdrop. Agreement or conflict with the chart timeframe is context only.
- Use the fan as two what-ifs. It is arithmetic on the fitted slope, not a forecast.
- Be cautious around news gaps, thin liquidity, and when the fit tier changes often.
- Markets: crypto, forex and stock indices on any timeframe.
- This tool provides analytical information. It does not make trading decisions for you and is not a strategy.
█ Settings
Core Logic
- Timeframe profile (Auto): Auto, Fast intraday, Intraday, Swing, Position.
- Window mode (Fixed): Fixed uses one window. Auto-fit tests five windows with the stricter threshold (at least 0.85).
- Window (bars) (0): 0 uses the profile. Values from 60 to 800 override it.
- Minimum fit quality (R²) (0.70): raising it shows Drifting and Ranging more often.
- Loose-trend floor (R²) (0.35): sets where Drifting ends and Ranging begins. Set it equal to the minimum fit quality to turn the Drifting tier off.
- Phase sensitivity (%) (25): width of the Steady band.
- Confirmed bars only (off): the unfinished bar uses the previous close.
Higher-Timeframe Context
- Show higher-timeframe row (on).
- Higher timeframe (Auto): a 1m–2m chart uses 15m; up to 10m uses 1h; up to 30m uses 4h; up to 2h uses 1D; 4h uses 1W; 1D uses 1M; 1W uses 3M; monthly uses 1Y. Or choose 5m through 1Y. It must be above the chart timeframe.
- Include unfinished higher-timeframe bar (off).
Corridor
- Show corridor (on), Corridor width (2.0), Show inner band (on).
Projection
- Show projection fan (on), Horizon (bars) (50, capped at half the fitted window), Pace fade by end of horizon (%) (0 = profile).
Display
- Show info chip (on), Chip position (Top right), Pace unit (Auto), Show phase ribbon (on).
Colors
- Steady, Accelerating, Cooling, Rolling over, Ranging, Drifting (loose fit).
Advanced
- Recent window (% of window) (33), Phase confirmation (bars) (0 = profile).
█ Alerts
Seven alertcondition() alerts. Each is checked only on a confirmed bar, so each fires at most once per bar, at bar close. Alerts use the rolling fit of the chart timeframe as of that bar, which can differ slightly from the corridor drawn on the latest bar. There is no higher-timeframe alert.
- Growth pace accelerating: the confirmed phase becomes Accelerating.
- Growth pace cooling: the confirmed phase becomes Cooling.
- Trend rolling over: the confirmed phase becomes Rolling over.
- Ranging starts (trend fit lost): the confirmed phase becomes Ranging.
- Trend fit regained: the phase moves from Ranging or Drifting to Steady, Accelerating, Cooling or Rolling over.
- Close above corridor / Close below corridor: the close crosses the outer band, whenever the phase is not Ranging (this includes Drifting).
Phase alerts follow the confirmation delay. Alerts track the current rolling state, not drawn objects.
█ Limitations
- Drifting is descriptive. On pure random data, a 200-bar fit reaches R² of 0.35 or more in roughly half of windows (about 56% in a simple random-walk check), versus about 25% at 0.70. Drifting says a direction exists in the window, not that the trend is reliable.
- Ranging means no steady fit. It usually looks like a sideways range, but can also be choppy or whipsawing price. On lower timeframes it will appear often.
- R² describes fit, not truth. Auto-fit's best-of-five selection makes chance fits more likely, which is why its threshold is stricter.
- Redrawing. The corridor, fan and chip are refitted on every bar and move as new bars arrive. The ribbon and alerts use data up to each bar.
- Unfinished bars. The live bar can change readings until it closes. "Confirmed bars only" reduces this.
- Higher timeframe. By default only closed higher-timeframe bars are used, so the row can lag. With the unfinished bar included it can change until that bar closes. It needs enough history, otherwise it says so.
- Calendar-time pace. Pace uses average calendar days per bar, so for session markets closed hours count as elapsed time.
- Range borders move. They are the outer band at the latest bar, so they shift each bar and are not fixed support or resistance.
- Fan. It is arithmetic on a fitted slope. Prices can and do break out of it.
- Gaps and thin markets distort the fit and the band width. Defaults are not optimised for any market.
- Not a strategy. No performance or win-rate claims are made and none have been tested.
█ Disclaimer
This indicator is an analytical and educational tool. It is not financial advice and does not guarantee future results. Past behaviour does not predict future price. You are responsible for your own trading decisions.
🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻
📊 Free Tools: minimalisttrading.com/tools
👨🏫 Free Education: minimalisttrading.com/learn
📈 Trading Indicators: minimalisttrading.com
🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺
📊 Free Tools: minimalisttrading.com/tools
👨🏫 Free Education: minimalisttrading.com/learn
📈 Trading Indicators: minimalisttrading.com
🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻🔻
📊 Free Tools: minimalisttrading.com/tools
👨🏫 Free Education: minimalisttrading.com/learn
📈 Trading Indicators: minimalisttrading.com
🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺
📊 Free Tools: minimalisttrading.com/tools
👨🏫 Free Education: minimalisttrading.com/learn
📈 Trading Indicators: minimalisttrading.com
🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺🔺
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.