OPEN-SOURCE SCRIPT
Session Profitability Visualizer

What it shows
Session Profitability Visualizer breaks the trading day into its 24 hours and shows, for each hour, how price has historically behaved on your chart. It answers a simple statistical question: "When this market trades at 09:00 vs. 14:00 vs. 20:00, how have bars in that hour tended to move?"
For every hour with enough data it displays a table with:
- Hour — the hour-of-day bucket (00:00–23:00) in the symbol's exchange timezone
- Cum move — the cumulative close-minus-open of all completed bars in that hour (in points, or in % if you select the percent metric)
- Bars — how many completed bars contributed to that bucket (the sample size)
- % Pos — the share of those bars that closed above their open
Rows are tinted green or red by the sign of the cumulative move, with color intensity scaled by magnitude relative to the strongest hour, so the "heavier" hours stand out at a glance. An optional (off by default) background shading tints the chart by the historical statistics of the hour the current bar belongs to.
How it works
On every completed intraday bar inside the lookback window, the script:
1. Determines the bar's hour of day using the symbol's exchange timezone (syminfo.timezone).
2. Computes the bar's move — either close − open in points, or (close − open) / open × 100 in percent, depending on the Metric input.
3. Adds that move to the hour's running sum, increments the hour's bar count, and increments a positive-bar counter when the move is positive.
The per-hour sums, counts, and positive counts are held in three 24-element arrays. The table is rendered once on the last bar from those arrays. There is no request.security() call, no reference to future data, and only confirmed bars are counted — the statistics do not repaint on historical data (the live, still-forming bar is excluded until it closes).
Inputs
- Lookback (bars) — how many recent bars feed the statistics (default 5000). Larger windows are more stable; smaller windows react faster to regime changes.
- Metric — Points (close − open) or Percent (bar return %). Percent is more comparable across price levels and long histories.
- Min samples per hour — hours with fewer completed bars than this are hidden (default 30), so thin buckets don't masquerade as meaningful.
- Table position — where the table sits on the chart.
- Shade background — optional tint of the current bar's hour by its historical stats (off by default).
How to use it
Apply it to any intraday chart (15m or 1h are good starting points — on a 15m chart each hour bucket gets four bars per session). Look for hours where the cumulative move and the % positive rate agree and the sample count is healthy; those are the hours where the market has shown a persistent directional lean on your symbol. Compare the same symbol on different lookbacks to see whether the pattern is stable or an artifact of one period.
Limitations — please read
- Hour buckets use the symbol's exchange timezone, not your chart's display timezone. A "09:00" row on NASDAQ symbols means 09:00 America/New_York regardless of your local clock.
- Bar close-minus-open is a directional proxy, not trade P&L. It ignores spreads, slippage, position sizing, and intrabar path.
- The statistics are a historical observation, not a prediction. An hour that has drifted up for 5000 bars can stop doing so at any time; sample sizes shrink quickly on higher intraday timeframes.
- The script is intraday-only by design; on daily and above it shows an explanatory message instead of statistics.
This is a statistical visualization tool. It does not generate signals or recommendations of any kind.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Willow the Trader — Technical Trading Academy (techacademies.org)
Market scanner: pulse-board.net
Backtest analyzer: datavizstudio.net
Market scanner: pulse-board.net
Backtest analyzer: datavizstudio.net
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Willow the Trader — Technical Trading Academy (techacademies.org)
Market scanner: pulse-board.net
Backtest analyzer: datavizstudio.net
Market scanner: pulse-board.net
Backtest analyzer: datavizstudio.net
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.