TradingView
allanster
26 May 2020 18:51

How To Show Vertical Lines 

EURO / U.S. DOLLARICE

Açıklama

Example of various methods to show dashed or solid vertical lines on chart based on using either session or time.

Credit for line method goes to midtownsk8rguy -> tradingview.com/script/EmTkvfCM-vline-Function-for-Pine-Script-v4-0/

Credit for plot method goes to PineCoders -> pinecoders.com/faq_and_code/

Special thanks to LucF, midtownsk8rguy, and PineCoders for permission to use their work.

NOTICE: This is an example script and not meant to be used as an actual strategy. By using this script or any portion thereof, you acknowledge that you have read and understood that this is for research purposes only and I am not responsible for any financial losses you may incur by using this script!

Sürüm Notları

Updated for Pine Script v5.

Sürüm Notları

Updated with cosmetic changes & stricter boolean check:
// previous isTime = time(timeframe.period, i_Time + ":1234567") bgcolor(i_BkGr and isTime ? color.new(color.gray, 50) : na) // revised isTime = not na(time(timeframe.period, i_Time + ":1234567")) bgcolor(i_BkGr and isTime ? color.new(color.gray, 50) : na)
Yorumlar
michael10518
I'm looking to mark future times in minutes and draw vertical lines. For example it's 8AM and I want to have vertical lines at 9:15, 10:11, 11:44 etc. Basically marking out future times. Can I do that with this indicator? I would need a ton of lines. The times will stay the same every day.
allanster
@michael10518, this script's purpose is merely to show examples of some of the various methods that can be used to draw vertical lines. The solution to your question is outside the scope of what this script is intended for and this script would require some minor modification to suit your needs. Please direct your question to one of the locations described at bottom of the following link: tradingview.com/support/solutions/43000478425-i-m-trying-to-code-an-indicator-and-i-want-tradingview-s-team-to-help-me-with-it/
LZ889
@michael10518, Hi Michael, I am looking for the exact same indicator. Any luck?
michael10518
@LZ889, Never heard from them but you can get it programmed for sure. I ended not needing it so I didn't move forward with creating the indicator.
Reisfelt
@LZ889, did you ever get the code for this
MomentumReturns
i love this indicator for fx pairs- however it doesnt work on gold for some reason??
allanster
@MomentumReturns, thanks for your feedback. You have not specified which symbol you are having issue with, although script should work irrespective of symbol. I updated logic for stricter boolean checks which should avoid the new warning regarding using integers for boolean evaluations, but this revision should not be related to your issue. Double check that the time you are specifying in settings is an available bar opening time for the chart interval you are using.
MomentumReturns
@allanster, thanks for replying. i have configured your indicator purely to delineate (with a vertical line) the close/open of new trading day- a timestamp essentially. your indicator is the best ive found over the years to make my charts look tidy, streamline, uncluttered etc. inputs: ive unticked 'show method background', set hour to '17'(new trade day), unticked 'show method line', ticked 'show method plot'. style: ive unticked 'background colour', ticked 'plot' & chosen 'histogram', unticked 'lines', & unticked both 'labels on price' & 'values in status'. highly recommend setting up this way for this purpose (if need be). ive solely traded EU & recently have incorporated XAUUSD- & noticed when i toggle between the two charts the vertical line only appears on EU however does not show up on XAUUSD. i would love to have it show up on both. any more help would be grateful =)
MomentumReturns
@allanster, i have just noticed that XAUUSD seemingly skips a whole hr each day around swap times- the precise hr i had your indicator set too. which you did troubleshoot for me in your response. problem solved. TY
allanster
@MomentumReturns, thanks for update and glad to hear that you were able to get it sorted.
Daha Fazla