How to use
Currently, this indicator is only intended to work on stock and future assets. I'm not sure what will happen when used with other assets, but that's not my problem. This will also only work on a 5 minute chart, but I am working to have it function with all intraday time frames. When viewing stocks, you have to turn off the Extended Hours view in chart settings, else the calculated values will be garbage.
Assuming your chart meets those 3 constraints, this indicator should work automatically, all values are displayed by default. It may take a while to process when you first add this indicator. If you are only viewing stocks, you may want to disable the overnight levels as they will always be n/a. When viewing stocks, levels are not drawn on the last bar for the US session (3:55pm) to avoid ugly connecting lines between sessions. If you want those lines to connect, it can be enables in the indicator settings.
If levels are not flat across the whole session or you are still experiencing difficulties/inconsistencies please review the known issues below.
This indicator breaks when the asset is missing data. If a bar is missing, this indicator will break and move to a different level that is no longer valid. You can tell a bar is missing because the time will jump, for example, from 2:15 to 2:25 instead of 2:20. Unfortunately, I think this is an issue with the data feed and I have no way of correcting this. From the test I have done with the data feed I have, this has not been a big problem with more popular assets, but results will vary. A more professional data feed may be required for consistent and proper results.
During my tests, I found that my future assets are always missing data from 3:10pm to 3:25pm. It was so consistent, I put code in to correct it. However, I'm not sure if other people will experience this same issue, or if the issue varies. Because of this, I there is a 'Fix missing data bug' input in the indicator settings that is enabled by default. If you are missing data from 3:10pm to 3:25pm on your chart (like myself) make sure this stays on. If you have data during this time, you need to turn that setting off.
This indicator only works when the USA session opens/closes at its regular time. Days that do no follow this rule may produce garbage levels. Don't worry, they will work fine the next day!
If you are not missing data for those assets during that time, you can turn this bug fix off in the indicator settings.
Unfortunately, missing data (bars) will continue to break this indicator until I can find a universal solution. For now, I can patch in fixes on specific, consistent cases, but it likely comes down to the data feed you have.
Added vertical line to mark the start of the session.
Minor code cleanup.
It does not support overnight levels for stocks. In fact, for this study to work properly, the 'Extended Hours' option under the chart's symbol setting MUST be turned off. This it not something I can fix, sorry.
Session breaks are turned off by default for stocks, as they end up printing right next to each other when overnight data is turned off. This can be controlled by a flag in the study's settings.
This addition exposed the reason why I needed the bug offset, and I was able to remove the input setting for it.
Time frame needs to be: 30 min, 15 min, 5 min, 1 min
*As noted before, this tool will break when data is missing. This is seen more often on 1 min time frames, depending on your data feed.
When viewing stocks, the setting 'Extended Hours' needs to be turned off.
If these conditions are not met, the levels will not be drawn, all values will be n/a.