clocks156t174

TrendLine Channels

Abstract
This script provides a set of Trendline Channels which can be tighter than Donchian Channels.
This script computes the most suitable active upper and lower trendlines and updates them as soon as possible.
We can use it for breakout signals earlier than Donchian Channels.

Introduction
Channels are tools which can mark area of values of ranging markets.
Once the price leaves the original region, range traders may start admitting they are wrong and trigger trend.
Donchian Channels (misheard as Dungeon Channels) use the highest and the lowest price to define area of values.
When the price breakouts, it just like it got released from a dungeon.
However, waiting for the price making even higher or lower may be too late and risk reward ratio may be lower.
Trendlines can make the channels tighter and we can find earlier breakout signals.

Computing Trendline Channels
(1) Find the most active trendlines
In this script, a valid trendline connects two high values or two low values.
A high value means the highest value in a trading day.
A low value means the lowest value in a trading day.
In this script, every trendline does not crossover any bar but can exactly touch them.
The most flat trendline is taken. (one for upper and one for lower)
(2) Continue to use or Change a trendline
If there is a tighter trendline available, this script changes to use it.
If the previous active trendline is broken, this script re-computes the trendline available.
When this case happens, this script display with an another color.
Otherwise, this script continues using the previous trendline.
(3) Middle line
The middle line indicates the middle value between the upper and the lower.

Parameters
Length : how many days are used for computation. The default value is 16 just because 16=4*4, using binary characteristic.
x_go_on : If the previous trendline is not breakout and there are no tighter trendlines available, we continue use it.

Color Options
(1) Upper trendline (no update or tighter)
(2) Upper trendline (changed due to breakout)
(3) Middle line
(4) Lower trendline (no update or tighter)
(5) Lower trendline (changed due to breakout)

Conclusion
Trendline Channels can be tighter than Donchian Channels and evaluate earlier breakout signals.
Comparing to known auto trendline scripts, Trendline Channels is continuous.
Once a trendline is broken, Trendline Channels can instantly point out the next available one.
If you think the price movement is boring or you cannot have good risk reward ratio, you can go to an another timeframe.

Reference
How to trade with Donchian Channels
How to trade with Trendlines
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?