OPEN-SOURCE SCRIPT
Cumulative Histogram Tick

This script is designed to create a cumulative histogram based on tick data from a specific financial instrument. The histogram resets at the start of each trading session, which is defined by a fixed time.
Key Components:
Tick Data Retrieval:
Session Start and End Detection:
Cumulative Value Management:
Histogram Visualization:
Usage
This script is useful for analyzing intraday market activity by visualizing the accumulation of tick data over a trading session. It helps traders identify trends or patterns within each session, which can be valuable for making informed trading decisions.
Key Components:
Tick Data Retrieval:
- The script fetches the closing tick values from the specified instrument using request.security("TICK.NY", timeframe.period, close). This line ensures that the script works with the tick data for each bar on the chart.
Session Start and End Detection:
- Start Hour: The script checks if the current bar's time is 9:30 AM (hour == 9 and minute == 30). This is used to reset the cumulative value at the beginning of each trading session.
- End Hour: It also checks if the current bar's time is 4:00 PM (hour == 16). However, this condition is used to prevent further accumulation after the session ends.
Cumulative Value Management:
- Reset: When the start hour condition is met (startHour), the cumulative value (cumulative) is reset to zero. This ensures that each trading session starts with a clean slate.
- Accumulation: For all bars that are not at the end hour (not endHour), the tick value is added to the cumulative total. This process continues until the end of the trading session.
Histogram Visualization:
- The cumulative value is plotted as a histogram using plot.style_histogram. The color of the histogram changes based on whether the cumulative value is positive (green) or negative (red).
Usage
This script is useful for analyzing intraday market activity by visualizing the accumulation of tick data over a trading session. It helps traders identify trends or patterns within each session, which can be valuable for making informed trading decisions.
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.