TradingView
kurtsmock
16 Th10 2020 14:00

Session High and Session Low 

Bitcoin / United States DollarCoinbase

Mô tả

I have heard many people ask for a script that will identify the high and low of a specific session. So, I made one.

Important Note: This indicator has to be set up properly or you will get an error. Important things to note are the length of the range and the session definition. The idea is that you would set it up for what's relevant to your trading. Going too far back in the chart history will cause errors. Setting the session for a time that is not on the chart can cause errors. If you set it to look farther back than there are bars to display, you may get an error. What I've found is that if you get an error, you just need to change the settings to reflect available data and it will be able to compile the script. At the time of its publishing, the default range start is set to 10/01/2020. If you're looking at this years later, you'll probably have to set the range to something more recent.

Features:
Plot or Lines:
Using Plot (displayed), the indicator will track the high/low from the end of the session into the next session. Then at the start of the next session, it will start tracking the high/low of that session until its end, then track that high/low until the start of the next session then reset.
Using lines, it will extend horizontal lines to the right indefinitely. The number of sessions back that the lines apply to is a user-defined number of sessions. There are limits to the number of lines that can be cast on a chart (roughly 40-50). So, the maximum number of sessions you can apply the lines to is the last 21 sessions (42 lines total). That gets really noisy though so I can't imagine that is a limiting factor.

Colors:
You can change the background color and its transparency, as well as turn the background color on or off.
You can change the highs and lows colors
You can adjust the line width to your preference

Session Length:
You can use a continuous session covering any user-defined period (provided its not tooooo many candles back)
You can define the session length for intraday
You can exclude weekends

Display Options:
You can adjust the colors, transparency, and linewidth
You can display the plotline or horizontal lines
You can show/hide the background color.
You can change how many sessions back the horizontal lines will track


Let me know if there's anything this script is missing or if you run into any issues that I might be able to help resolve.

Here's what it looks like with Lines for the last 5 sessions and different background color.

Phát hành các Ghi chú

Cleaned up some empty lines in the code

Phát hành các Ghi chú

If you liked it before it totally broke. You'll love it now. If you tried it before and it didn't work. Try it now.

Updated to v5 and packed it full of new options.
There's two modes. One that's session-based, one that's time-based.
Time-based and session-based work independently.

This indicator repaints! Its pretty clear when you look at the plot, but the thumbnail has lines.
The indicator updates as new highs and lows are created in the progression of time during the user-designated interval.
So, when you look at it retrospectively, you are not seeing what you'll see live.
This does not predict highs and lows. Its puts a range on a timeframe and updates it as the range expands.

Its useful code that has many good purposes, but it's not some kind of magical highs and lows finder.
Great for understanding what the current range is based on the interval you think is important.

Let me know if it's helpful and if there's anything that needs to be changed
Bình luận
Che_Trader
Thank you very much!
But I am not able to configure the sessions. It happens to me as another one says, it's all in one session. For example, if I want to mark the h/l of every Monday, how should I configure the script?
kurtsmock
@Che_Trader, This is designed to follow intra-day sessions. Setting up a script to track days of the week requires a completely different set of code or a pretty reasonable expansion of this set.
Now you can track since "Last Monday." To do this just set the range date to mondays date and don't check the "include sessions" checkbox. Then it will track the high and low since monday
Che_Trader
@kurtsmock, Got it! Thaks for the fast response, good job!
hypercryptocal
Fantastic script, many thanks. Would be spectacular if you could add a middle (equilibrium) line.
kurtsmock
@hypercryptocal, I'll try to do that for you
mohammad1490170
come
SAGARSEN268
Good
Stoodent101
Hi Kurt, thanks for a great script. The only floating sessions Hi Lo script that meets my needs. I'me having some problems with setting sessions time constraints. I have loaded this twice to capture OVN session on ES with one and RTH with the other. I'm in pacific time zone. It seems the time is in EST right? (I inspected the script but could not identify any time reference) When I set the session start time to 9:30 the start of session line is on 7:25 am my time (5m TF). Any ideas what I'm doing wrong?
kurtsmock
@Stoodent101, The time output that it should generate is the exchange timezone, which is the way tradingview does output time. Does that account for the mismatch?
The line does start one bar before because your line can't start and stop on the same line and still generate. Or otherwise stated, its the only way to make the line visible on the first bar on which it should be. Let me know if that helps
itsy
How would i get the high/low from midnight to midnight?
Thêm nữa