OPEN-SOURCE SCRIPT
Actualizado Signal Audit Lab [BSL]

Signal Audit Lab measures what happens after numeric events emitted by another
indicator. Connect one external plot, define how its values become long and
short events, and inspect the resulting sample on the current symbol and
timeframe.
This is a measurement tool. It does not generate signals, simulate orders, or
claim that an observed event has a trading edge.
HOW IT WORKS
The script reads one numeric `input.source()` series. Four decoders are
available:
- Signed pulse: positive and negative event pulses such as +1 / 0 / -1.
- Threshold cross: crossings above the long level or below the short level.
- Long-only edge: the first qualifying long value after a non-qualifying value.
- Short-only edge: the equivalent short-only rule.
Events are committed only on confirmed bars. Held values are deduplicated into
one edge. Optional cooldown and conflict rules make rejected events explicit.
An `na` transition cannot create an accidental first event without a prior
valid observation.
MEASUREMENT
The event-bar close is the anchor. Direction-adjusted forward returns are
measured after 1, 3, 5, 10 and 20 bars by default. Each horizon has its own
completed and pending sample count, so unfinished observations never enter the
denominator.
The round-trip cost input subtracts a user-defined basis-point amount from each
completed return. It is a sensitivity adjustment, not a fill, spread, slippage,
or execution model.
The panel reports:
- completed and pending observations;
- mean raw and cost-adjusted directional return;
- hit rate, return dispersion, and a Wilson 95% interval;
- separate aggregate, long, and short results;
- mean favorable and adverse excursion at the longest horizon;
- a payoff proxy based on mean positive versus mean negative net outcomes;
- longest-horizon session and normalized-ATR volatility splits;
- accepted long/short counts, cooldown rejects, conflicts, `na` skips, and
configuration status.
Samples below 30 observations are highlighted. Compact mode keeps aggregate
horizons, excursion/payoff, and diagnostics readable on narrow charts. Full
mode adds directional detail, raw-to-net values, Wilson intervals, dispersion,
and the split tables.
SESSION AND VOLATILITY SPLITS
The session split classifies the event bar using the selected session and
timezone. The defaults are 09:30–16:00, Monday–Friday, America/New_York.
Volatility is normalized ATR (`ATR / close`) compared with its moving-average
baseline. Defaults are ATR 14 and baseline 100. LOW is below 0.8 times the
baseline, HIGH is above 1.2 times the baseline, and values between those
boundaries are MID. Events before the baseline is available are UNCLASSIFIED.
The exact settings remain visible in Full mode.
SETUP
1. Add an indicator that exposes a numeric plot. TradingView strategies cannot
provide an external source plot.
2. Add Signal Audit Lab and select that plot under Event source.
3. Choose the decoder and levels that match the producer's numeric contract.
4. Enter a clear source label, then set horizons, cost sensitivity, session,
and volatility boundaries.
5. Read the sample count and diagnostics before interpreting percentages.
For a continuous oscillator such as RSI, Threshold cross is the natural
decoder. For a producer that exposes +1 / 0 / -1 pulses, use Signed pulse.
OUTPUTS AND ALERTS
Optional chart markers show accepted confirmed events. A hidden +1 / 0 / -1
plot is available for inspection or data export. Alert conditions are provided
for “Accepted long event” and “Accepted short event”; they use the same
confirmed booleans as the statistics.
REPAINT AND DATA BOUNDARY
Signal Audit Lab does not commit its own events before bar close. Historical
and realtime tests confirm that an unconfirmed source flicker is excluded from
the statistics until confirmation.
This boundary cannot certify the upstream source. A connected indicator may
still repaint, use future-looking data, revise history, or change behavior after
an update. Reload and Bar Replay should be repeated for the specific producer
before relying on a result. The panel therefore labels source stability as
unverified.
LIMITATIONS
- Results describe the loaded chart history, symbol, timeframe, settings, and
upstream plot. They are not universal and can change when any of these change.
- Close-to-close forward measurement is not an order-fill simulation or a
strategy backtest.
- The cost input does not model spread, slippage, liquidity, partial fills,
position sizing, pyramiding, or portfolio interaction.
- MFE and MAE use chart OHLC values inside the forward window; they do not prove
an executable path through intrabar prices.
- Session and volatility splits are descriptive. Small or imbalanced buckets
should not be treated as stable regimes.
- The script does not optimize settings, predict prices, or validate the logic
of the connected producer.
Use the Lab to form a better question, then verify that question with a proper
execution model and out-of-sample process.
ORIGINALITY AND SOURCE
This is an original BarState Labs implementation built from an independent
written specification and deterministic acceptance fixtures. No protected,
invite-only, or closed-source implementation was used. The script uses standard
forward-return, variance, Wilson interval, excursion, and ATR calculations and
is published under the Mozilla Public License 2.0.
CHANGELOG
v1.0.0
- Initial open-source release.
- Four explicit event decoders with confirmed-bar commitment.
- Five configurable forward horizons and cost sensitivity.
- Aggregate, directional, excursion, session, and volatility evidence.
- Compact and Full panels, accepted-event markers, and two alert conditions.
indicator. Connect one external plot, define how its values become long and
short events, and inspect the resulting sample on the current symbol and
timeframe.
This is a measurement tool. It does not generate signals, simulate orders, or
claim that an observed event has a trading edge.
HOW IT WORKS
The script reads one numeric `input.source()` series. Four decoders are
available:
- Signed pulse: positive and negative event pulses such as +1 / 0 / -1.
- Threshold cross: crossings above the long level or below the short level.
- Long-only edge: the first qualifying long value after a non-qualifying value.
- Short-only edge: the equivalent short-only rule.
Events are committed only on confirmed bars. Held values are deduplicated into
one edge. Optional cooldown and conflict rules make rejected events explicit.
An `na` transition cannot create an accidental first event without a prior
valid observation.
MEASUREMENT
The event-bar close is the anchor. Direction-adjusted forward returns are
measured after 1, 3, 5, 10 and 20 bars by default. Each horizon has its own
completed and pending sample count, so unfinished observations never enter the
denominator.
The round-trip cost input subtracts a user-defined basis-point amount from each
completed return. It is a sensitivity adjustment, not a fill, spread, slippage,
or execution model.
The panel reports:
- completed and pending observations;
- mean raw and cost-adjusted directional return;
- hit rate, return dispersion, and a Wilson 95% interval;
- separate aggregate, long, and short results;
- mean favorable and adverse excursion at the longest horizon;
- a payoff proxy based on mean positive versus mean negative net outcomes;
- longest-horizon session and normalized-ATR volatility splits;
- accepted long/short counts, cooldown rejects, conflicts, `na` skips, and
configuration status.
Samples below 30 observations are highlighted. Compact mode keeps aggregate
horizons, excursion/payoff, and diagnostics readable on narrow charts. Full
mode adds directional detail, raw-to-net values, Wilson intervals, dispersion,
and the split tables.
SESSION AND VOLATILITY SPLITS
The session split classifies the event bar using the selected session and
timezone. The defaults are 09:30–16:00, Monday–Friday, America/New_York.
Volatility is normalized ATR (`ATR / close`) compared with its moving-average
baseline. Defaults are ATR 14 and baseline 100. LOW is below 0.8 times the
baseline, HIGH is above 1.2 times the baseline, and values between those
boundaries are MID. Events before the baseline is available are UNCLASSIFIED.
The exact settings remain visible in Full mode.
SETUP
1. Add an indicator that exposes a numeric plot. TradingView strategies cannot
provide an external source plot.
2. Add Signal Audit Lab and select that plot under Event source.
3. Choose the decoder and levels that match the producer's numeric contract.
4. Enter a clear source label, then set horizons, cost sensitivity, session,
and volatility boundaries.
5. Read the sample count and diagnostics before interpreting percentages.
For a continuous oscillator such as RSI, Threshold cross is the natural
decoder. For a producer that exposes +1 / 0 / -1 pulses, use Signed pulse.
OUTPUTS AND ALERTS
Optional chart markers show accepted confirmed events. A hidden +1 / 0 / -1
plot is available for inspection or data export. Alert conditions are provided
for “Accepted long event” and “Accepted short event”; they use the same
confirmed booleans as the statistics.
REPAINT AND DATA BOUNDARY
Signal Audit Lab does not commit its own events before bar close. Historical
and realtime tests confirm that an unconfirmed source flicker is excluded from
the statistics until confirmation.
This boundary cannot certify the upstream source. A connected indicator may
still repaint, use future-looking data, revise history, or change behavior after
an update. Reload and Bar Replay should be repeated for the specific producer
before relying on a result. The panel therefore labels source stability as
unverified.
LIMITATIONS
- Results describe the loaded chart history, symbol, timeframe, settings, and
upstream plot. They are not universal and can change when any of these change.
- Close-to-close forward measurement is not an order-fill simulation or a
strategy backtest.
- The cost input does not model spread, slippage, liquidity, partial fills,
position sizing, pyramiding, or portfolio interaction.
- MFE and MAE use chart OHLC values inside the forward window; they do not prove
an executable path through intrabar prices.
- Session and volatility splits are descriptive. Small or imbalanced buckets
should not be treated as stable regimes.
- The script does not optimize settings, predict prices, or validate the logic
of the connected producer.
Use the Lab to form a better question, then verify that question with a proper
execution model and out-of-sample process.
ORIGINALITY AND SOURCE
This is an original BarState Labs implementation built from an independent
written specification and deterministic acceptance fixtures. No protected,
invite-only, or closed-source implementation was used. The script uses standard
forward-return, variance, Wilson interval, excursion, and ATR calculations and
is published under the Mozilla Public License 2.0.
CHANGELOG
v1.0.0
- Initial open-source release.
- Four explicit event decoders with confirmed-bar commitment.
- Five configurable forward horizons and cost sensitivity.
- Aggregate, directional, excursion, session, and volatility evidence.
- Compact and Full panels, accepted-event markers, and two alert conditions.
Notas de prensa
Safety and readability update. Signal Audit Lab now starts unarmed and clearly reports SETUP REQUIRED until an external numeric plot is selected and Source binding confirmed is enabled, preventing the default Close series from being misread as an event stream. Compact is now the default panel, and Auto panel position keeps the table away from current price. Event decoding and measurement formulas are unchanged after arming.Notas de prensa
This update makes the audit safer to start and easier to read. New instances stay unarmed until you choose a source plot and confirm the source. The default cost check is now 10 bps. The compact panel uses clearer setup prompts, identifies the symbol and timeframe, and states that producer logic is outside the audit. Event timing, decoders, and measurement formulas are unchanged.Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.