Seasonality Trading System

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #123318 quote
    Francesco
    Participant
    Veteran

    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.

    defparam CumulateOrders= false
    
    // Position Size
    n= 7
    
    
    // January
    if month=1 and day=1 then
    buy n contract at market
    endif
    // Time Exit
    if month=1 and day=31 then
    sell at market
    endif
    
    
    // February
    if month=2 and day=1 then
    buy n contract at market
    endif
    // Time Exit
    if month=2 and day=28 then
    sell at market
    endif
    
    
    // March
    if month=3 and day=1 then
    sellshort n contract at market
    endif
    // Time Exit
    if month=3 and day=31 then
    exitshort at market
    endif
    
    
    // April
    if month=4 and day=1 then
    buy n contract at market
    endif
    // Time Exit
    if month=5 and day=31 then
    exitshort at market
    endif
    
    
    // June
    if month=6 and day=1 then
    sellshort n contract at market
    endif
    if month=7 and day=31 then
    exitshort at market
    endif
    
    
    // August
    if month=8 and day=1 then
    buy n contract at market
    endif
    // Time Exit
    if month=8 and day=31 then
    sell at market
    endif
    
    
    // September
    if month=9 and day=1 then
    buy n contract at market
    endif
    // Time Exit
    if month=10 and day=31 then
    sell at market
    endif
    
    
    // November
    if month=11 and day=1 then
    buy n contract at market
    endif
    // Time Exit
    if month=11 and day=30 then
    sell at market
    endif
    
    
    // December
    if month=12 and day=1 then
    sellshort n contract at market
    endif
    // Time Exit
    if month=12 and day=31 then
    exitshort at market
    endif
    
    
    // Stop And Target
    set stop loss 100
    set stop trailing 70
    
    #123325 quote
    deletedaccount100622
    Participant
    New

    Hi 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

    #123327 quote
    Vonasi
    Moderator
    Master

    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.

    Francesco thanked this post
    #123331 quote
    Francesco
    Participant
    Veteran

    Hi 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?

    #123335 quote
    robertogozzi
    Moderator
    Master

    The 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.

    Francesco thanked this post
    #123339 quote
    Francesco
    Participant
    Veteran

    The 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.

    #123343 quote
    robertogozzi
    Moderator
    Master

    I 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).

    Francesco thanked this post
    #123353 quote
    Vonasi
    Moderator
    Master

    The 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.

    #123368 quote
    Francesco
    Participant
    Veteran

    How many years are a valid OOS range in your opinion?

    #123384 quote
    Francesco
    Participant
    Veteran

    New test, DOW seasonality strategy, based on 1983-2010 range. OOS of 10 years (maximum possible). Breakeven stop.

    Position size= 0.5 (about 600€ at the moment i’m writing)

    Nobody thanked this post
    #123391 quote
    Vonasi
    Moderator
    Master

    How 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?

    Francesco thanked this post
    #123392 quote
    Francesco
    Participant
    Veteran

    How 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 🙂

    #123478 quote
    Vonasi
    Moderator
    Master

    Francesco – you might be interested in the topic found here:

    Seasonality Curve using arrays.

    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.

    Francesco thanked this post
    #123480 quote
    Francesco
    Participant
    Veteran

    Looks 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.

    #123506 quote
    Vonasi
    Moderator
    Master
    When 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.
Viewing 15 posts - 1 through 15 (of 16 total)
  • You must be logged in to reply to this topic.

Seasonality Trading System


ProOrder support

New Reply
Author
Summary

This topic contains 15 replies,
has 4 voices, and was last updated by Francesco
5 years, 10 months ago.

Topic Details
Forum: ProOrder support
Language: English
Started: 03/25/2020
Status: Active
Attachments: 4 files
Logo Logo
Loading...