Duyck

Trendlines - JD

23975 views
3392
This script draws trendlines from the pivot points in the price chart.

The input for the function that draws the trendlines is any calculation or function (eg. pivot points ),
that most of the time and occasionally produces a 'non n/a' value.
The trendline function then connects the non n/a values and axtends the connections of those points in a trendline.

There is an option to draw the lines from the wicks or from the 'real bodies' of the candles.
The trendlines can either extend infinitely or only run for an adjustable amount of bars.

JD .
Release Notes: Added option for log charts.

JD.
Release Notes: Added some functionality from my v3 trendline script!

Added the option to display trendline breaks, NOTE: this is still "semi-Beta", awaiting new Pinescript functionality to do this more elegantly ;-)
you can set the number of past trendlines to check breaks against to avoid excessive cluttering of the chart.

Added alerts for the breaks.

Added the option to display trendlines in color or monochrome.

JD.
Release Notes: Added the option to filter out break signals.

You can chose so the script only gives "Long" break signals when price break upwards of a trendline formed by the highs and
only gives "Short" break signals when price break downwards of a trendline formed by the lows.

NOTE: when you experience 'ghost' signals, where you see a break, but don't see a trendline, then most of the times this is caused by a trendline fromed by two points that are not visible in the current viewport of the chart.
(this is a limitation TradingView built in to reduce the load on their servers)


To remedy this, I advise:

WHEN YOU FIRST PUT UP THE TRENDLINE SCRIPT, ZOOM ALL THE WAY OUT AND SCROLL ALL THE WAY LEFT!
Then all possible trendlines schould be visible.
Then you can zoom and scroll back to the part you want to see and the lines should stay in place.


JD.
Release Notes: small code correction, bigger update coming!
Release Notes: FINALLY GOT TO LIMITING THE AMOUNT OF LINES SHOWN, TO CLEAN UP THE CHART!
(not perfect yet, but much cleaner allready!!)


ENJOY!!

Gr, JD.
Release Notes: MAJOR UPDATE WITH ARRAYS !!

To keep track of the high and low pivot points and the time of occurence, these values are stored in a custom DATAFRAME ARRAY.
This dataframe structure basically turns the standard 1 dimensional Pinescript arrays in a structured 3D dataframe!

!! Feel free to use the df structure in other scripts if you so desire, however a little shoutout would be nice!! ;-)


//////////////////////////////////
/ BASIC INFO ON THE DATAFRAME: ///
//////////////////////////////////

The df is set up as an EXCELL workbook and is devided in SHEETS, ROWS/RECORDS and COLUMNS.

With the use of some purpose-built functions, values can be placed or retrieved in a specific column of a certain row on a certain sheet
this can be done by intuitively using sheet_nr, row_nr and column_nr coördinates,
without having to worry on what exact index of the Pine array this value is located (the functions do these conversions for you)


the syntax I propose for the 3D dataframe array has the following structure:

- the array starts with 3 VALUES describing the DIMENSION INFORMATION, (nr of sheets, rows, columns)
these are ignored in the actual calculations and serve as a metadata header (similar to the "location, time,... etc." data that is stored in photo files)
so the array always carries it's own info about the nr. of sheets, rows and columns and doesn't need is seperate "info" file!

To stay consistent with the standard Pinescript (array and ) indexing:
- indexes for sheets and columns start from 0 (first) and run up to the (total nr of sheets or columns) - 1
- indexes for rows also start from 0 (most recent, cfr.) and run up to the (total nr of rows) - 1

- this 3 value metadata header is followed by the actual df data
the actual data array can consist of (100,000 - 3) usable items,

In a practical example, you can have a df with 3 sheets, containing 6,666 rows with each 5 columns of data (eg. open, high, low, close, volume) in it!!!

Enjoy!

Gr, JD.
Remove from Favorite Scripts Add to Favorite Scripts
Disclaimer.
I AM NOT A FINANCIAL ADVISOR.
THESE IDEAS ARE NOT ADVICE AND ARE FOR EDUCATION PURPOSES ONLY.
ALWAYS DO YOUR OWN RESEARCH!
JD.

You can contact me for info/access in PM or on Telegram: @jduyck
PLS, DON'T ASK FOR ACCESS IN THE COMMENT SECTION!

Comments

Piece of art!!!
+5 Reply
Duyck Daveatt