OPEN-SOURCE SCRIPT
Updated Overnight vs Intraday Return Split

Overnight vs Intraday Return Split
Overnight vs Intraday Return Split is a return-decomposition indicator that separates daily stock returns into close-to-open gap return and open-to-close session return.
The indicator separates cumulative return into two components:
1. Overnight return
Previous close to current open.
2. Intraday return
Current open to current close.
It also plots a Total cumulative return line for comparison.
This is a context and diagnostic tool. It is not a buy/sell indicator, not a strategy, and not a prediction model.
1. Core Idea
Many stocks do not move equally during the close-to-open window and the regular open-to-close session.
Some names may generate a large part of their historical return from gaps between the previous close and the next open. Other names may show stronger contribution from the regular trading session between open and close.
This indicator helps visualize that split by compounding the close-to-open and open-to-close components separately.
2. Important Calculation Note
This script does not separately calculate each pre-market candle or each after-hours candle.
The Overnight component represents the close-to-open gap:
Previous close → current open
The Intraday component represents the open-to-close session move:
Current open → current close
By default, the script uses daily bars internally, so it should be understood as a daily close-to-open versus open-to-close return decomposition, not a detailed extended-hours session breakdown.
3. What the Lines Mean
The indicator plots up to three lines:
* Overnight cumulative %
Shows the compounded contribution from previous close to current open.
* Intraday cumulative %
Shows the compounded contribution from current open to current close.
* Total cumulative %
Shows the compounded full-period return.
The Total line is included as a reference to compare the two return components with the overall buy-and-hold style return.
4. Important Compounding Note
The Total line is compounded from log returns.
It should not be read as:
Overnight % + Intraday %
The overnight and intraday lines are compounded separately, so the visual relationship between the lines should be interpreted as a return-contribution comparison rather than a simple arithmetic sum.
5. Daily-Bar Calculation
By default, the script uses daily bars internally for the calculation.
This is intentional.
Using daily bars keeps the meaning of the close-to-open and open-to-close split consistent, even if the chart is opened on another timeframe such as 1H, 4H, or 1W.
Users can switch to Chart timeframe mode from the settings, but Daily bars is the recommended calculation source for the cleanest interpretation of the split.
6. Standard OHLC Option
The script includes an option to use standard candles for calculation.
When enabled, the calculation uses the symbol’s standard OHLC data.
This helps avoid distorted return calculations on synthetic chart types such as Heikin Ashi.
7. Optional Start Date Reset
Users can reset the cumulative comparison from a selected start date.
When this setting is enabled, the cumulative Overnight, Intraday, and Total lines restart from 0 at the chosen date.
This can be useful when studying a specific market regime, post-earnings period, IPO phase, trend phase, or custom research window.
8. Readout Label
The last-bar readout label summarizes:
* Calculation source
* Overnight cumulative return
* Intraday cumulative return
* Total cumulative return
* Which component is leading
* Latest bar overnight return
* Latest bar intraday return
* Latest bar total return
The label also includes warnings when the selected mode or market type may reduce the conceptual reliability of the split.
9. Best Markets
This indicator is best used on instruments with a real daily open and close, such as:
* Stocks
* ETFs
* Stock indices
* Session-based markets
It is generally not suitable for 24/7 markets such as crypto, because the concept of a true close-to-open gap is not the same in continuously traded markets.
10. How to Use
A practical workflow:
1. Add the indicator to a stock or ETF chart.
2. Keep Calculation source set to Daily bars.
3. Compare the Overnight and Intraday cumulative lines.
4. Watch which line contributes more to the Total return.
5. Use the readout label to identify the current leader.
6. Review whether the stock’s return profile is mostly gap-driven or session-driven.
7. Use the information as context alongside trend, volatility, volume, earnings, and broader market conditions.
8. Interpretation Examples
If the Overnight line is far above the Intraday line, the stock’s historical return during the selected period came mostly from close-to-open gaps.
If the Intraday line is far above the Overnight line, the stock’s historical return during the selected period came mostly from open-to-close session movement.
If one component is strongly positive while the other is negative, the stock may have a meaningful timing split between gap behavior and regular-session behavior.
These observations are analytical context only. They are not automatic trade signals.
12. Alerts
The script includes alert conditions for:
* Overnight cumulative return crossing above Intraday cumulative return
* Overnight cumulative return crossing below Intraday cumulative return
Alerts are informational only. They do not confirm future performance and do not execute trades.
13. Limitations
This indicator does not predict future returns.
It does not identify entries or exits.
It does not measure true order flow.
It does not separately calculate pre-market candles.
It does not separately calculate after-hours candles.
It does not include commissions, slippage, dividends, borrow costs, or tax effects.
It can behave differently around corporate actions, symbol adjustments, extended-hours data treatment, or unusual session structures.
It is less meaningful on markets that trade continuously without a true close-to-open gap.
14. Educational Disclaimer
This script is for educational and chart-analysis purposes only. It is not financial advice, investment advice, or a recommendation to buy or sell any financial instrument. Users are responsible for their own analysis, risk management, and trading decisions.
Overnight vs Intraday Return Split is a return-decomposition indicator that separates daily stock returns into close-to-open gap return and open-to-close session return.
The indicator separates cumulative return into two components:
1. Overnight return
Previous close to current open.
2. Intraday return
Current open to current close.
It also plots a Total cumulative return line for comparison.
This is a context and diagnostic tool. It is not a buy/sell indicator, not a strategy, and not a prediction model.
1. Core Idea
Many stocks do not move equally during the close-to-open window and the regular open-to-close session.
Some names may generate a large part of their historical return from gaps between the previous close and the next open. Other names may show stronger contribution from the regular trading session between open and close.
This indicator helps visualize that split by compounding the close-to-open and open-to-close components separately.
2. Important Calculation Note
This script does not separately calculate each pre-market candle or each after-hours candle.
The Overnight component represents the close-to-open gap:
Previous close → current open
The Intraday component represents the open-to-close session move:
Current open → current close
By default, the script uses daily bars internally, so it should be understood as a daily close-to-open versus open-to-close return decomposition, not a detailed extended-hours session breakdown.
3. What the Lines Mean
The indicator plots up to three lines:
* Overnight cumulative %
Shows the compounded contribution from previous close to current open.
* Intraday cumulative %
Shows the compounded contribution from current open to current close.
* Total cumulative %
Shows the compounded full-period return.
The Total line is included as a reference to compare the two return components with the overall buy-and-hold style return.
4. Important Compounding Note
The Total line is compounded from log returns.
It should not be read as:
Overnight % + Intraday %
The overnight and intraday lines are compounded separately, so the visual relationship between the lines should be interpreted as a return-contribution comparison rather than a simple arithmetic sum.
5. Daily-Bar Calculation
By default, the script uses daily bars internally for the calculation.
This is intentional.
Using daily bars keeps the meaning of the close-to-open and open-to-close split consistent, even if the chart is opened on another timeframe such as 1H, 4H, or 1W.
Users can switch to Chart timeframe mode from the settings, but Daily bars is the recommended calculation source for the cleanest interpretation of the split.
6. Standard OHLC Option
The script includes an option to use standard candles for calculation.
When enabled, the calculation uses the symbol’s standard OHLC data.
This helps avoid distorted return calculations on synthetic chart types such as Heikin Ashi.
7. Optional Start Date Reset
Users can reset the cumulative comparison from a selected start date.
When this setting is enabled, the cumulative Overnight, Intraday, and Total lines restart from 0 at the chosen date.
This can be useful when studying a specific market regime, post-earnings period, IPO phase, trend phase, or custom research window.
8. Readout Label
The last-bar readout label summarizes:
* Calculation source
* Overnight cumulative return
* Intraday cumulative return
* Total cumulative return
* Which component is leading
* Latest bar overnight return
* Latest bar intraday return
* Latest bar total return
The label also includes warnings when the selected mode or market type may reduce the conceptual reliability of the split.
9. Best Markets
This indicator is best used on instruments with a real daily open and close, such as:
* Stocks
* ETFs
* Stock indices
* Session-based markets
It is generally not suitable for 24/7 markets such as crypto, because the concept of a true close-to-open gap is not the same in continuously traded markets.
10. How to Use
A practical workflow:
1. Add the indicator to a stock or ETF chart.
2. Keep Calculation source set to Daily bars.
3. Compare the Overnight and Intraday cumulative lines.
4. Watch which line contributes more to the Total return.
5. Use the readout label to identify the current leader.
6. Review whether the stock’s return profile is mostly gap-driven or session-driven.
7. Use the information as context alongside trend, volatility, volume, earnings, and broader market conditions.
8. Interpretation Examples
If the Overnight line is far above the Intraday line, the stock’s historical return during the selected period came mostly from close-to-open gaps.
If the Intraday line is far above the Overnight line, the stock’s historical return during the selected period came mostly from open-to-close session movement.
If one component is strongly positive while the other is negative, the stock may have a meaningful timing split between gap behavior and regular-session behavior.
These observations are analytical context only. They are not automatic trade signals.
12. Alerts
The script includes alert conditions for:
* Overnight cumulative return crossing above Intraday cumulative return
* Overnight cumulative return crossing below Intraday cumulative return
Alerts are informational only. They do not confirm future performance and do not execute trades.
13. Limitations
This indicator does not predict future returns.
It does not identify entries or exits.
It does not measure true order flow.
It does not separately calculate pre-market candles.
It does not separately calculate after-hours candles.
It does not include commissions, slippage, dividends, borrow costs, or tax effects.
It can behave differently around corporate actions, symbol adjustments, extended-hours data treatment, or unusual session structures.
It is less meaningful on markets that trade continuously without a true close-to-open gap.
14. Educational Disclaimer
This script is for educational and chart-analysis purposes only. It is not financial advice, investment advice, or a recommendation to buy or sell any financial instrument. Users are responsible for their own analysis, risk management, and trading decisions.
Release Notes
Update NotesThis update improves the explanatory wording for the Total line.
The Total line tooltip was updated to clarify that Total represents the compounded full-day return from the Overnight and Intraday components. It is not a simple ON + ID percentage sum.
The last-bar readout note was also updated for consistency:
“Total is compounded from ON and ID returns, not a simple percentage sum.”
No calculation logic was changed in this update. This is a wording and clarity update only.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
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.