Duyck

trendline function - JD

Duyck Wizard 已更新   
!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.
版本注释:
* 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.
版本注释:
fixed cluttered screenshot
版本注释:
* code clean-up
* added option to extend the trendlines to the future (Beta: some gaps may appear,... still working on that ;-) ! )

JD.

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!
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?