For many experienced traders it is obvious that the market does not behave in the same way all year round. Although the effects are never as predictable or obvious as new traders tend to think – like the myth about bad trading conditions during the end of the year – it is clear that the markets go through a cycle each year that has some characteristics that might be reproducible. With this in mind we can think about exploiting the seasonality inside the market – the effects of different times of the year – to improve our trading strategies. Through this article I will talk about seasonal effects, how they can be found and how they can be used in order to improve an algorithmic trading strategy; I will also go into some detail regarding the pitfalls in identifying seasonal effects and why great care needs to be taken when using these effects to improve trading systems.

Let us suppose that you have an algorithmic trading strategy that you have properly back-tested during the past 10-25 years of data and you want to come up with some additional measures to improve your strategy without introducing excessive curve fitting. You want to improve your strategy in a way that is statistically sound. You have also observed that your strategy has lost money during the past two years in the June-July period (you think there is a seasonal effect), so you’re thinking that a way to improve the strategy might be to stop trading during these two months. However how can we know if it was just a coincidence that the strategies had a losing period for the past two years or if there is a true seasonal effect going on here ? Removing trading during these two months and running a back-test during this period will obviously yield better results (you are removing losing months in hind-sight), so any analysis performed should go much deeper.

–

–

The first thing we need to wonder is how permanent this behaviour is through a large back-testing period. You should take your strategy and look for yearly back-tests in order to see if trades entered during a certain month tend to be unprofitable through the past 10-20 years or if it just appears to be a random effect. It is also very important to consider the number of trades taken – rather than the number of months – in order to be able to draw conclusions that have a sound statistical basis. For example if your strategy has taken 200 trades during the past ten years during June-July and 180 of these 200 trades have been unprofitable while – on other months – you have that in average only 100 out of 200 trades have been unprofitable then there is a high statistical significance for the month of June to contain a seasonal effect. What you have is a much higher sustained probability of having a loss during a certain month (or group of months) meaning that the best decision is clearly to avoid trading during this period.

As you can see, the most important thing is to distinguish whether the seasonal effect is truly relevant relative to the total number of trades and the statistics for the other months or if it is simply a month that carries a level of loss that is similar to losses seen in other periods (therefore filtering it would have no fundamental reason). In order to distinguish seasonality it is also important to have individual statistics for each single year since you also need to consider the reproducibility of the effect across different years. For example the deviation of returns on that particular period must be low and the median for the returns for the period should also be negative. It can often be the case that one month on one year was extremely bad, meaning that filtering this month will greatly increase back-testing profitability (because this loss exceeds gains on this month across other years) but such filtering has no basis in seasonality since the losses caused by this month were a “one time thing”. Low variance between returns for the same period across different years and a negative median are good signs that a seasonal effect is happening. A good hint to avoid erroneous inference of seasonality is to analyse back-tests for a 10 year period to infer seasonality and then test on another 10 year period to see if the effect is also there. Seasonality should be constant.

Is there such a case? Lately I have dedicated some of my time to studying seasonality effects in Asirikuy systems as this tells us a lot about both the market and our trading systems. Many Asirikuy systems show absolutely no seasonality (no month which is constantly losing through long term tests) but some strategies do exhibit heavy seasonality that talks about the way in which the market changes during different times of the year. The image above depicts the results of a strategy at Asirikuy that has a strong seasonality effect during the last three months of the year. The results during these three months are negative 70% of the time while the probability to have a losing month is – in general – only 45%. This fact indicates that there is a strong tendency for losses during these three months, a tendency which is constant during the 25 year back-testing period. The median for the three months is also negative, further support the hypothesis that it wasn’t a single “negative spike” during this period on one year causing the losing effect.

–

–

When we filter out trading during these three months (on every year) the results of the strategy are improved very significantly especially regarding the average compounded yearly profit to maximum drawdown ratios which go – on an analysis of the 25 year period – from 0.29 to 0.48. All other statistics are also improved to some degree, although the best improvement is a reduction of the maximum drawdown while profitability remains fairly similar. In essence we can see how the inclusion of the seasonality effect improves the result of the strategy.

I know how many of you will be sceptics of implementing such a filtering technique – many of you may invoke the curve-fitting argument against doing this type of analysis – but I consider that we cannot ignore a repetitive, statistically relevant seasonal effect on a strategy that leads to a very substantial improvement of that trading tactic. If you know that there is a 80% chance of a blizzard storm during the summer, you’re not going to come out unprepared and – in analogy – if we know a trading system is much more likely to get losses during a certain trading period – and the seasonal effect is validated through extensive back-tests – actions need to be taken in order to take advantage of this information. Any seasonality effects that appear as repetitive and reproducible through a 25 year period analysis deserve some attention in order to both improve and understand our trading systems.

Truth be told, seasonality is not very common and it is only found in a few trading strategies. Why some strategies show seasonal effects while others remain pretty much the same through the year is also something worth discussing and investigating further. Clearly I am interested in hearing your opinion and what you think about this effect. **Do you think seasonality should be ignored? Do you think it should be acted upon? How would you take into account seasonal effects ? Would you propose other criteria to judge whether seasonal effects exist ? Please post a comment and let me know :o)**

If you would like to learn more about algorithmic trading design and how you too can improve your automated system building skills please consider joining Asirikuy.com, a website filled with educational videos, trading systems, development and a sound, honest and transparent approach towards automated trading in general . I hope you enjoyed this article ! :o)

Hi Daniel-

This is an interesting topic and I recently did some analysis of the data from Forex Historical back on my blog here->

http://fx-mon.blogspot.com/2012/09/meta-trader-fun-with-forex-historical.html

I found that certain weeks of the year are more likely to produce larger moves than other weeks. Its a timely topic because it showed that the 2nd week of the year (the one starting on Monday January 7th, 2013) is the week with the greatest movement than any other week of the year, on a historical basis anyway.

Based on that, it might be possible to use that data to magnify profits and minimize losses by adjusting lot sizes. This seems like it could be tested and would work – assuming your signals get on the right side of the move – which is no small assumption.

Take a look and let us know any comments.

Happy New Year,

Chris

Hey Daniel,

As I have said months ago, time is the third dimension of the market that we have not yet fully taken advantage of. A lot of research needs to go into taking advantage of time, be it hourly, daily or monthly filtering.

For example letting certain systems trade only certain market hours greatly improves the AAR/DD statistic. What I have never looked at is filtering on a monthly scale, so it is very interesting to see the results you have obtained!

Maybe in the future we will filter hours, days as well as months to improve the probability of a system being profitable.

Hi Franco,

Thank you for your post :o) I think that Qallaryi clearly showed that hourly filtering does not affect robustness provided that the number of trades entered is large. With this system we could still achieve very profitable out of sample testing, with low dependency between feeds, despite the 24 additional degrees of freedom we subjected the strategies through. Right now I am more in favour of modifying already profitable strategies to include seasonal, daily or hourly filters (we still need to research a lot in this area as you say), this is especially true for strategies that trade a lot. Thanks again for commenting,

Best regards,

Daniel

Hello Daniel,

If filtering months really improves strategy ‘A’ and all the statistical analysis supports this change, then, instead of filtering, it must be possible to build a trading strategy ‘B’ that traded the opposite trades during the filtering period. The result of trading ‘A’ + ‘B’ would be exactly the same as filtering ‘A’ (not counting trading costs).

About this strategy ‘B’, would it fulfill all the long term profitability requirements we have on Asirikuy?

Hi Fernando,

Thank you for your comment :o) This is an interesting point, however it assumes that the market creates an inverse inefficiency during these periods when I suspect that what happens is that the edge of the strategy is lost without gaining an edge to the opposite side. In essence trading A + B would give better results that the filtered A if B was in fact having a positive expectancy. My guess is that A + B would not be a big improvement over unfiltered A because the biggest cause of loss during filtered periods is simply the lack of an edge, so costs play a key role. Obviously it will be very interesting to research if trading in an adversarial manner during these periods has an edge. I’ll let you know ! :o) Thanks again for commenting,

Best Regards,

Daniel

Hello Daniel,

I was defining ‘B’ as the exact complementary strategy so that trading ‘A’+’B’ would be the same as trading ‘A’ filtered (that is the premise).

So:

‘AF’ = ‘A’ + ‘B’

‘B’ = ‘AF’ – ‘A’

If quality(‘AF’) > quality(‘A’) -as your statistical analysis demonstrated-, then quality(‘B’) > 0.

My question is, does ‘B’ fulfills the rest of long term profitability requirements?

Hi Fernando,

Thank you for your post :o) This obviously assumes that the trading costs for the ‘B’ positions and the ‘A’ positions taken during the filtered periods are none. You cannot neglect trading costs because – as I have discovered in a few cases – trading costs are precisely what improves the trading strategy. When the seasonal effect involves a loss of an edge (with no necessary gain of an opposite edge) the improvement on the system comes from avoiding trading costs when the expectation of a profit is very low. Therefore an adversarial trading technique traded during this period could also have losing (albeit less losing) results, simply because the reverse strategy also lacks an edge. This means that a seasonal effect can involve a very reduced probability to achieve profit but not necessarily a profitable reverse outcome. Clearly quality(‘B’) is greater than quality(‘AFilteredPeriod’) but it is not necessarily positive (meaning that trading in an opposite manner does not increase your edge). You are removing a period where the edge is lost or dramatically reduced, not necessarily when a new edge in the opposite direction is made (I hope this makes sense!). I hope this clears it up :o) Let me know if I misunderstand something!

Best Regards,

Daniel

Hi Daniel,

the problem with seasonality is that in many cases there is not enough data available to judge whether there is a conditional probability with enough significance. That does get even more severe if you have overlapping conditions (e.g. first Friday in December in presidential election years).

I don’t think the frequentist approach will help us here because of the slow convergence speed. Instead I would like to suggest to have an eye on Bayesian analysis. R and Bugs will be helpful tools to evaluate different models and verify them through Monte Carlo simulation.

Best regards,

Fd

Hi Daniel,

Sorry I write off-topic here, but may be you did not read my question on

Atinalla FE.

I run setup and it shows weird chracters.

Can I (use some key to) force English?

Thank you.

Hi MFDar,

The setup is in English (not in any other language) your current Windows setup may be incompatible with the installer. I did read your post on the Atinalla FE topic but I am simply unable to provide additional support (because this is a problem with the installer which is a third-party application in the case of Atinalla FE). Please try setting this up on another computer or changing your windows language preferences. I hope this answers your inquiry,

Best regards,

Daniel