Duyck

trendline function - JD

3940 views
563
3940 26
!EXPERIMENTAL!

As TV doesn't provide a function to draw lines between points, I wrote a function to do this in one my own indicators.
The function itself however can be applied/modified for different use cases, eg. drawing trendlines .
In this (proof of concept) example I used it to draw lines based on past high/low pivot points .

The inputs required:
* an INPUT FUNCTION (in this form, its designed to work with functions that have occasional values and na-values between them, it then connects the non-zero values to form a line)
* a BOOL (to indicate if you want to draw only the rising or falling lines)
* a DELAY (in this case this is the lookback period for the pivot-points function, this is to compensate the calculation of the past and realtime points)

The function returns:
* the function to draw the extension from the BASE-LINE to the current time (here this is the connection of the last pivot-point to the current point to bridge the gap of the lookback period, this is NOT REALTIME!)
* the function to draw the extension for the current time (here this is the continuation of the line until a new pivot-point is valid, this is DRAWN IN REALTIME!!)
* the color of the lines (in this case the lines are only colored (lime or fuchsia) if they either go up or down, else they are invisible, this is to clean up the invalid lines)

these output functions can then simply be plotted using the 'plot' function.


JD .
Nov 20
Versionshinweise: * Added MTF option
* Added choice between colored or monochrome lines
* Added option to show only falling lines for "highs"-trendlines and rising lines for "lows"-trendlines or show all calculated lines
* Added switch between REGULAR and LOGARITHMIC SCALE trendlines !

Any suggestion? Feel free to share!!

JD.
Nov 20
Versionshinweise: fixed cluttered screenshot
Nov 23
Versionshinweise: * code clean-up
* added option to extend the trendlines to the future (Beta: some gaps may appear,... still working on that ;-) ! )

JD.
Von Favorisierten Skripten entfernen Zu Favorisierten Skripten hinzufügen
Disclaimer.
I AM NOT A FINANCIAL ADVISOR.
THESE IDEAS ARE NOT ADVICE AND ARE FOR EDUCATION PURPOSES ONLY.
ALWAYS DO YOUR OWN RESEARCH!
JD.
A little tip is always nice!
BTC: 1G9xXYWSoxJR2ikkB7Px6RwBLC5pjHmwZD
http://paypal.me/jorisduyck
HI ALL,

THIS IS THE PREVIOUS VERSION OF MY TRENDLINES INDICATOR,
I HAVE A NEW VERSION FOR PINESCRIPT VERSION 4 AT THIS LINK!

Antworten
Hi Duyck,

Great Work,Really Appreciated and Amazing

Thanks A million For Your Support And Assistance

All The Best And Respect...
Antworten
@ZAQDA, Thank you for the nice comment! Glad to help!!
JD.
Antworten
Hi, just wanted to give a shoutout to @binary36 for the original inspiration for this script. I see lots of people selling this exact script lately on TV for around 200 and even up to 399$!!!

I made this script because I wanted my RSI script to draw automatic trendlines and I made this specifically as a function that could be imported in any other script to fill a gap in the TV library, free for all to use, explore, improve upon,... in their scripts.

Not to scam unsuspicious people into paying hundreds of dollars.

gr.
JD.
Antworten
Hi I love the script but can you please make so that the

- upper trendlines only point in a downwards slope ie the latest pivot is lower than the last
&
- Lower trendlines only point in an upwards slope ie the latest pivot is higher than the last

this change or the option for this change would make this script perfect for my use :)
Antworten
Lij_MC Lij_MC
@Lij_MC, Actually all good I see that you already have this function my bad
Antworten
Duyck Lij_MC
@Lij_MC, haha, jup there's a switch for it ;-)
Antworten
Can you put alerts? Thanks
Antworten
@msY,

Hi, alertconditions could be written, but is not really easy since there are a lot of lines the same time.

If I find some time, maybe I'll try to put some of the code from my RSI indicator (to detect the trendline breaks) in this code.
It's basically the same principle.

JD.
Antworten
msY Duyck
@Duyck, Thanks
Antworten
Startseite Aktien-Screener Forex-Screener Krypto-Screener Wirtschaftskalender Shows So funktioniert es! Chartmerkmale Preise Hausregeln Moderatoren Webseite & Brokerlösungen Widgets Charting Lösungen Lightweight Charting Library Hilfe Center Einen Freund empfehlen Feature-Anfrage Blog & News Twitter
Profil Profileinstellungen Konto und Abrechnung Einen Freund empfehlen Meine Support Tickets Hilfe Center Veröffentlichte Ideen Followers Ich folge Private Nachrichten Chat Abmelden