OPEN-SOURCE SCRIPT
Machine Learning Trend Channels [FEELS]

Trend channels placed by a machine learning model (change-point detection) instead of a length you have to guess. The model decides where one period of price behaviour ends and the next begins, how many periods the chart has, and how wide each channel should be. There is no length input anywhere in this script — the whole history comes out as a chain of channels handing over to one another, with no gaps and no overlaps.
FEATURES
- Periods found by an online change-point search, one channel per period, covering the history continuously
- No length setting to guess — the model chooses every boundary and how many periods there are
- The cut score carries no units, so the same setting behaves the same way on a quiet index and on a coin in free fall
- Fitted in log price, so one long trend is not split apart by its own curvature
- Channel width learned from the spread of that period's own bars, not an ATR multiple and not a fixed number of deviations
- Colour from slope measured against the period's own width: up, down, or sideways
- Panel comparing the period now forming with the median of this symbol's own past periods of the same kind
- A closed period is frozen at the moment it closes and is never recalculated
- Alert when a period closes and a new one opens
- Every model parameter, colour and size adjustable, every input has a tooltip
HOW IT WORKS
For the stretch of price it is currently holding, the model asks one question on every closed bar: is this better described by one straight line, or by two?
It scores every possible place to cut that stretch and takes the best one. The score is how much the cut improves the fit, divided by how badly the two resulting lines still fit. That second half is the important part. Dividing by the stretch's own leftover spread is what strips the units out of the number, so a violent market does not get chopped more finely than a calm one merely for being violent. When the score clears the Detail threshold, the left piece is closed permanently and the right piece becomes the new forming period.
Everything is fitted on the logarithm of price. In plain price, one long exponential trend gets broken into a dozen channels purely by its own curvature, which is a measurement artefact rather than market structure.
The width is measured, not assumed. Each channel takes its width from how far its own bars actually strayed from its own line, drawn just wide enough to hold the share you set under "Channel covers". A period whose bars hugged the line is thin; a period that swung around it is wide.

HOW TO READ IT
1. A solid channel is a closed period. Its slope, width and endpoints were fixed the moment it closed. An outlined channel is the period still forming, shown together with the cut the model is currently leaning towards.
2. Colour is slope. A period is called sideways when its whole rise or fall is smaller than its own width, that is, when the drift is smaller than the noise around it.
3. Width is dispersion, not a boundary. A wide channel says that period was noisy. It does not say price will turn there.
4. The panel puts the forming period next to what this symbol's own periods of the same kind have typically looked like. "down, 21 bars, usually 31, moved -14.7%, usually 50.6%" reads as: shorter and far smaller than this symbol's usual decline, so far. The sample count is shown next to it, because five periods is a hint and sixty is a distribution.
ORIGINALITY
Every channel tool on this platform asks you for a length. Fifty bars, two hundred, and the entire picture changes with that one number. The better ones automate it by scanning lengths and keeping the best-fitting window, which still produces a single channel measured backwards from today.
This one treats the chart as a segmentation problem instead. The whole history is a chain of periods that hand over to one another, the boundaries are found rather than set, and the number of periods is an output rather than an input. The scale-free cut criterion, the log-space fitting, the learned width and the comparison of the live period against this symbol's own past periods are written from scratch for this script.

HONESTY
- Closed periods never change. Once a cut is confirmed, that channel's numbers are frozen and the drawing is rebuilt from those frozen numbers, so stepping through bar replay will not move a solid channel.
- The forming period does change, and it is the whole forming period, not only its last few bars. Its cut stays provisional until confirmed, which typically takes twenty to thirty bars after the fact. That is why it is drawn as an outline. Any tool that finds structure behaves this way.
- The channel edges are not support and resistance, and I checked rather than assumed. Asking only about the very next bar, price leaves a band built to hold ninety per cent of its own bars far more often than that width suggests, and the bars that escape go out of the top and the bottom in roughly equal numbers. There is no bounce hiding in the edges.
- Nothing here predicts anything. A closed period is a statement about bars that have already closed.
- The panel medians describe past periods on the current symbol and timeframe. They are not performance figures and small samples move them a great deal, which is why the count is on screen.
- TradingView allows a script five hundred drawing objects and drops the oldest past that, so only the most recent periods are drawn. Raise "Periods kept on screen" if you want more history covered.
ALERTS
A period closed and a new one opened.
SETTINGS
Every input has a tooltip. The main ones: "Detail" sets how much better two lines must fit than one before a period is closed, and because it carries no units the same value transfers across symbols and timeframes. "Shortest period" and "Longest period" are hard bounds in bars. "Channel covers" is the share of a period's own bars the channel is drawn wide enough to hold. "Call it sideways below" controls how small a move must be, relative to its own width, to be coloured sideways. "Periods kept on screen" trades history for drawing budget.
This is a descriptive tool for reading price structure. It is not financial advice and does not predict price.
FEATURES
- Periods found by an online change-point search, one channel per period, covering the history continuously
- No length setting to guess — the model chooses every boundary and how many periods there are
- The cut score carries no units, so the same setting behaves the same way on a quiet index and on a coin in free fall
- Fitted in log price, so one long trend is not split apart by its own curvature
- Channel width learned from the spread of that period's own bars, not an ATR multiple and not a fixed number of deviations
- Colour from slope measured against the period's own width: up, down, or sideways
- Panel comparing the period now forming with the median of this symbol's own past periods of the same kind
- A closed period is frozen at the moment it closes and is never recalculated
- Alert when a period closes and a new one opens
- Every model parameter, colour and size adjustable, every input has a tooltip
HOW IT WORKS
For the stretch of price it is currently holding, the model asks one question on every closed bar: is this better described by one straight line, or by two?
It scores every possible place to cut that stretch and takes the best one. The score is how much the cut improves the fit, divided by how badly the two resulting lines still fit. That second half is the important part. Dividing by the stretch's own leftover spread is what strips the units out of the number, so a violent market does not get chopped more finely than a calm one merely for being violent. When the score clears the Detail threshold, the left piece is closed permanently and the right piece becomes the new forming period.
Everything is fitted on the logarithm of price. In plain price, one long exponential trend gets broken into a dozen channels purely by its own curvature, which is a measurement artefact rather than market structure.
The width is measured, not assumed. Each channel takes its width from how far its own bars actually strayed from its own line, drawn just wide enough to hold the share you set under "Channel covers". A period whose bars hugged the line is thin; a period that swung around it is wide.
HOW TO READ IT
1. A solid channel is a closed period. Its slope, width and endpoints were fixed the moment it closed. An outlined channel is the period still forming, shown together with the cut the model is currently leaning towards.
2. Colour is slope. A period is called sideways when its whole rise or fall is smaller than its own width, that is, when the drift is smaller than the noise around it.
3. Width is dispersion, not a boundary. A wide channel says that period was noisy. It does not say price will turn there.
4. The panel puts the forming period next to what this symbol's own periods of the same kind have typically looked like. "down, 21 bars, usually 31, moved -14.7%, usually 50.6%" reads as: shorter and far smaller than this symbol's usual decline, so far. The sample count is shown next to it, because five periods is a hint and sixty is a distribution.
ORIGINALITY
Every channel tool on this platform asks you for a length. Fifty bars, two hundred, and the entire picture changes with that one number. The better ones automate it by scanning lengths and keeping the best-fitting window, which still produces a single channel measured backwards from today.
This one treats the chart as a segmentation problem instead. The whole history is a chain of periods that hand over to one another, the boundaries are found rather than set, and the number of periods is an output rather than an input. The scale-free cut criterion, the log-space fitting, the learned width and the comparison of the live period against this symbol's own past periods are written from scratch for this script.
HONESTY
- Closed periods never change. Once a cut is confirmed, that channel's numbers are frozen and the drawing is rebuilt from those frozen numbers, so stepping through bar replay will not move a solid channel.
- The forming period does change, and it is the whole forming period, not only its last few bars. Its cut stays provisional until confirmed, which typically takes twenty to thirty bars after the fact. That is why it is drawn as an outline. Any tool that finds structure behaves this way.
- The channel edges are not support and resistance, and I checked rather than assumed. Asking only about the very next bar, price leaves a band built to hold ninety per cent of its own bars far more often than that width suggests, and the bars that escape go out of the top and the bottom in roughly equal numbers. There is no bounce hiding in the edges.
- Nothing here predicts anything. A closed period is a statement about bars that have already closed.
- The panel medians describe past periods on the current symbol and timeframe. They are not performance figures and small samples move them a great deal, which is why the count is on screen.
- TradingView allows a script five hundred drawing objects and drops the oldest past that, so only the most recent periods are drawn. Raise "Periods kept on screen" if you want more history covered.
ALERTS
A period closed and a new one opened.
SETTINGS
Every input has a tooltip. The main ones: "Detail" sets how much better two lines must fit than one before a period is closed, and because it carries no units the same value transfers across symbols and timeframes. "Shortest period" and "Longest period" are hard bounds in bars. "Channel covers" is the share of a period's own bars the channel is drawn wide enough to hold. "Call it sideways below" controls how small a move must be, relative to its own width, to be coloured sideways. "Periods kept on screen" trades history for drawing budget.
This is a descriptive tool for reading price structure. It is not financial advice and does not predict price.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
💰Free Channel — t.me/FeelsStrategy
🤵For more info contact — t.me/VolodymyrFeels
🔗 Links — feelsstrategy.com/links
🤵For more info contact — t.me/VolodymyrFeels
🔗 Links — feelsstrategy.com/links
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
💰Free Channel — t.me/FeelsStrategy
🤵For more info contact — t.me/VolodymyrFeels
🔗 Links — feelsstrategy.com/links
🤵For more info contact — t.me/VolodymyrFeels
🔗 Links — feelsstrategy.com/links
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.