ChrisMoody

CM Time Based Vertical Lines

Dilihat 11803 kali
1884
11803 16
CM Time Based Lines

Requested by codetrader to Visually Show Day Change on Intra-Day Charts.


Custom Indicator: Ability To Plot Recurring Time Lines On Chart!

Example of Uses:
Plot Lines at Midnight to Show Daily Change.

Plot Lines at Opening of Different Sessions.

Plot Lines at Opening and Closing of Sessions.

Plot Lines Every 4 Hours (Forex) To See 4-Hour Price Action!

Ability to Change Times!

Ability to Plot Up To 6 Recurring Time Based Lines!

Plus Many Other Uses!

Ability To Turn On/Off Any of the 6 Customizable Lines in Inputs Tab!

Ability To Change Thickness of Lines to Cover Multiple Bars!
Keluarkan daripada Skrip Pilihan Tambah kepada Skrip Pilihan
//Created By ChrisMoody on 9-14-2014 To plot Background Highlights for Recurring Times
//Requested by codetrader
study(title="CM_TimeBased_Vertical Lines", shorttitle="CM_TimeBased_Lines",overlay=true)
//timeinrange(res, sess) => time(res, sess) != 0

def = input(false, title="For Stocks Adjust Custom Session to 0930 or Close of Previous Days bar to see Day Change")
def2 = input(false, title="For Hourly Bars Adjust Start & End Times to 1 hour, 4 hour bars adjust to 4 hours, 5 Min Bars to 5 Minutes etc.")
def3 = input(false, title="-------------------------------------------------------------------")
sessNum = input(1, title="Plot Vertical Line On Chart-Custom 1", minval=1, maxval=1)
sh = input(true, title="Show Custom 1?")
First = input('0000-0100', type=session, title="1 - Midnight (Day Change)")
sh2 = input(false, title="Show Custom 2?")
sessNum2 = input(2, title="Plot Vertical Line On Chart-Custom 2", minval=2, maxval=2)
Second = input('0300-0400', type=session, title="Custom 2")
sh3 = input(false, title="Show Custom 3?")
sessNum3 = input(3, title="Plot Vertical Line On Chart-Custom 3", minval=3, maxval=3)
Third = input('0800-0900', type=session, title="Custom 3")
sh4 = input(false, title="Show Custom 4?")
sessNum4 = input(4, title="Plot Vertical Line On Chart-Custom 4", minval=4, maxval=4)
Fourth = input('0930-1030', type=session, title="Custom 4")
sh5 = input(false, title="Show Custom 5?")
sessNum5 = input(5, title="Plot Vertical Line On Chart-Custom 5", minval=5, maxval=5)
Fifth = input('1500-1600', type=session, title="Custom 5")
sh6 = input(false, title="Show Custom 5?")
sessNum6 = input(6, title="Plot Vertical Line On Chart-Custom 6", minval=6, maxval=6)
Sixth = input('1700-1800', type=session, title="Custom 6")

//sessToUse = sessNum == 1 ? First : sessNum == 2 ? Second : sessNum == 3 ? Third : sessNum == 4 ? Fourth : sessNum == 5 ? Fifth : sessNum == 6 ? Sixth : '0000-0000'
sessToUse = sessNum == 1 ? First : '0000-0000'
sessToUse2 = sessNum2 == 2 ? Second : '0000-0000'
sessToUse3 = sessNum3 == 3 ? Third : '0000-0000'
sessToUse4 = sessNum4 == 4 ? Fourth : '0000-0000'
sessToUse5 = sessNum5 == 5 ? Fifth : '0000-0000'
sessToUse6 = sessNum6 == 6 ? Sixth : '0000-0000'

//Custom Session 1 Rules
bartimeSess = (sessNum == 0 ? time('D') : time('D', sessToUse))
bgPlot = (sessNum == 0 ? time(period) : time(period, sessToUse)) 
//Custom Session 2 Rules
bartimeSess2 = (sessNum2 == 0 ? time('D') : time('D', sessToUse2))
bgPlot2 = (sessNum2 == 0 ? time(period) : time(period, sessToUse2)) 
//Custom Session 3 Rules
bartimeSess3 = (sessNum3 == 0 ? time('D') : time('D', sessToUse3))
bgPlot3 = (sessNum3 == 0 ? time(period) : time(period, sessToUse3))
//Custom Session 4 Rules
bartimeSess4 = (sessNum4 == 0 ? time('D') : time('D', sessToUse4))
bgPlot4 = (sessNum4 == 0 ? time(period) : time(period, sessToUse4)) 
//Custom Session 5 Rules
bartimeSess5 = (sessNum5 == 0 ? time('D') : time('D', sessToUse5))
bgPlot5 = (sessNum5 == 0 ? time(period) : time(period, sessToUse5))
//Custom Session 6 Rules
bartimeSess6 = (sessNum6 == 0 ? time('D') : time('D', sessToUse6))
bgPlot6 = (sessNum6 == 0 ? time(period) : time(period, sessToUse6))

bgcolor(sh and bgPlot > 0 ? yellow : na, transp=40)
bgcolor(sh2 and bgPlot2 > 0 ? orange : na, transp=40)
bgcolor(sh3 and bgPlot3 > 0 ? aqua : na, transp=40)
bgcolor(sh4 and bgPlot4 > 0 ? fuchsia : na, transp=40)
bgcolor(sh5 and bgPlot5 > 0 ? maroon : na, transp=40)
bgcolor(sh6 and bgPlot6 > 0 ? lime : na, transp=40)

Komen

I would like the bars to adjust for every week, how do I do so?
+5 Balas
I'm not quite sure what Im looking at but I want a vertical line to always be placed at the 940am est mark. Does on of these codes accomplish that?
+5 Balas
It doesn't work with weekends, why? How to fix that? The only way is UNIX time?
+5 Balas
can i plot a day
like beginning Monday
over a month to several months s

can i plot a particular week
for checking yearly starts of cycles
like 1st or 3 rd week of month over several years
thanks
+5 Balas
Hello, could I have a question with you?
I want to print a vertical line on specific dates;
01/15/2018
02/19/2018
.
.
.
08/20/2018
I can not do it, would that be possible?
Thank you very much!!!
+3 Balas
How do I change the timeline from showing 00:00 to 18:00? I want it to show my days starting at 18:00.. Is that possible?
+2 Balas
Hey Chris, love your work man - fantastic! I had a quick question about this indicator/line add on.. How do I set it for a certain number of periods, say 9 days for example? Thoughts?
+2 Balas
Thanks Chris, if it's not too much to ask, how might i code a script to draw lines periodically in the future, for example, 5 bars from a swing high, or 20 bars, or both a line 5 bars from a certain bar, and another one 20 bars in the future? Must I input a bar number either hard coded in the script or could it be as input when the script is first run, and have the vertical lines then overlaid as future points in time?
Thank you in advance...
+2 Balas
How do you remove the recurring timelines on the chart?
+1 Balas
NCR321 NCR321
@NCR321, I figured it out. Sorry! I'm new to tradingview.
Balas
Laman Utama Penyaring Saham Penyaring Forex Penyaring Kripto Kalendar Ekonomi Bagaimana ia berfungsi Ciri-ciri Carta Harga Rujuk rakan Peraturan Dalaman Pusat Bantuan Laman web dan Penyelesaian Broker Widget Penyelesaian Pencartaan Perpustakaan Pencartaan yang Ringan Blog & Berita Twitter
Profil Tetapan Profil Akaun dan Pengebilan Rujuk rakan Tiket Sokongan Saya Pusat Bantuan Idea yang diterbitkan Pengikut Mengikut Mesej Peribadi Sembang Daftar Keluar