Seasonality Curve using arrays.

Forums ProRealTime English forum ProBuilder support Seasonality Curve using arrays.

Tagged: ,

Viewing 13 posts - 1 through 13 (of 13 total)
  • #121052

    I decided to have a little play with the new arrays in v11 and created this simple code that draws a Jan to Dec seasonality curve. It needs plenty more work to turn it into something exciting but has shown me how much easier it is to analyse historical data now that we have arrays.

    Launch it on a monthly chart as it is only coded to work on that time frame at the moment.

    The attached image is of Soybeans.

     

    2 users thanked author for this post.
    #123417

    I found some time to work a little more on the v11 seasonality curve indicator and it is now something that stores in arrays the increase or decrease for every day of every year for all of history or from a chosen start date and then displays it as a curve representing a year.

    The month labels represent the start of each month.

    The availability of arrays makes the code very small compared to how it would need to be without them and it displays instantly thanks to ISLASTBARUPDATE. It was also an opportunity to use the new FLOOR instruction for rounding down and also ISSET.

     

     

    1 user thanked author for this post.
    #123432

    I forgot to say to only apply the indicator to the daily chart.

    The first image is the 15k daily analysis of wheat so going right back to the early 60’s.

    Not sure you would want to go long wheat in the first half of the year!

    The second image is the same but just analysed from 01 Jan 1995. A bit more erratic due to the reduced amount of data but the trend is similar.

    I will modify the code so that we can analyse from a start date to an end date and then we can compare in sample earlier data and see if the out of sample later data actually does a similar thing. That should give us more confidence that seasonality actually doe exist and still exists.

    #123445

    That modification was very easy. Here is the code that allows you to set a start date and an end date for the data to be analysed.

    In the attached image of wheat we can see that the top graph which analyses the start of the 60’s up to the end of 1994 has very distinct seasonality but the lower graph which analyses from the start of 1995 to the present day is much more erratic and although some periods show similar seasonality it is in truth a very different chart.

    There is a danger when using seasonality to analyse the whole of history and believe that is what it does every month of every year but by breaking it into two or more sample periods we can see that the markets have changed a lot. Computers started to be used for analysis and trading around the 90’s and I would guess that this has a lot to do with the differences as well as the fact that farming and transportation to other parts of the world has become much more efficient and so I guess wheat is now a lot less seasonal.

     

    #123449

    Soybean however looks pretty similar for the two sample periods.

    #123453

    Another small modification. This one marks the highest and lowest points in the seasonality curve. You can turn the markings off with the HighAndLow variable setting.

     

    1 user thanked author for this post.
    avatar Bel
    #123456

    Lean Hogs pre 1995 and post 1995. Pretty similar charts.

    #123464

    Another small improvement – I really should stop now! This version lets you choose whether the analysis is done with actual price or price as a percentage of the previous close. I personally think that the latter is better when we are comparing two different data samples from two very different times.

    The image shows platinum with the top chart being calculated using percentage of price and the lower one calculated on actual price.

     

    #123467

    It can be interesting to put multiple charts on the same screen. In the image we have three charts, pre 1995, post 1995 and on all the data for Lean Hogs using percentage of price as the calculation method. Looks like there could be some definite seasonality to use there.

    I’ll submit the indicator to the library.

    #123482

    Heating Oil looks pretty seasonal.

    #123498

    Excellent!

    1 user thanked author for this post.
    #188724

    Sono nuovo del Market, ho importato il codice della stagionalità, ma non vedo nulla. Precisamente nel lanciarlo , appare un riquadro alla cui base vi sono le date impostate e poi più nulla.

    Puoi aiutarmi?

    I’m new to the Market, I imported the seasonality code, but I don’t see anything. Precisely when launching it, a box appears at the base of which there are the dates set and then nothing more. can you help me?

    #188732

    @Ciccarelli Franco

    Only post in the language of the forumthat you are posting in. For example English only in the English speaking forums and French only in the French speaking forums,

    Thank you 🙂

     

Viewing 13 posts - 1 through 13 (of 13 total)

Create your free account now and post your request to benefit from the help of the community
Register or Login