TradingView
Duyck
٢٦ حزيران يونيو ٢٠١٩ ٠٨:٠٨

Trendlines - JD 

CHF/JPYOANDA

الوصف

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.

ملاحظات الأخبار

Added option for log charts.

JD.

ملاحظات الأخبار

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.

ملاحظات الأخبار

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.

ملاحظات الأخبار

small code correction, bigger update coming!

ملاحظات الأخبار

FINALLY GOT TO LIMITING THE AMOUNT OF LINES SHOWN, TO CLEAN UP THE CHART!
(not perfect yet, but much cleaner allready!!)


ENJOY!!

Gr, JD.

ملاحظات الأخبار

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 [lookback]) 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.[lookback]) 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.
التعليقات
LonesomeTheBlue
Duyck
@LonesomeTheBlue, Thanks for your kind support!
Gr, JD.
LonesomeTheBlue
@Duyck, you deserve much more
MartinXP
Its a great code.. you are genius !!
By the way, I couldn't get what "LOG Chart "function does and why it says, make sure to check this box?
ETHUSDEMA
HEELLLOOOOOO....

DUYCK, I CAN NOT COMMEND YOU ENOUGH ON THE AMAZING WORK YOU HAVE BEEN DOING AND SHARING...TRUE HERO.!!!

I have been playing around with this indicator and I changed the PLOT Lines to CIRCLES, so would like to know if its possible to be able to set an alert when the PLOT CIRCLE appears.?

I am trying to learn Pine Script, but I just get lost in the code of this indicator, so was wondering if it is not a big pain to set up an alert like that?

Super Thanks
Duyck
@ETHUSDEMA, hi, thanks for the support.
could you PM me please, I'm not 100% sure what you mean exactly!

Gr, JD.
Daveatt
Piece of art!!!
Duyck
@Daveatt, Thanks Dave!
Gr, JD.
Carl2021111
DOES THIS REPAINT? THX
Duyck
@CarlORourke, nope!
المزيد