OPEN-SOURCE SCRIPT
Day-of-Week Effect

What the script does
The Day-of-Week Effect indicator visualises a well-known market anomaly: certain days of the week produce statistically different average returns. The script identifies your chosen entry and exit days on any chart, highlights them visually, and calculates the historical average close-to-close return for every weekday — so you can see at a glance whether the effect actually holds on your chosen instrument.
How it works
On each bar, the script reads the day of the week using Pine Script's built-in dayofweek variable. It detects the first bar of each new trading day using ta.change(time("D")), which prevents signals from firing on every intraday bar if you're on a sub-daily timeframe. It then accumulates a running sum and count of close-to-close returns per weekday across the entire chart history, dividing them at the last bar to produce the average return table.
How to use it
Open TradingView, paste the script into the Pine Editor and click "Add to chart." The indicator works best on the 1D timeframe. In the Settings panel, toggle which days you want highlighted as entry days (teal) and exit days (orange)
Why it's original
Most DOW indicators simply colour-code days. This one goes further by pairing the visual highlighting with a live per-weekday return breakdown calculated directly from your chart's own price history — so rather than applying a generic market assumption, you're validating the effect on your specific ticker and timeframe before acting on it.
Alerts
The script does not currently include alertcondition() calls. To add alerts, you can extend the script with:
Pine Script®
The Day-of-Week Effect indicator visualises a well-known market anomaly: certain days of the week produce statistically different average returns. The script identifies your chosen entry and exit days on any chart, highlights them visually, and calculates the historical average close-to-close return for every weekday — so you can see at a glance whether the effect actually holds on your chosen instrument.
How it works
On each bar, the script reads the day of the week using Pine Script's built-in dayofweek variable. It detects the first bar of each new trading day using ta.change(time("D")), which prevents signals from firing on every intraday bar if you're on a sub-daily timeframe. It then accumulates a running sum and count of close-to-close returns per weekday across the entire chart history, dividing them at the last bar to produce the average return table.
How to use it
Open TradingView, paste the script into the Pine Editor and click "Add to chart." The indicator works best on the 1D timeframe. In the Settings panel, toggle which days you want highlighted as entry days (teal) and exit days (orange)
- Use the stats table in the bottom-right to identify which days have historically been strongest on your instrument
- Tthen configure your entry/exit days accordingly
- The display settings let you turn off labels, background shading, or the table independently
Why it's original
Most DOW indicators simply colour-code days. This one goes further by pairing the visual highlighting with a live per-weekday return breakdown calculated directly from your chart's own price history — so rather than applying a generic market assumption, you're validating the effect on your specific ticker and timeframe before acting on it.
Alerts
The script does not currently include alertcondition() calls. To add alerts, you can extend the script with:
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.