TradingView
DojiEmoji
16 Jul 2022 pukul 13.23

Auto Trendline Indicator (based on fractals) 

Bitcoin / TetherUSBinance

Huraian

A tool that automatically draws out trend lines by connecting the most recent fractals.

Description:
The process of manual drawing out trend lines is highly subjective. Many times, we don’t trade what we see, but what we “want to see”. As a result, we draw lines pointing to the direction that we wishfully want price to move towards. While there are no right/wrong ways to draw trend lines, there are, however, systematic/unsystematic ways to draw trend lines. This tool will systematically draw out trend lines based on fractals.

Additional feature:
This tool will also plot out symbols (default symbol “X”) to signify points of crossings. This can be useful for traders considering to use trend lines as part of their trading strategies.

Here is an interesting observation on the price actions of NASDAQ futures on a 5 second chart during regular trading hours on July 14, 2022.

It’s a phenomenon. People like to see straight lines connecting HL/LH, etc., so it's possible for the market as a whole to psychologically react to these lines. However, it is important to note that is is impossible to predict the direction of price. In the case above, price could have tanked below auto-drawn trend line. Fractal based trend lines should only be taken as references and regarded as price levels. No studies have ever proven that the slope of trend lines can indicate price's future direction.

More about fractals:
To understand more about fractals:

Contrary to what it sounds like, fractal in "technical analysis" does not refer to the recursive self-repeating patterns that appear in nature, such as the mesmerizing patterns found in snowflakes. The Fractal Markets Hypothesis claims that market prices exhibit fractal properties over time. Assuming this assertion to be true, then fractals can be used a tool to represent the chaotic movements of price is a simplified manner.

The purpose of this exercise is to take a tool that is readily available (ie. in this case, TradingView’s built-in fractals tool), and to create a newer tool based on it.

Parameters:
  • Fractal period (denoted as ‘n’ in code): It is the number of bars bounding a high/low point that must be lower/higher than it, respectively, in order for fractal to be considered valid. Period ‘n’ can be adjusted in this tool. Traditionally, chartists pick the value of 5. The longer it is, the less noise seen on the chart, and the pivot point may also be exhibited in higher timeframes. The drawback is that it will increase the period of lag, and it will take more bars to confirm the printed fractal.
  • Others: Intuitive parameters such as whether to draw historical trend lines, what color to use, which way to extend the lines, and whether or not to show points of crossings.

Nota Keluaran

Adjusted settings UI.

Nota Keluaran

Added new features:
- generic alerts
- adjustable line width
- separate line formats for new & old lines
- can specify maximum number of trend lines to show

Nota Keluaran

New feature: Shows fractals by plotting HL/LH/HH/LL in any user defined combo

Nota Keluaran

Refactor: Handle for fractal -> UDT
Komen
PineCoders
veryfid
Great work, do you have a version laying around that can use external indicator sources?
DojiEmoji
@veryfid, Thanks!

Actually I do, but just the standalone function:
tradingview.com/script/0DPp7kuS-FractalsLib/

function: fractals_flag(length, source of upper, source of lower) -> Returns arrays of bool regarding whether new upper/lower fractals have formed.
veryfid
@DojiEmoji, thanks for sharing, it's much appreciated. Wish you great success over the new year.
Trendoscope
Well done.
DojiEmoji
PineCoders
This publication is now featured in our Editors' Picks: tradingview.com/scripts/editors-picks/ .
In the name of all TradingViewers, thank you for your valuable contribution to the community, and congrats!
GGOR
Great work matey!
Imho it would be perfect with these mods:
1. set the minval to 1, the best one for price action analysis
2. set an input for lookback period, eg100 bars back, to get rid of all these old TLs and have a cleaner chart especially if you set to "1" the fractal strength
3. qualify the TL breakout (from dashed to solid) if there is one or more consecutive closes above or below it
4. set an option to use only lower highs (bearish TL) and higher lows (bullish TL)
I do not have any knowledge of pine script and I cannot tell you if 2 , 3 and 4 are doable.
By the way, I like it! Thumbs up
DojiEmoji
@GGOR, Thanks for the input. I like idea #3, so it has been added to the latest version. I will invite you to test it.
tradingview.com/script/dD3fTu16-KL-Private-Auto-Trendline-KL-latest/
This is the latest version. It contains new features that could be unstable, so it's not yet released to public. DM me if you want to try it out.
anthony20780
@DojiEmoji, I will like to try it
Lebih