OPEN-SOURCE SCRIPT

Trendlines (long)

已更新
Hi all!

I hope that this indicator helps you to be a more efficient trader. The concept is well known and useful. So this is not some magic algorithm founded by me, but rather a well known concept. The concept is the drawing of trendlines.

It draws trendlines that has a retest. It draws the trendlines in different colors, the colors used are blue, red, fuchsia and lime.

These are the steps for finding a trendline:

1. Find a generic retest
Find a low that has 2 earlier lows and 1 later low that are higher. This is the reason that a trendline will be created "1 bar late". This is the base and the indicator goes on from here, meaning that this needs to be true to continue.

2. Find an uptrend
Look back 8 bars to find a low that is lower than the retest low.

3. Create the first point of a trendline
Go thru every bar between the user defined "Lookback" and the retest bar (minus the user defined "Skip gap" that's needed between points to create a trendline). From the earliest bar to the latest.

4. Create the second point of the trendline
Go thru every bar between the retest bar and the the first point (bar) minus the "Skip gap". From latest bar to the earliest. A trendline between the two bars are invalidated if some of the criteria are met in-between the bars creating the trendline:
- closed above the trendline (trendline broken)
- is not within the retest bar
- the slope of the trendline is upwards (this indicator is for long entries only)
- at least 1 of the bars creating the retest (1 main bar and 2 earlier bars) has NOT been above the trendline
- is not the created trendline (between the two points) that's closest to the low of the retest bar

TODO:
- add functionality to draw trendlines directly on breakouts
- add volume (high volume needed to create a trendline from a breakout/retest)
- ...?

I hope this explanation makes sense, let me know otherwise. Also let me know if you have any suggestions on improvements.

Best of luck trading!
版本注释
Hi all!

An update that updates previous trendlines if they are broken (the price has closed below it). This is visible as lines that are dotted instead of filled and does not continue after it's been broken. Hope this update suits you well!

Best of luck trading!
版本注释
The gist of this update is that it's now possible to also have trend lines that are based on pivot points. If a high price pivot point is detected it will create trend lines connecting the previous 3 (confıgurable through the "Lookback" setting) if it has a downwards slope and has not been broken by price between the pivot points (price has closed above it). The left and right lengths of the pivots are configurable, but defaults to 3. A pivot trend line is removed if the low of the price has been above it by the "Remove limit". This limit is configurable, as a factor of the Average True Range (ATR) with a length of 14, but defaults to 1.0.

You can force pivot trend lines to need to have a touch after creation. This will create fever lines, but maybe better once. The images below try to explain this. In the first images this is disabled (the trend line is visible) and enabled on the second and third once. On the second image no trend line is visible. It needs to be touched first. On the third image it has been touched and is therefore visible.
快照
快照快照

The pivot trend lines are invisible if the price has closed above it and visible if the price closes below it and it is invisible.

You can choose to show old/invalidated trend lines through the "Show old" setting, this is enabled for retested trend lines but not for pivot trend lines as default.
educationalTrend AnalysisTRENDLINERETESTtrendlinesupportzone

开源脚本

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

想在图表上使用此脚本?

免责声明