Session bars

this script marks off the extended hours trading for NY session. Shades the off hours and overnight data. Highlights the regular trading session for NY session. It can be adjusted for any particular market.

I use it specifically to show the missing data on the SPY as compared with the continuous data on the SPX500 .
Open-source Skript

Ganz im Sinne von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es verstehen und überprüfen können. Ein Hoch auf den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Publikation unterliegt den Hausregeln. Sie können das Skript den Favoriten hinzufügen, um es auf dem Chart zu verwenden.

Möchten Sie dieses Skript auf einem Chart verwenden?


If i pasted this picture correctly the chart on the left is the SPX500 and on the right is the SPY. Notice on the left chart each shaded area has two blue vertical lines and the chart on the right appears to have only one blue vertical line. In fact there are two lines on the right chart as well. They are laid over each other is all. The same script if applied to both charts. The chunk of data between the two bars on the left chart is simply just not recorded on the chart on the right. The grey area on the right hand chart is there because i have the extended hours data button pressed so it reflects in the graph.

Often what appears to us as a gap on the SPY chart is smoothed out and explained by the continuous data on the left hand chart of the SPX500. There really is no "gap" really, only a lack of recorded data on one chart compared to the other.
+2 Antworten
Thank you
@Gwalleo, you are welcome. If you are interested we have a nice public chat room here on tradingview just follow this link https://www.tradingview.com/chat/#GLTODfGzJGbU1YVv
This doesn't work for me, all I see is green.
JamesPowell Melegito2018
@Melegito2018, use the settings button and change the colors and settings to your preference. You can also change to time as well if need be.
Melegito2018 JamesPowell
@JamesPowell, I don't know how to change something that doesn't make sense. At this point I tried to take out both t0 and t1 just to see what t will do. I think // means comment, but it doesn't work as I still have green and red. Why can't I upload picture here?!
//t0=time(period, "2000-2030")
//t1=time(period, "0400-0400")
//bgcolor(color = na ( t0 ) ? na:blue, transp=60)
//bgcolor(color = na ( t1 ) ? na:red, transp=60)
bgcolor(color = na ( t ) ? red:green, transp=70)

What I have under style backgroud color is 0 and 1.
On the chart I have green from Dec 10 14 and red from Dec 14 to 17 (that is weekend.) still makes no sense to me.
Melegito2018 Melegito2018
@Melegito2018, ok, my mistake, changed it to 9030-9040 now the green works but I still have the red. But the only reason I changed your original was that it was just gree.
Melegito2018 Melegito2018
@Melegito2018, Now all I have is this :
study("Session bars", overlay=true)
bgcolor(color = na ( t ) ? red:green, transp=70)

And the 5 day chart is all green. and under style, there is color 0 and color 1
What is red:green or na:blue ?
JamesPowell Melegito2018
@Melegito2018 I just PM'd you. Perhaps I can help. Look for my private message to you.
hoahauservice17 JamesPowell

I am from Vietnam . When i install "Session bar " But open hour on Tradingview is 23 PM . How do i can fix it ?Thank you for strong support