How it is calculated
Periods are hours, days or months on the chosen clock. When one ends, its return (last close divided by the last close of the period before, minus 1) joins its bucket: the hour 0 to 23, the weekday 0 (Monday) to 6, the turn of the month (the last weekday and the first three of a month) as 1 against 0, or the month 1 to 12. t_stat is the mean divided by the sample deviation over the square root of the count.
Reference: Calendar effects: day of the week, turn of the month (Ariel 1987), month of the year
How to read it
The running period never counts, so a bar never feeds the number it reads. Mean, share and t wait for the minimum count. Small samples are noisy, and an effect found by looking at many buckets is often luck: a t around 2 from a dozen returns is weak evidence, and it assumes the returns are independent, which they rarely are.
In a strategy
As a filter: with s = ctx.ind("seasonality", by="weekday", min_count=20) take longs only while s.mean is above 0 and s.t_stat above 2, or skip the turn of the month with by="turn_of_month".
Inputs
| Input | Type | Default | Range or choices |
|---|---|---|---|
Group byby | Choice | "weekday" | Month, Weekday, Turn of the month, Hour |
Clockzone | Choice | "utc" | UTC, London, New York, Tokyo, Sydney |
Minimum returnsmin_count | Whole number | 10 | min 2, max 1000 |
What it draws
| Line | Drawn as |
|---|---|
| Mean return | Columns |
Used in
No strategy template reads it yet.