OPEN-SOURCE SCRIPT
Weekday Return Distribution [Pineify]

Weekday Return Distribution [Pineify]
Overview
This day-of-week seasonality indicator keeps bounded samples for all seven days on 1D-1W charts. It reports median return, interquartile range (IQR), positive-return rate, and sample count.
Problem Definition
A weekday mean can be raised by one extreme gap even when most observations are negative. The same mean can describe a tight cluster or a wide distribution, and it does not reveal whether the sample has six cases or sixty. This creates false precision. This script separates robust location, middle spread, sign balance, and evidence quantity. It describes historical conditioning, not the next return.
Design Rationale
Median replaces the mean because rank location is less sensitive to outliers. Q1 and Q3 describe the middle half without assuming a Gaussian sample. Positive-return rate tests whether direction is broadly shared, while N stops thin samples from receiving full authority. A lifetime sample can preserve obsolete regimes, while a short one makes quantiles jump. Bounded memory trades stability for adaptation. A requested daily context lets weekly charts inherit weekday statistics instead of calling a weekly return Monday data.
Key Features
How It Works
The engine runs in a requested 1D context. At a new daily bar, it calculates the previous completed log return as 100 x ln(previous close / earlier close) and assigns it to the weekday where that return ended. The live return is excluded; weekends are optional.
Each bucket keeps at most the chosen limit, removing its oldest excess value. A copied bucket is sorted. Q1, median, and Q3 are linearly interpolated at 25%, 50%, and 75%. Positive rate is the share strictly above zero, and N is the actual count.
The latest daily weekday selects the pane row. Gold bounds show Q1-Q3 and the thick line shows median percent return. Interpretation begins when N reaches the minimum. Positive bias requires median and positive rate to pass both positive thresholds; negative bias applies symmetric gates. Disagreement is Mixed; insufficient evidence is Wait. Teal, coral, and gray encode state, and opacity shows maturity.
How Multiple Indicators Work Together
All components measure one distribution. Median supplies location, Q1/Q3 supplies spread, positive rate checks sign participation, and N governs eligibility. The state is conjunctive: without spread uncertainty is hidden; without sign balance a few large returns can dominate; without N a sparse day looks mature. Band, line, color, and table share the same samples.
Trading Ideas and Insights
Use this as scheduling context, not an entry command. A positive median inside a narrow IQR with a high positive rate is more consistent than the same median inside a wide band. Compare days within one symbol and sample policy because assets have different scales. No state estimates profit or next-bar probability.
Unique Aspects
Common weekday tools show one mean or static rank. Here each day owns a bounded queue, the pane rotates through robust location and IQR, and sign participation plus N controls a separate state. Returns stay in percentage units. Only a previous completed daily return is inserted. Weekly charts reuse the daily engine, preserving the definition across 1D-1W.
How to Use
Start on a standard 1D chart and load enough history for each active day to reach minimum N. Read the thick line as median and the gold band as the middle 50% for the highlighted weekday. In the table, Pos or Neg means both gates pass; Mix means mature disagreement; Wait means insufficient evidence. Alerts report state entry or lost reliability, not orders.
Customization
Maximum samples sets memory from 12 to 104 observations per day. Larger values are smoother but slower; smaller values adapt faster. Minimum samples controls readiness. Median magnitude filters effects near zero, and Positive-return threshold sets sign participation with a symmetric negative rule. IQR, halo, background, marker, and table can be hidden without changing calculations. Defaults are not universal optima.
Assumptions and Limitations
This is descriptive seasonality, not causal evidence. Returns include sessions, gaps, feed adjustments, and chart construction. Holidays, missing bars, and calendar changes make buckets unequal; revisions can alter history. Quantiles lag regimes and depend on window settings. Positive rate ignores magnitude; IQR omits tails. On weekly charts, TradingView maps the latest daily context into each bar, so coverage and live timing depend on loaded history and access. Weekday and alerts advance with daily context. Use standard 1D-1W charts; other timeframes are invalid. No future access, backtest, costs, or execution model is included.
Conclusion
Weekday Return Distribution replaces a fragile average with a bounded distribution view. Median shows location, IQR shows middle spread, positive rate shows participation, and N controls readiness, keeping uncertainty and data boundaries visible.
Overview
This day-of-week seasonality indicator keeps bounded samples for all seven days on 1D-1W charts. It reports median return, interquartile range (IQR), positive-return rate, and sample count.
Problem Definition
A weekday mean can be raised by one extreme gap even when most observations are negative. The same mean can describe a tight cluster or a wide distribution, and it does not reveal whether the sample has six cases or sixty. This creates false precision. This script separates robust location, middle spread, sign balance, and evidence quantity. It describes historical conditioning, not the next return.
Design Rationale
Median replaces the mean because rank location is less sensitive to outliers. Q1 and Q3 describe the middle half without assuming a Gaussian sample. Positive-return rate tests whether direction is broadly shared, while N stops thin samples from receiving full authority. A lifetime sample can preserve obsolete regimes, while a short one makes quantiles jump. Bounded memory trades stability for adaptation. A requested daily context lets weekly charts inherit weekday statistics instead of calling a weekly return Monday data.
Key Features
- Seven bounded weekday buckets with optional weekend exclusion.
- Median, interpolated Q1/Q3, positive-return rate, and N.
- Rotating IQR band, median track, reliability opacity, and table.
- Joint bias gates, three alerts, and switchable layers.
How It Works
The engine runs in a requested 1D context. At a new daily bar, it calculates the previous completed log return as 100 x ln(previous close / earlier close) and assigns it to the weekday where that return ended. The live return is excluded; weekends are optional.
Each bucket keeps at most the chosen limit, removing its oldest excess value. A copied bucket is sorted. Q1, median, and Q3 are linearly interpolated at 25%, 50%, and 75%. Positive rate is the share strictly above zero, and N is the actual count.
The latest daily weekday selects the pane row. Gold bounds show Q1-Q3 and the thick line shows median percent return. Interpretation begins when N reaches the minimum. Positive bias requires median and positive rate to pass both positive thresholds; negative bias applies symmetric gates. Disagreement is Mixed; insufficient evidence is Wait. Teal, coral, and gray encode state, and opacity shows maturity.
How Multiple Indicators Work Together
All components measure one distribution. Median supplies location, Q1/Q3 supplies spread, positive rate checks sign participation, and N governs eligibility. The state is conjunctive: without spread uncertainty is hidden; without sign balance a few large returns can dominate; without N a sparse day looks mature. Band, line, color, and table share the same samples.
Trading Ideas and Insights
Use this as scheduling context, not an entry command. A positive median inside a narrow IQR with a high positive rate is more consistent than the same median inside a wide band. Compare days within one symbol and sample policy because assets have different scales. No state estimates profit or next-bar probability.
Unique Aspects
Common weekday tools show one mean or static rank. Here each day owns a bounded queue, the pane rotates through robust location and IQR, and sign participation plus N controls a separate state. Returns stay in percentage units. Only a previous completed daily return is inserted. Weekly charts reuse the daily engine, preserving the definition across 1D-1W.
How to Use
Start on a standard 1D chart and load enough history for each active day to reach minimum N. Read the thick line as median and the gold band as the middle 50% for the highlighted weekday. In the table, Pos or Neg means both gates pass; Mix means mature disagreement; Wait means insufficient evidence. Alerts report state entry or lost reliability, not orders.
Customization
Maximum samples sets memory from 12 to 104 observations per day. Larger values are smoother but slower; smaller values adapt faster. Minimum samples controls readiness. Median magnitude filters effects near zero, and Positive-return threshold sets sign participation with a symmetric negative rule. IQR, halo, background, marker, and table can be hidden without changing calculations. Defaults are not universal optima.
Assumptions and Limitations
This is descriptive seasonality, not causal evidence. Returns include sessions, gaps, feed adjustments, and chart construction. Holidays, missing bars, and calendar changes make buckets unequal; revisions can alter history. Quantiles lag regimes and depend on window settings. Positive rate ignores magnitude; IQR omits tails. On weekly charts, TradingView maps the latest daily context into each bar, so coverage and live timing depend on loaded history and access. Weekday and alerts advance with daily context. Use standard 1D-1W charts; other timeframes are invalid. No future access, backtest, costs, or execution model is included.
Conclusion
Weekday Return Distribution replaces a fragile average with a bounded distribution view. Median shows location, IQR shows middle spread, positive rate shows participation, and N controls readiness, keeping uncertainty and data boundaries visible.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
🚀🚀🚀 Pineify - pineify.app
Essential Toolkit for Every Trader
- AI Pine Script Generator
- Finance AI Agent
- AI Stock Picker
- Pine Script Visual Editor
- Invited indicators
- Strategy Optimizer
- Trading Journal
- Backtest Report
Essential Toolkit for Every Trader
- AI Pine Script Generator
- Finance AI Agent
- AI Stock Picker
- Pine Script Visual Editor
- Invited indicators
- Strategy Optimizer
- Trading Journal
- Backtest Report
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
🚀🚀🚀 Pineify - pineify.app
Essential Toolkit for Every Trader
- AI Pine Script Generator
- Finance AI Agent
- AI Stock Picker
- Pine Script Visual Editor
- Invited indicators
- Strategy Optimizer
- Trading Journal
- Backtest Report
Essential Toolkit for Every Trader
- AI Pine Script Generator
- Finance AI Agent
- AI Stock Picker
- Pine Script Visual Editor
- Invited indicators
- Strategy Optimizer
- Trading Journal
- Backtest Report
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.