midtownsk8rguy

vline() Function for Pine Script v4.0+

5561 lượt xem
170
It's been a long time coming, but here is a versatile vline() function applicable to PSv4.0+ utilizing line.new(). I decided to finally figure this out at the request of another member recently. I have been waiting myself for months, but it's now time for an idea who's time has come to unleash upon planet Pine Script. It's a handy little function I believe will be very useful in the future. It only requires 4 parameters of BarIndex, Color, LineStyle, and LineWidth. Make sure you place it in an appropriate if() block to use it properly. As displayed above, this plots every 10 bars using a conditional statement employing the rarely used modulus operator.

Use it as you please, this is free code to implement into your new Pine projects. I don't require an credit for any one to use this function. I simply don't want any credit. I would however like to see some great ideas utilizing this when I randomly and accidentally come across them in the public library. I didn't know where to put this script, so I just tossed into the "Trend Analysis" category. I'm pondering we members need a "Miscellaneous" category some time in the future.

The comments section below is solely just for commenting and other remarks, ideas, compliments, etc... regarding only this indicator, not others. If you do have any questions or comments regarding this indicator, I will consider your inquiries, thoughts, and concepts presented below in the comments section, when time provides it. When my indicators achieve more prevalent use by TV members , I will implement more ideas when they present themselves as worthy additions. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
Phát hành các Ghi chú: Provided recommended function permutations that might be suitable for study(overlay=true) and study(overlay=false) scenarios. In some situations with the original script release, auto-scaling was affected by line.new() with unintended expectations.
Mã nguồn mở

Với tinh thần của TradingView, tác giả đã xuất bản tập lệnh theo mã nguồn mở, vì thế trader có thể dễ dàng hiểu và tùy chỉnh được. Bạn có thể sử dụng miễn phí, hoặc tùy chỉnh lại mã đã được cấp phép bởi Quy tắc Chung. Bạn có thể sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Bình luận

How could you start this from a specific day or date?
+11 Phản hồi
hello , how can i plot a single vertical line on chart for specific year , month , day determined by input function ?
+3 Phản hồi
ahmedsindi ahmedsindi
@ahmedsindi, i mean how to input date like ( 24/3/2020) to make vertical line at that specific date ?
+5 Phản hồi
Why does it stop before August?
+2 Phản hồi
Hi, how to modify to change for weekly interval start day of the week?
+2 Phản hồi
Perfect. Thank you!
+1 Phản hồi
very nice, thanks so much for sharing. Good luck with your trades
Phản hồi
A good alternative would be something like this:

//@version=4
study("vlines", overlay=true)
tenth = bar_index%10 == 0.0
vlines = tenth ? close * 100 : na
plot(vlines, style=plot.style_histogram)
Phản hồi
This is nice, but it doesn't show how to apply a line to a certain day or hour. How can this be included as an input?
Phản hồi