Seasonality Trading System
Forums › ProRealTime English forum › ProOrder support › Seasonality Trading System
- This topic has 15 replies, 4 voices, and was last updated 4 years ago by Francesco.
-
-
03/25/2020 at 10:57 PM #123318
I built up a simple idea of trading system based on stock’s seasonality, ; of course as you will see these kind of systems are long term oriented.
The businesss idea is to develope optimized and specific seasonality systems for all the major assets to run at the same time; in order to have a nice monthly revenue in addiction to more fast paced algos.Here’s the first try with the GOLD asset, avoiding not clearly seasonality trend oriented months. (I’ve implemented a very basic trailing stop but it could be easily upgraded to have more gain%)
Position size=7 (around 600€ at the moment i’m writing)P.S.: i also tried a breakeven version, which gives much more gain% and a less smooth curve that can easily be good, but having in mind a long term stable business idea with more seasonality systems i think that consistency and smoothness in the equity curve are better; but it’s personal choice.
SeasonalityGold1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798defparam CumulateOrders= false// Position Sizen= 7// Januaryif month=1 and day=1 thenbuy n contract at marketendif// Time Exitif month=1 and day=31 thensell at marketendif// Februaryif month=2 and day=1 thenbuy n contract at marketendif// Time Exitif month=2 and day=28 thensell at marketendif// Marchif month=3 and day=1 thensellshort n contract at marketendif// Time Exitif month=3 and day=31 thenexitshort at marketendif// Aprilif month=4 and day=1 thenbuy n contract at marketendif// Time Exitif month=5 and day=31 thenexitshort at marketendif// Juneif month=6 and day=1 thensellshort n contract at marketendifif month=7 and day=31 thenexitshort at marketendif// Augustif month=8 and day=1 thenbuy n contract at marketendif// Time Exitif month=8 and day=31 thensell at marketendif// Septemberif month=9 and day=1 thenbuy n contract at marketendif// Time Exitif month=10 and day=31 thensell at marketendif// Novemberif month=11 and day=1 thenbuy n contract at marketendif// Time Exitif month=11 and day=30 thensell at marketendif// Decemberif month=12 and day=1 thensellshort n contract at marketendif// Time Exitif month=12 and day=31 thenexitshort at marketendif// Stop And Targetset stop loss 100set stop trailing 7003/26/2020 at 12:11 AM #123325Hi Francesco
have you tried this on soft commodities? Lean pork for example has a good seasonality, it may be better suited to a option rather than an algo though
03/26/2020 at 12:17 AM #123327As with all seasonality you have really just curve fitted your strategy to your data mined historical data.
Analyse a smaller section of data and use it to decide which months to be long and which to be short and then use this in sample to test an out of sample and I think you will find the results to be rather disappointing.
I coded something a long while back that used a rolling set of seasonality data to try to avoid this sort of curve fitting but the results of that were disappointing. I think for some commodities considering seasonality might give a slight edge but otherwise I personally find it to be of little use.
1 user thanked author for this post.
03/26/2020 at 12:32 AM #123331Hi Francesco
have you tried this on soft commodities? Lean pork for example has a good seasonality, it may be better suited to a option rather than an algo though
This is just a first step, I will consider other assets as I said
As with all seasonality you have really just curve fitted your strategy to your data mined historical data.
Analyse a smaller section of data and use it to decide which months to be long and which to be short and then use this in sample to test an out of sample and I think you will find the results to be rather disappointing.
I coded something a long while back that used a rolling set of seasonality data to try to avoid this sort of curve fitting but the results of that were disappointing. I think for some commodities considering seasonality might give a slight edge but otherwise I personally find it to be of little use.
The seasonality graph on which I based my strategy is from 2017. So can 2018/2019 and 2020 results can be considered OOS?
03/26/2020 at 12:38 AM #123335The last two lines use two different STOPS, which is not allowed, the second one WILL ovrride the previous one, so line 97 doesn’t affect performance.
1 user thanked author for this post.
03/26/2020 at 12:49 AM #123339The last two lines use two different STOPS, which is not allowed, the second one WILL ovrride the previous one, so line 97 doesn’t affect performance.
This is embarassing…well…beginner coder’s errors 😀
As you can notice from the first post I was struggling on which type of position management to use and I made a mess 🙁If it makes sense continuing to develop similar strategies, that will surely be a part to be heavily adjusted.
03/26/2020 at 1:09 AM #123343I have no idea, I never studied, nor tested, such kind of strategies.
You can set breakeven by placing a Stop pending order (at the entry price) when CLOSE > TRADEPRICE (or POSITIONPRICE in case of accumulated positions).
1 user thanked author for this post.
03/26/2020 at 9:39 AM #123353The seasonality graph on which I based my strategy is from 2017. So can 2018/2019 and 2020 results can be considered OOS?
Yes but it is a very small OOS and very small OOS are not to be trusted much.
03/26/2020 at 10:29 AM #12336803/26/2020 at 11:41 AM #12338403/26/2020 at 12:11 PM #123391How many years are a valid OOS range in your opinion?
As many as possible. Two years and three months only gives you 51 months of tests. I wouldn’t trust 51 possible trades as enough to go live on.
Have you checked through my library posts as I coded three or four seasonality indicators a while back that might be of interest to you?
1 user thanked author for this post.
03/26/2020 at 12:16 PM #123392How many years are a valid OOS range in your opinion?
As many as possible. Two years and three months only gives you 51 months of tests. I wouldn’t trust 51 possible trades as enough to go live on.
Have you checked through my library posts as I coded three or four seasonality indicators a while back that might be of interest to you?
I’ll go and have a look immediately.
For the OOS I will focus on the maximum possible (10 years) as in my last test on the dow.Thanks for the valuable advices as usual 🙂
03/26/2020 at 4:41 PM #123478Francesco – you might be interested in the topic found here:
https://www.prorealcode.com/topic/seasonality-curve-using-arrays/#post-121052
Really it is just me talking to myself but the indicator that I created by the end of it might be of some use to you. It only works on v11 though. I’ve submitted the indicator to the library and hopefully Nicolas will post it there soon.
1 user thanked author for this post.
03/26/2020 at 4:57 PM #123480Looks very interesting, congratulations for the excellent job. Did I reignited your desire to work on seasonality? 🙂
I will study it and i’ll develope more ideas also waiting for v11.I was also taking a look to weekly and daily seasonalities, but they look much less reliable than monthly ones.
03/26/2020 at 7:03 PM #123506When I coded those other v10.3 very clunky, very long codes I was desperate for arrays to make it much easier and faster so now they are here I thought that I would revisit it.
I’m still not a massive fan of seasonality. I think that in a few oddball commodities it has a place and I would consider it as a way to have a slight edge in trading those but otherwise it is not of much use I think. Even when you do use it by saying ‘it’s June so let’s only go short Lean Hog for a few months’ then you can have year after year where you are doing completely the wrong thing and then a few great years when you are doing the right thing. That can be a pretty tough strategy to trade mentally.
-
AuthorPosts
Find exclusive trading pro-tools on