OPEN-SOURCE SCRIPT
Trade Session Tracker [theUltimator5]

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:
There are two plot modes:
!IMPORTANT!
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

Here is an example of overnight returns

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:
- Intraday (Market open to market close)
- After Hours (Market close until 20:00 eastern)
- Overnight (20:00 eastern through 04:00 eastern the next day)
- Pre-market (04:00 eastern through market open)
- 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
Here is an example of overnight returns
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.