A regression channel combines an ordinary least-squares (OLS) line with a defined distance on each side. The line describes the chosen observations; its slope and width do not guarantee where the next close will land. This guide makes the window, price input and width formula explicit.
1. Define the model before reading the channel
A least-squares line minimizes the sum of squared vertical differences between recorded closes and fitted values. We use closes, not candle highs or lows. A residual is the close minus its fitted line value. Positive and negative slopes describe the selected sample, not an order direction or a promise of continuation.
At observation t, the prior model uses n closes from C[t−n] through C[t−1]. The selected C[t] is not fitted. Its boundary is a one-step extension of that fixed model. The refit comparison instead uses n closes through C[t], dropping the oldest close and adding the selected one. These are different samples.
2. Fit closes and calculate residual width
x = 0 … n−1; Cbar = ΣC/n; xbar = (n−1)/2
b = Σ[(x−xbar)(C−Cbar)] / Σ[(x−xbar)²]
a = Cbar − b*xbar; yhat = a + b*x
r = C − yhat; SSE = Σr²; s = √(SSE/n)
U/L = a + b*x ± k*s; R² = 1 − SSE / Σ(C−Cbar)²
Assign x = 0 to the oldest training close and x = n−1 to the newest. Fit yhat = a + b*x. The slope b is JPY per USD per recorded bar; a is the fitted value at x = 0. Evaluate the prior model at x = n for the next observation. Fifty training closes span 49 fitted steps; the projection adds one more.
In the positive-slope case, the prior 50-close model has a = 146.369929 and b = +0.018362. Its next-observation centre is 147.288033, with residual RMS 0.562234 JPY per USD. R² is only 0.181752: a positive slope can coexist with a relatively loose fit. Displayed residuals are rounded, so adding their displayed squares can differ slightly from the unrounded SSE.
Our descriptive width is s = sqrt(SSE/n), where SSE adds the squared training residuals. The main bands are yhat ± 2*s. This is not sqrt(SSE/(n−2)), the residual standard-error estimate for two fitted coefficients, nor the standard deviation of raw closes around their mean. A perfect straight sample has valid zero width; its residual/RMS score is unavailable. A constant sample also has undefined R².
| Measurement | JPY per USD |
|---|---|
| Residual RMS · √(SSE/n) | 0.562234 |
| Residual standard error · √(SSE/(n−2)) | 0.573828 |
| Raw-close standard deviation | 0.621548 |
| Maximum absolute close residual | 1.315416 |
3. Separate slope, wicks and closing location
The positive- and negative-slope cases show opposite fitted directions. R² measures how much of the training variation the fitted line explains; it is not a win probability. A steep slope can still fit poorly, and a strong fit need not survive the next observation. The cases contain no executed positions or strategy returns.
The wick case crosses a prior band intrabar while its close stays inside. A wick, a close outside and a tradable entry are three different facts. Equality with a boundary counts as inside here; only a strict closing excess counts as outside. Changing candle highs and lows without changing closes leaves our fit and residual width unchanged.
| Observation | H1 end · UTC | Slope · JPY per USD per recorded bar | Close versus selected bands |
|---|---|---|---|
| Positive prior slope | 2024-02-02 21:00 UTC | +0.018362 | Inside · equality included |
| Negative prior slope | 2024-04-05 04:00 UTC | -0.007473 | Inside · equality included |
| Wick outside · close inside | 2024-02-09 08:00 UTC | +0.038058 | Inside · equality included |


| H | L | Close · JPY per USD | Upper band | Lower band |
|---|---|---|---|---|
| 149.400 | 149.200 | 149.380 | 150.039975 | 149.230164 |
4. Change periods and multipliers carefully
Periods 20, 50 and 100 are fits on the same H1 series, not different timeframes. Each has its own sample, slope and width. The fixed comparison shows a negative 20-bar prior slope beside a positive 100-bar slope. Neither is a calculation error; they summarize different retained histories.
Multipliers 1, 2 and 3 expand the same residual width without changing the fitted line. They are illustrative settings, not tested trading thresholds. A band at two residual RMS units is not a 95% confidence interval, prediction interval or guaranteed containment rate. No distributional or independent-error claim is made for these market observations.
| Period | Slope · JPY per USD per recorded bar | Residual RMS · √(SSE/n) | Training R² |
|---|---|---|---|
| 20 | -0.001594 | 0.144826 | 0.004012 |
| 50 | +0.060552 | 0.610419 | 0.672047 |
| 100 | +0.052106 | 0.565500 | 0.876152 |

5. Compare the prior channel with a current refit
Refitting with the current close can move historical fitted points as well as the boundary at that close. In a live rolling calculation this is a new model, not evidence that an earlier known boundary had that later position. A manually extended drawing also remains an extrapolation, not an observed future price.
In the fixed July example, the close is 160.630. It is below the prior lower band 160.667008, but inside the refitted lower band 160.627503. The standardized residual changes from -2.256993 to -1.982987. The refit uses the same period but replaces one training close. It cannot erase the earlier prior-window observation.
| Model used for readings | Centre at selected bar | Lower band | Current residual / RMS | Close versus selected bands |
|---|---|---|---|---|
| Prior window · excludes A | 160.955012 | 160.667008 | -2.256993 | Below lower band |
| Refit · includes A | 160.921059 | 160.627503 | -1.982987 | Inside · equality included |

6. Follow rolling windows and source quality
An unchanged latest close does not freeze the model. Old observations leave, new ones enter and every training x index shifts. In the rolling example, the close stays 148.700 while the prior projected centre changes from 148.867102 to 148.826498. This is a window effect, not a newly executed trade.
All retained hours, including partial ones, advance the recorded window. Missing hours are not fabricated. The x index counts recorded bars, so a step across a gap is not one elapsed clock hour. A clean prior observation requires n complete adjacent training hours plus the complete adjacent selected hour; a clean refit requires its n included hours complete and adjacent. A gap can also reflect a market closure; the flag records a time discontinuity, not proof of a faulty feed.
Dirty windows can retain numeric fits, but their closing location is not classified here. The gap case keeps that warning visible. The explorer ends at the selected closed bar and uses no later candle. Residuals shown under a selected channel belong to that one selected fit; they are not the sequence of models that earlier bars would have seen.
An unchanged latest close

7. Give each measurement a clear role
This channel is not a Donchian High–Low boundary or an ATR envelope. Maximum close-residual widths, High/Low-based channels, raw-price standard deviations and residual RMS bands can produce different edges. CHOP and VHF describe other aspects of the same price history; combining them does not automatically create independent confirmation.
Before testing a strategy, save the fitting window, price input, width definition, eligibility, direction, entry timing, exits and costs. Decide whether the candidate bar is excluded before comparing it with a boundary. This guide does not test profitability. The later regression strategy needs a separate frozen protocol before any replay.
| Measurement | Definition used here | Practical distinction |
|---|---|---|
| Residual RMS | sqrt(SSE/n) | Descriptive spread around the fitted line |
| Residual standard error | sqrt(SSE/(n−2)) | Two fitted coefficients change the denominator |
| Raw-close deviation | Deviation of closes around their mean | Includes trend variation around the mean |
| Maximum close residual | max(abs(close−fitted)) | A different width, not a High/Low rule |
- Fix which close is excluded or included.
- Name the exact width formula and denominator.
- Read slope separately from fit quality and closing location.
- Inspect complete adjacent hours and retain gap warnings.
- Save a complete trading protocol before testing returns.
8. Inspect the selected fit and its residuals
Choose a case, period and multiplier. View the prior fit, the refit including the selected close, or both; comparison mode keeps the numeric readings on the prior model. Open components for x, close, fitted value, residual and squared residual. A marks the observation; B marks the oldest training close when visible. Cropping 80/140 bars changes only the view.
Prior window · excludes A
Loading retained historical fits…
A is the selected close; B is the oldest training close when visible.
Earlier history outside the crop still contributes.
- H1 end · UTC
- —
- Close · JPY per USD
- —
- Model used for readings
- —
- Training start · UTC
- —
- Training end · UTC
- —
- Slope · JPY per USD per recorded bar
- —
- Intercept · JPY per USD
- —
- Centre at selected bar
- —
- Upper band
- —
- Lower band
- —
- Residual RMS · √(SSE/n)
- —
- Residual standard error · √(SSE/(n−2))
- —
- Raw-close standard deviation
- —
- Maximum absolute close residual
- —
- Training R²
- —
- Current close minus fitted value
- —
- Current residual / RMS
- —
- Source-window quality
- —
- Close versus selected bands
- —
- Training closes
- —
Inspect fit components
| Time · UTC | x index | Recorded close | Fitted value | Residual | Squared residual |
|---|
Zero RMS leaves residual/RMS unavailable.
Frequently asked questions
Which closes enter the prior 50-bar model?
The 50 closes ending immediately before the selected close. Index them 0 through 49 and evaluate their fixed line at x = 50. The selected close is outside that fitting sample.
Can a later refitted drawing prove an earlier breakout?
No. Refitting changes the sample, slope and width. Compare an earlier observation with the model available at that observation, and keep the later drawing separate.
Do two residual RMS units mean 95% coverage?
No. These are descriptive bands from the selected training sample. They are neither confidence nor prediction intervals and carry no verified future containment rate.
Is residual RMS the same as standard error or raw-price deviation?
No. This guide uses sqrt(SSE/n). For two fitted coefficients, the standard-error comparison uses sqrt(SSE/(n−2)). Raw-price deviation measures closes around their mean rather than around the fitted line.
What happens with zero width or a constant sample?
A perfect straight sample has zero residual RMS and valid coincident bands. The residual/RMS score is unavailable. With constant closes, total variation is zero and R² is unavailable as well.
Does a wick or close outside create an entry?
No. A wick and a closing excess are separate observations. An executable strategy also needs eligibility, direction, timing, exits and costs. No trades or strategy returns are tested here.
Data and calculation scope
We reuse the 375,702 retained real USD/JPY M1 records from Forexite Trade/MetaStock 2024 used in CHOP and VHF. Their fixed GMT+1 timestamps were previously shifted back one hour to UTC. Minute labels are interval ends; H1 groups are (start,end]. Original daily archives were not downloaded again.
The reconstruction contains 6,265 H1 bars: 6,178 complete, 87 partial and 52 gaps before recorded hours. Cases are the first eligible observations under rules saved before calculation: positive slope, wick and gap from February; negative slope from April; refit from July; period and rolling comparisons from October. Their 140-bar windows may overlap.
The saved specification fixes periods, multipliers, prior/refit indexing, residual denominator, zero rules, quality and selection. The main program uses integer prefix and weighted sums with exact fractions and 70-digit square roots. A separate program rebuilds hours, fits centered direct windows and explicitly sums rational residuals using 90-digit arithmetic. Both were written by the same assistant, without external or terminal certification.
The downloads retain hourly models, minute inputs and archive checksums, both calculation programs, the specification and boundary checks. Synthetic fixtures test arithmetic only and are never plotted as market candles. Reproduction instructions remain in the ZIP. Reused history is not an unseen holdout or a profit forecast.
