PROTECTED SOURCE SCRIPT
Güncellendi

Distrodisco_v1.4

71
What it does:

Defines a “distribution session” (customizable time window) and tracks that session’s high/low to compute its distribution width as a percentage.

Compares the current session’s distribution to historical same-day-of-week distributions to detect when it crosses above the median (i.e., a meaningful breakout in context).

Tags the breakout direction (long or short) based on wick extremes and prior-session pivots.

After a tagged break, tracks the pullback/retrace: how far price reverses back toward the tag (used for SL tuning).

Simultaneously measures how far price extends beyond the break before the retrace begins—this “extension before retrace” can be used to calibrate realistic take-profit targets.

Maintains historical accumulators for both retrace sizes and extensions so you can see distributions over time.

Key metrics shown in the table:

Total Days / Median Hits: Coverage of historical samples and how often distribution crosses its median.

Pullback Rate: Percentage of median breaks that produced a pullback (including live/active ones if the session ends mid-retrace).

Current / Historical Distribution Stats: Current session’s width vs. historical median/average for that weekday.

Reversion Ret (revAbs): The largest pullback after a break (live for the session), used as a de-facto stop-loss gauge.

Hist Median Ret: Median of completed historical retraces (and active ones at session end if not closed).

90%ile Ret: Upper-bound reference for retrace size—what the larger retraces look like.

>= X% PBs: User-defined threshold (e.g., enter 0.05 for 0.05%) showing the percentage of historical retraces that met or exceeded that magnitude.

Extension Median / 90%ile / Last Ext: How far price typically runs past the break before reversing—used for take-profit calibration. (If not yet enabled, these are forthcoming additions.)

Inputs:


Distribution Session / Timezone: Define the intra-day window to consider for distribution measurement.

Max Distribution % to Include: Caps abnormally wide distributions from polluting historical buckets.

Filter Out Abnormally Large Days: Toggle to exclude outliers.

Min Pullback to Count (%): Threshold to count “meaningful” retraces in the historical percentage bucket. Enter e.g. 0.05 to represent 0.05%.

Table styling: Color and positioning for easy visibility.
Sürüm Notları
Distrodisco_v1.6.1

- Normalized all percent metrics to decimals and cleaned up table formatting (uses format.percent correctly).

- Unified extension logic with lastExtension and centralized calculation helper; fixed inconsistent pushes.

- Refactored retrace start/end flow (separate start/update/end) so PB end tags fire reliably.

- Updated session highlight to a stable live+final box pattern to eliminate floaty visuals.

- Miscellaneous bug fixes around tagging and pullback measurement.
Sürüm Notları
Temporarily removed flags
Sürüm Notları
- Added toggled to enable/disabled Table Cells (declutter)
Sürüm Notları
- adjusted on chart name (sorry)
Sürüm Notları
Added mode calculation for historical retraces and extensions with adaptive binning (configurable bin size) to surface the most frequently occurring move. Handles NaNs and empty data safely.

Fixed extension tracking so only real numeric extensions are pushed into history.

Robustified mode logic to avoid array errors (proper bin creation/increment and invalid bin size guarding).

Added visibility toggles so users can show/hide individual stats (median, average, current dist, retrace, mode, etc.).

Miscellaneous stability improvements around distribution/session handling and edge-case guards.
Sürüm Notları
- Forgot to adjust on chart name 🤦‍♂️
Sürüm Notları
- Fixed a bug where Retraces were measured even after price had been reclaimed

- Fixed Extension math so it no longer shows N/A (wasn't handling 0 well previously)
Sürüm Notları
🔹 Functional Updates

Break Candle Flagging

Added an optional showFlags input to plot a "Break ↑" / "Break ↓" label on the bar where the median break occurs.

Retrace Entry/Exit Flags

Plots an "Entry" label when the retrace starts.

Plots an "Exit (New HH / LL)" or "Exit (Sess End)" label when the retrace ends.

Extension Tracking Fix

Ensured extensions are cleaned (f_clean) before calculating median/mode, so NA values don’t skew stats.

Mode Calculation Toggle

Added inputs showModeRet & showModeExt so mode rows can be toggled on/off in the table.

Table Row Visibility Toggles

Added a bunch of show_____ inputs to selectively show/hide rows (e.g., Total Days, Median Hits, Pullback Rate, Curr Ret, etc.).

🔹 Internal Logic Improvements

Refined TAG DETECTION so breakout direction is decided via prior session high/low, falling back to midpoint if unclear.

Reset all extension/retrace tracking variables properly at each new median break.

Used clean arrays when computing extension stats to avoid incorrect numbers from NA pollution.
Sürüm Notları
Small update:

- Added next bar tracking

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.