OPEN-SOURCE SCRIPT
Session Gap Board [BSL]

Session Gap Board [BSL] tracks the holes this market leaves at its session
opens: which ones are still open, and for how long.
A session gap is the distance between a settled close and the next session's
open. It is not a fair-value gap. That is a three-bar intrabar imbalance and a
different object, tracked by other tools. Mixing the two would make both
counts meaningless, so this board tracks only session gaps.
Every gap is an object on the chart with a state you can read without any
text. A gap still open is a hollow box with a dashed border, extended to the
right. A gap that closed is a shaded box with a solid border, its right edge
fixed at the bar that closed it. Optional age labels read "17 sessions open"
or "closed after 3 bars". They start hidden because nearby gaps can otherwise
produce overlapping labels. Enable them in Age labels when needed.
THE NUMBER THAT IS NOT HERE
There is no fill percentage on this board. Not in the panel, not on a label,
not in a tooltip. That absence is the product, so here is the reasoning in
full.
A gap has two possible endings and, while it is open, neither has happened. A
closed gap is a finished observation. An open gap is an unfinished one: the
only true thing to say about it is "not yet".
Any percentage has to put the unfinished ones somewhere, and every available
choice distorts the answer in a direction you can name in advance:
- Count them as failures: closed divided by all gaps. Every unfinished
observation becomes a zero, so the figure is dragged down, and it moves on
every bar for reasons that have nothing to do with the market.
- Drop them: closed divided by gaps whose ending is known. This reads 100%
whenever every finished gap happens to have closed, which is common and
meaningless.
- Cut by age: closed divided by gaps older than some threshold. This changes
which gaps are being counted, and depends on a number nobody printed.
There is a further problem with the first choice. The set of gaps still open
is not a random sample of gaps. It is the set that has survived, and survival
is exactly what is being measured. A percentage built on it is measuring its
own selection.
So the board publishes counts and never a rate. Filled. Still open. Retired at
the cap. No hole. Sessions observed. They are tied by an identity you can
check on the panel rather than by a division:
sessions observed = no hole + filled + still open + retired at the cap
If you do want a rate, it comes from somewhere else. Eligible-Window Curtain
[BSL] aligns unequal exposure at a common cutoff before anything is divided,
and this board names it on the chart so you know the number exists and why it
is not here.
WHAT COUNTS AS WHAT
A session that opens exactly at the prior settled close leaves no hole. It is
counted as NO HOLE and never as a fill, because nothing was ever open.
An X marks the bar that closed a gap: below the bar for a closed up gap, above
for a closed down gap. A bar that closes gaps on both sides shows both marks,
which is the honest picture rather than a choice between them.
A close still forming on the open bar is drawn as a CIRCLE, not a faded X. A
lighter X would say "the same thing, weaker". The true statement is "a
different thing, not yet confirmed", and a different shape says that.
YOUNGER GAPS ARE MARKED, NOT REMOVED
A gap that opened three sessions ago has had three sessions in which to close.
A gap from last year has had a year. Comparing them without saying so would be
unfair to the young one.
So a still-open gap younger than the maturity horizon is drawn with a fainter
border and a dimmed label. It is not filtered and not removed from any count.
The panel prints "younger than the horizon: 3 of 6 still open", two counts
side by side, no quotient. The marking says it has had less opportunity. It
says nothing about whether it will close.
THE CAP LIMITS THE DRAWING, NEVER THE COUNTING
Counters accumulate over the whole loaded history and are never decremented.
The drawing is capped, because boxes and labels are a finite resource. When a
new gap arrives and every slot is taken, the oldest ALREADY-CLOSED gap gives
up its box first: it has contributed everything it ever will, and nothing
moves in the counts.
Only when every slot holds a still-open gap does an unfinished one lose its
box. That is a real loss of information, so it gets its own counted row,
RETIRED AT THE CAP, and stays inside sessions observed rather than vanishing.
SETTINGS, AND WHAT THEY DO NOT CHANGE
- Tracked gaps, cap: 40
- Maturity horizon: 20 sessions
- Age labels: none
- Mark the bar that closed a gap: on
- Panel detail: Compact
- Panel position: Bottom center
The board offers six positions and starts at the bottom center. It is a wide
panel, the right-hand side is already busy with the price scale, and the
bottom-left corner has the TradingView logo in it, which would sit on top of the
first cell.
None of the display settings changes a count.
ON SYNTHETIC CHARTS IT STOPS
Heikin Ashi, Renko, Kagi, Point & Figure and Range charts do not draw the
market's own bars; they draw a construction from them. A gap between two
constructed prices is not a hole the market left. So on those chart types the
boxes, labels, marks and exported data are switched off and the table
collapses to one row naming the chart type. Switch to standard candles and the
board returns.
TWO EVENTS AND TWO STATES
Four series are published for other indicators to pick up in their Source
setting.
Two of them are EVENTS: a gap opening and a gap closing. Each is +1 on the bar
an up-side event happens, -1 for the down side, and 0 between events. Both are
shaped for Signal Audit Lab [BSL], where a still-open gap is carried as an
unfinished observation rather than as a blank.
Two of them are STATES, not events: whether the bar is a session boundary, and
whether both sides filled together. A state sits at 1 for as long as the
condition holds. Anything that reads events will treat the moment it turns
from 0 to 1 as an entry that nobody signalled. These two are for reading, not
for connecting to an event input.
All four carry no value at all before the board has an opinion, which is not
the same as a value of zero. When both sides of a session fill on the same
bar, the event series carries 0 and the two-sided state carries 1, so the
collision stays visible instead of being silently resolved one way.
The dropdown will also list the marks the board draws on closing bars, and its
four alert conditions. The marks are turned off by a display box, and a
switched-off mark hands a reader a steady 0 while carrying a name that reads
like an event. Take the four named here.
WHAT THE BOARD WILL NOT TELL YOU
It says nothing about what a still-open gap will do next. It does not rank
gaps, does not shade them by size, and does not suggest that age makes closure
more or less likely. There is no projection, no target and no "gap fill zone".
There is no entry, exit or stop anywhere in it, because it is a status board
and not a method.
This tool reports the state of session gaps as counts. It does not predict
price, guarantee performance or provide trading advice. Validate the behaviour
on your own symbols, timeframes and execution assumptions before making
decisions.
Open-source Pine Script® v6. Educational use only.
opens: which ones are still open, and for how long.
A session gap is the distance between a settled close and the next session's
open. It is not a fair-value gap. That is a three-bar intrabar imbalance and a
different object, tracked by other tools. Mixing the two would make both
counts meaningless, so this board tracks only session gaps.
Every gap is an object on the chart with a state you can read without any
text. A gap still open is a hollow box with a dashed border, extended to the
right. A gap that closed is a shaded box with a solid border, its right edge
fixed at the bar that closed it. Optional age labels read "17 sessions open"
or "closed after 3 bars". They start hidden because nearby gaps can otherwise
produce overlapping labels. Enable them in Age labels when needed.
THE NUMBER THAT IS NOT HERE
There is no fill percentage on this board. Not in the panel, not on a label,
not in a tooltip. That absence is the product, so here is the reasoning in
full.
A gap has two possible endings and, while it is open, neither has happened. A
closed gap is a finished observation. An open gap is an unfinished one: the
only true thing to say about it is "not yet".
Any percentage has to put the unfinished ones somewhere, and every available
choice distorts the answer in a direction you can name in advance:
- Count them as failures: closed divided by all gaps. Every unfinished
observation becomes a zero, so the figure is dragged down, and it moves on
every bar for reasons that have nothing to do with the market.
- Drop them: closed divided by gaps whose ending is known. This reads 100%
whenever every finished gap happens to have closed, which is common and
meaningless.
- Cut by age: closed divided by gaps older than some threshold. This changes
which gaps are being counted, and depends on a number nobody printed.
There is a further problem with the first choice. The set of gaps still open
is not a random sample of gaps. It is the set that has survived, and survival
is exactly what is being measured. A percentage built on it is measuring its
own selection.
So the board publishes counts and never a rate. Filled. Still open. Retired at
the cap. No hole. Sessions observed. They are tied by an identity you can
check on the panel rather than by a division:
sessions observed = no hole + filled + still open + retired at the cap
If you do want a rate, it comes from somewhere else. Eligible-Window Curtain
[BSL] aligns unequal exposure at a common cutoff before anything is divided,
and this board names it on the chart so you know the number exists and why it
is not here.
WHAT COUNTS AS WHAT
A session that opens exactly at the prior settled close leaves no hole. It is
counted as NO HOLE and never as a fill, because nothing was ever open.
An X marks the bar that closed a gap: below the bar for a closed up gap, above
for a closed down gap. A bar that closes gaps on both sides shows both marks,
which is the honest picture rather than a choice between them.
A close still forming on the open bar is drawn as a CIRCLE, not a faded X. A
lighter X would say "the same thing, weaker". The true statement is "a
different thing, not yet confirmed", and a different shape says that.
YOUNGER GAPS ARE MARKED, NOT REMOVED
A gap that opened three sessions ago has had three sessions in which to close.
A gap from last year has had a year. Comparing them without saying so would be
unfair to the young one.
So a still-open gap younger than the maturity horizon is drawn with a fainter
border and a dimmed label. It is not filtered and not removed from any count.
The panel prints "younger than the horizon: 3 of 6 still open", two counts
side by side, no quotient. The marking says it has had less opportunity. It
says nothing about whether it will close.
THE CAP LIMITS THE DRAWING, NEVER THE COUNTING
Counters accumulate over the whole loaded history and are never decremented.
The drawing is capped, because boxes and labels are a finite resource. When a
new gap arrives and every slot is taken, the oldest ALREADY-CLOSED gap gives
up its box first: it has contributed everything it ever will, and nothing
moves in the counts.
Only when every slot holds a still-open gap does an unfinished one lose its
box. That is a real loss of information, so it gets its own counted row,
RETIRED AT THE CAP, and stays inside sessions observed rather than vanishing.
SETTINGS, AND WHAT THEY DO NOT CHANGE
- Tracked gaps, cap: 40
- Maturity horizon: 20 sessions
- Age labels: none
- Mark the bar that closed a gap: on
- Panel detail: Compact
- Panel position: Bottom center
The board offers six positions and starts at the bottom center. It is a wide
panel, the right-hand side is already busy with the price scale, and the
bottom-left corner has the TradingView logo in it, which would sit on top of the
first cell.
None of the display settings changes a count.
ON SYNTHETIC CHARTS IT STOPS
Heikin Ashi, Renko, Kagi, Point & Figure and Range charts do not draw the
market's own bars; they draw a construction from them. A gap between two
constructed prices is not a hole the market left. So on those chart types the
boxes, labels, marks and exported data are switched off and the table
collapses to one row naming the chart type. Switch to standard candles and the
board returns.
TWO EVENTS AND TWO STATES
Four series are published for other indicators to pick up in their Source
setting.
Two of them are EVENTS: a gap opening and a gap closing. Each is +1 on the bar
an up-side event happens, -1 for the down side, and 0 between events. Both are
shaped for Signal Audit Lab [BSL], where a still-open gap is carried as an
unfinished observation rather than as a blank.
Two of them are STATES, not events: whether the bar is a session boundary, and
whether both sides filled together. A state sits at 1 for as long as the
condition holds. Anything that reads events will treat the moment it turns
from 0 to 1 as an entry that nobody signalled. These two are for reading, not
for connecting to an event input.
All four carry no value at all before the board has an opinion, which is not
the same as a value of zero. When both sides of a session fill on the same
bar, the event series carries 0 and the two-sided state carries 1, so the
collision stays visible instead of being silently resolved one way.
The dropdown will also list the marks the board draws on closing bars, and its
four alert conditions. The marks are turned off by a display box, and a
switched-off mark hands a reader a steady 0 while carrying a name that reads
like an event. Take the four named here.
WHAT THE BOARD WILL NOT TELL YOU
It says nothing about what a still-open gap will do next. It does not rank
gaps, does not shade them by size, and does not suggest that age makes closure
more or less likely. There is no projection, no target and no "gap fill zone".
There is no entry, exit or stop anywhere in it, because it is a status board
and not a method.
This tool reports the state of session gaps as counts. It does not predict
price, guarantee performance or provide trading advice. Validate the behaviour
on your own symbols, timeframes and execution assumptions before making
decisions.
Open-source Pine Script® v6. Educational use only.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.