TradingView
Trendoscope
29 okt 2021 06:36

Auto TrendLines [HeWhoMustNotBeNamed] 

Beskrivning

I started off with the intention of creating script to identify Wolfe wave projection. But, soon ran into problem with loops. Realized drawing wedge is more difficult than drawing converging triangle. Hence, took a step back and started working on wedges and triangle identification. Ended up with a messy output which looked like this.



Had to take another step back and hence decided to make Trendlines detection script and here we are :)

Process
▶ Scan pivots which are in trend. This means, series of pivot Highs or pivot lows either in ascending order or descending order.
▶ Draw trend line between each of the pivots in the trend series. For example, if there are 5 pivot high uptrend pivots, draw mXn lines between each of these points.
▶ Select the trend line which is more accurate or stronger. Accuracy is measured by number of candles/wicks touching the line and number of candles which fall outside the line. Stronger trendlines will touch more candles and pivots with less overflow.
▶ Remove all lines except the most accurate one for each direction.

At any point of time, you will see upto 4 trend lines in this script.

▶ Trendline joining pivot highs in uptrending condition
▶ Trendline joining pivot lows in uptrending condition
▶ Trendline joining pivot highs in downtrending condition
▶ Trendline joining pivot lows in downtrending conditions

The older line will remain until the new one comes through of same type. Hence, you will still be able to see uptrending high and low trend lines for downtrending instruments which are created way back!! Also, new trendlines replace old ones only if they are more stronger (connect to more pivots with less overflow)

Settings

Settings are simple.


User can select preferred Zigzag Length and Search Depth. Higher numbers for these two parameters will present longer term trends whereas lower numbers will display shorter ones.
Trend Lines controlls will allow users to enable/disable specific type of trend line, set color and line style to it.

Few Examples

Uptrending Market : NASDAQ:NDX


Downtrending Market : NYSE:BABA


Ranging Market : NYSE:PLTR

Versionsinformation

⬜ Few Major Updates

▶ Custom Candle Source
Added feature to chose custom candle source


Making use of customcandles library methods to derive custom candles. Availalbe candle source options are :
  • regular (Regular OHLC candles)
  • ha (Heikin Ashi Candles)
  • ma (Moving Average Candles)


▶ Historical Trail
Added option to show historical trail of trend lines. Trail will appear as dotted lines with low visibility so that it will not take too much chart space and impact visibility.



▶ Live Stats of nearest trendlines

Live stats are shown for the immediate and nearby trendlines. If the trendline is far away, then it will not be shown. At least two trendlines stats will be shown.

Versionsinformation

  • Added last update status to table - which shows how many bars back the trendline was created.
  • Added trend watermark - which shows whether high and low trendlines are in Uptrend, Downtrend, Converging or Diverging Triangles :)


COINBASE:SHIBUSD shows downtrend as nearest two trendlines are both going down.


Whereas COINBASE:DOGEUSD presents converging triangle.

Versionsinformation

Fixed memory issue

Versionsinformation

Minor updates

Versionsinformation

Update preview

Versionsinformation

Update preview
Kommentarer
badsector666
It's shameless for me to request something after much contibution that you provide for the community.
But can you make library that will handle trade simulation on indicator?
so we can just make buy or sell condition than the lib will do the rest such calculate PnL or anything so we can show it on the table just like calling zg.zigzag(paramx).
ex : buycon == xxx, sellcon == xxx
if (buycon) then ts.buy(paramx)
the show the return array to the table.
Thank you for all your hardwork.
ricknatan
Very nice! Thank you! Does it repaint? Or how often changes?
Trendoscope
@ricknatan, as mentioned in the description, as and when new and stronger trendline appear, older one is removed.
mujricrypto
I need your harmonic indicator please
Trendoscope
@mujricrypto, Please go through "Author's instruction" section of the required script.
dediz26
Hey man this work is one of the magical indicator on tradingview..! i hope you should update the code with new features, new thinks... Thank you sir,, regards.
casehakam
good work mate
Jabbe
Thank you for the continuous updates. Is there a way to adjust the location of the table? The OHLC values are currently overlaying over the table on my chart. Thanks again, mate for sharing.
dgmoon
Nice HeWo"
Ninja_Boa
Hi!. I want to learn how to use your indicators effectively. Can you teach?.
Mer