OPEN-SOURCE SCRIPT

Run-Length Base Rate Gauge [BSL]

186
Five closes up in a row. Is five a lot?

The usual answer is an adjective: extended, stretched, due. Run-Length Base
Rate Gauge [BSL] answers with a count instead:

RUN OF 5 OR LONGER · n=41 BEFORE THIS ONE · 19/41 EXTENDED · 46.3%

Forty-one runs on this chart reached five before this one. Nineteen of them
went to six. That is the whole product: two lines, one table, no direction and
no signal.

THE RUN IN FRONT OF YOU IS NOT IN THE 41

This is the part that makes the number worth reading, so it is worth being
precise about.

The denominator counts runs that have ALREADY STOPPED. The run currently
underway is held as PENDING and counted nowhere: not as a success it has not
earned, and not as a failure that has not happened. It has not yet had the
chance to end.

The alternative is more tempting than it looks, and worse than it looks. A run
of eight in progress has already been a run of one, two, three, and so on up
to eight. Credit it to all eight denominators and you have added one
observation to rows whose totals differ enormously: a row with 400 prior runs
barely moves, while a row with 3 lurches. The output looks exactly like a real
effect of run length, long runs behaving differently from short ones, and it
is entirely an artefact of counting an unfinished thing.

No row would be looking into the future. The defect would live in the
comparison between rows, which is where the usual checks do not look.

The fix here is stronger than adjusting for it. A run enters the counters only
on the bar it STOPS on, so every length it passed through resolves at the same
instant. The delay is one bar, and it is one bar for every run length in the
table, so all sixty rows share a single cutoff by construction rather than by
correction.

WHEN THE PERCENTAGE DISAPPEARS

Below ten prior runs there is no percentage. The bare fraction is shown
instead, with a note that the rate is being held back.

The panel goes further: its transparency is a step function of the sample
size. A rate resting on four runs is drawn faintly. A rate resting on four
hundred is drawn solid. You cannot read the number without also reading how
much is behind it, and no percentage ever appears without the count it came
from.

THE EDGES, AND WHAT HAPPENS AT THEM

A run longer than sixty bars is read at row sixty, and the panel says so
rather than clipping in silence.

An unchanged close ends a run and starts none. The headline reads NO RUN.

While the bar is still open the headline is prefixed FORMING and drawn
faintly. A table cell in Pine cannot have a dashed border, so an unconfirmed
reading is marked with transparency and a word, and the word is doing real
work, not decorating.

TWO NUMBERS THAT LOOK ALIKE AND ARE NOT

The panel always reports the rate at the run length in front of you. That
length changes bar to bar, which is right for something you read.

The value published for other scripts uses a FIXED threshold you set once.
That is right for something that gets measured, and the two are deliberately
kept apart: a series whose definition moved with the live run length would not
be one event, and anything measuring it would be measuring a different
population on every bar.

THE TWO SETTINGS

- Exported threshold: 5 bars in a row
- Panel position: Bottom center

Pick any of six positions. The gauge starts at the bottom center, the one strip
the platform is not already using for the legend, the trading buttons, its own
logo or the price scale.

A RUN OF AVERAGES IS NOT A RUN

A run of Heikin Ashi closes is a run of averages, and a base rate taken over
it describes the averaging rather than the market. Renko, Kagi, Point & Figure
and Range have the same problem for their own reasons.

On those chart types the gauge freezes and publishes nothing.

THE ONE PUBLISHED VALUE

One value is published for other indicators to pick up in their Source
setting: the outcome of the fixed-threshold trial. Before a trial resolves it
carries no value at all, which is not the same as a trial that resolved as
zero.

Two alert conditions share that dropdown and are not values. The gauge draws
nothing else, so there is nothing else to connect to.

WHAT THE GAUGE REFUSES TO PRINT

No verdict. Not "unusual", not "overextended", not "due for a reversal".

No percentage below ten prior runs. No count that includes the run in
progress. No confidence interval, no significance test, no p-value. The sample
size is printed and you weigh it yourself.

No colour coding by outcome. The headline is green on an up run and red on a
down run because that is the run's DIRECTION, and for no other reason; the
strip below it is one neutral colour whose transparency carries the sample
size.

WHAT IT WILL NOT TELL YOU

It measures one thing at a horizon of one bar: whether the next bar closed the
same way. It has no forward return at longer horizons, no excursion figures,
no regime splits and no cost sensitivity. Those belong to Signal Audit Lab
[BSL], and this gauge is a producer feeding into it.

It does not report a mean or expected run length, and it draws no
distribution. It contains no entry, exit, stop or position size, and it
asserts no direction: a run of eight is reported as a run of eight.

This tool reports historical base rates with their denominators. 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.

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.