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:
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.