USA Session

The USA session (9:30am to 4:00pm) is the most volatile session during market hours. Because of this, previous day OHLC values during that time frame are important to stock traders. For future traders, these and the overnight high/low are important. This indicator overlays the open, previous day open, previous day close, previous day high and previous day low (of the USA session) onto most stock chart. And for most future charts, this indicator will also plot the overnight high and low.

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.

Knows issues
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 futures 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!
Release Notes: This study now has a short title. Makes the value labels a little bit shorter.
Release Notes: The 3:10pm to 3:25 bug fix is now only applied to the ES1! , NQ!!, YM1! , and RTY1! as these are the only future assets where I am missing bars. CL1! , GC1! , and other futures are not missing those bars, so the fix is not applied to them.

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.
Release Notes: Now the levels actually start at 9:30am (instead of 10:30am) like its supposed and ends at 4:00pm. Trading view's time stamp must be off by an hour, it has nothing to do the configured time zone. In order to use trading view's built in timestamp method to find the start of the session, I now use 8:30 instead of 9:30. I have no idea why this is, but not its working as intended.

Added vertical line to mark the start of the session.

Minor code cleanup.
Release Notes: Added shorter names and cleaned up a lot of the code to improve efficiency.
Release Notes: This study now works with stocks!
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.
Release Notes: Levels will no longer be drawn if the chart is not set up properly.

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.
Release Notes: Updated chart being displayed to better reflect recent changes.
Release Notes: Same as last update, just updating the example chart. But this time I removed extra drawings that were supposed to be hidden but I guess get shown anyway when published...
Protected script
This script is published closed-source and you may use it freely. You can favorite it to use it on a chart. You cannot view or modify its source code.
Want to use this script on a chart?