This seasonality indicator displays for each week of the year the percentage of up weeks and the average gain per week for each week of the year for a look back period. It can be used to test for any weekly seasonality in any market. Apply it only to the weekly chart of your chosen instrument
Look back periods of 5, 10, 15 and 20 years can be selected.
The histogram represents the percentage of weeks for that particular week number during the look back period where the close was greater than the open. The percentage is also displayed numerically above the histogram. The number under the histogram is the average gain per week for that particular week number during the look back period.
There is a variable called Insignificance Range. This is a percentage straddling 50% that highlights the histogram in blue to show that the number of up weeks in the look back period for that week is not significantly different to 50%. If set to 10 then any week with results from 45% to 55% will be highlighted in blue. Weeks above 55% will be green and those below 45% red.
Because the results are based on a rolling look back period the histogram bar under each candle represents the results at the close of the previous years candle for that week number. If you want to know whether next week has usually been a good week to go long or short then you will need to check the same week number in last years results. So for example if we are currently in week 15 2018 then you would need to look at week 16 2017 to see the analysis for next week. Hover over the indicator to see the week number as it may be different to PRT’s week number displayed on the chart.
If you apply all four indicators (5, 10, 15, 20 year rolling periods) to your weekly chart then you will be able to see if seasonality for any particular week has been strong across all test periods and whether it is getting stronger or weakening. Groups of weeks together can indicate longer periods where it has historically been good to go long or short any particular market.
When using the indicator you need to be wary of week 53’s that occur due to not every year having days that exactly divide into 52. The results for week 53 are not accurate or usable!
The code is very long at 4517 lines due to the lack of arrays at this time in PRT (or maybe just because I am a rather clunky coder! and that’s why it is not post under this description as usually in the library) so I advise downloading and importing the ITF file to get full functionality.
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Note: This indicator requires at least 20 years of weekly data to calculate. Instruments with less than 20 years of weekly data will not calculate correctly.
Every interesting code Vonasi. I have one question. It seems, that it only works in the weekly time unit. I am not a big coder like you, so i ask myself, if it is possible, that this indicator works with shorter time units like one day or one hour. What should be changed in the code?
The code resets at the start of a year and then stores data for the last 20 sets of 53 bars so it will not work on other time periods. It was purely written to try to see if their is any benefit in using rolling weekly seasonality as a filter. Personally I cannot see how testing for seasonality in faster time periods than a week would be of much use in trading any way.
Amazing work !! Thanks !
No problem pableitor – I’m glad you like it.
Hi Vonasi, I was checking a few random weeks with your indicator and sometimes it seems to be wrong. For instance the SP500 on a 5 year lookback period on w41 2018 gives an 80% up probability but w41 was up on 2013, 15 &17 and down on 2014 & 16 which means the result should be 60% on w41 doesnt it ?
I have not checked your query on a chart but my guess is that you are reading the indicator incorrectly. If it is 2018 and you want to know how this week performed in the last 5 years in week 41 then you have to look at the result under week 41 2017. If week 41 2018 has closed out then the result under it will be calculated using 2014 to 2018 inclusive. I’m guessing then that 2018 was an up week giving you your 80% as 2014 would be the only down week in that data set.