OPEN-SOURCE SCRIPT

Trade Session Tracker [theUltimator5]

133
Trade Session Tracker is a unique indicator designed to isolate each discrete trading session on the US stock exchanges and display a cumulative running price for each session so you can visualize how each session performs over long periods of time.

This indicator allows you to unlock a potentially unique and powerful trading strategy that exploits returns during lower liquidity periods through trend analysis. Certain stocks tend to move in the same direction during specific windows in the day, and now you can find them yourself.

This indicator only works properly on the daily timeframe. Other timeframes are not supported.

The sessions that this indicator supports are:
  1. Intraday (Market open to market close)
  2. After Hours (Market close until 20:00 eastern)
  3. Overnight (20:00 eastern through 04:00 eastern the next day)
  4. Pre-market (04:00 eastern through market open)
  5. Close-to-open (market close to the following market open)


There are two plot modes:
  • Cumulative — chained returns since chart start (synthetic continuous price line)
  • Daily Change — single-session return (refreshes each new trading day)


!IMPORTANT!
  • This indicator only supports symbols that trade on the overnight markets through the BOATS ATS. This includes hundreds of ticker symbols, but the majority of smaller cap stocks or non-equity symbols are not supported.
  • Some symbols offer dividends, and the "ADJ" button at the bottom right corner of the chart must be disabled for the data to display properly, or else you will get extremely skewed results. Notorious symbols for this are SPY and AAPL.


How it works:
Standard chart data only calculates sessions through open, close, and previous close and cannot isolate out pre-market and after hours price action.
With the addition of overnight data, we now have a separate set of open and close values which can be pulled.
To calculate after hours price action, we use the opening price of the overnight venue divided by the close price earlier that day.
To calculate the pre-market price action, we divide the open price by the previous overnight close price.
Overnight price is simply calculated by overnight close divided by overnight open.

There is a table that can be toggled off and repositioned that shows the current settings.

Here is an example of close-to-open and intraday
snapshot

Here is an example of overnight returns
snapshot

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.