Ultimate Seasonality Indicator [SS]

Hello everyone,

This is my seasonality indicator. I have been working on it for like 2 months, so hope you like it!

What it does?

The Ultimate Seasonality indicator is designed to provide you, the trader, an in-depth look at seasonality. The indicator gives you the ability to do the following functions:

  • View the most bearish and bullish months over a user defined amount of years back.
  • View the average daily change for each respective months over a user defined amount of years back.
  • See the most closely correlated month to the current month to give potential insights of likely trend.
  • Plot out areas of High and Low Seasonality.
  • Create a manual seasonal forecast model by selecting the desired month you would like to model the current month data after.
  • Have the indicator develop an autoregressive seasonal model based on seasonally lagged variables, using principles of machine learning.

I will go over these functions 1 by 1, its a whopper of an indicator so I will try to be as clear and concise as possible.

Viewing Bullish vs Bearish Months, Average Daily Change & Correlation to Current Month

The indicator will break down the average change, as well as the number of bullish and bearish days by month. See the image below as an example:

In the table to the right, you will see a breakdown of each month over the past 3 years.
In the first column, you will see the average daily change. A negative value, means it was a particularly bearish month, a positive value means it was a particularly bullish month.

The next column over shows the correlation to the current dataset. How this works is the indicator takes the size of the monthly data for each month, and compares it to the last X number of days up until the last trading day. It will then perform a correlation assessment to see how closely similar the past X number of trading days are to the various monthly data.

The last 2 columns break down the number of Bullish and Bearish days, so you can see how many red vs green candles happened in each respective month over your set timeframe. In the example above, it is over the pats 3 years.

Plot areas of High and Low Seasonality

In the chart above, you will see red and green highlighted zones.

Red represents areas of HIGH Seasonality.
Green represents areas of LOW Seasonality.

For this function, seasonality is measured by the autocorrelation function at various lags (12 lags). When there is an average autocorrelation of greater than 0.85 across all seasonal lags, it is considered likely the result of high seasonality/trend.

If the lag is less than or equal to 0.05, it is indicative of very low seasonality, as there is no predominate trend that can be found by the autocorrelation functions over the seasonally lagged variables.

Create Manual Seasonal Forecasts

If you find a month that has a particularly high correlation to the current month, you can have the indicator create a seasonal model from this month, and fit it onto the current dataset (past X days of trading).

If we look at the example below:

We can see that the most similar month to the current data is September. So, we can ask the indicator to create a seasonal forecast model from only September data and fit it to our current month. This is the result:

You will see, using September data, our most likely close price for this month is 450 and our model is y= 1.4305x + -171.67.
We can accept the 450 value but we can use the equation to model the data ourselves manually.

For example, say we have a target price on the month of 455 based on our own analysis. We can calculate the likely close price, should this target be reached, by substituting this target for x. So y = 1.4305x + -171.67 becomes

y = 1.4305(455) +- 171.67
y = 479.20

So the likely close price would be 479.20. No likely, and thus its not likely we are to see 455.
HOWEVER, in this current example, the model is far too statistically insignificant to be used. We can see the correlation is only 0.21 and the R squared is 0.04. Not a model you would want to use!
You want to see a correlation of at least 0.5 or higher and an R2 of 0.5 or higher.

We can improve the accuracy by reducing the number of years we look back. This is what happens when we reduce the lookback years to 1:

You can see reducing to 1 year gives December as the most similar month. However, our R2 value is still far too low to really rely on this data whole-heartedly. But it is a good reference point.

Automatic Autoregressive Model
So this is my first attempt at using some machine learning principles to guide statistical analysis.

In the main chart above, you will see the indicator making an autoregressive model of seasonally lagged variables. It does this in steps. The steps include:

  • 1) Differencing the data over 12, seasonally lagged variables.
  • 2) Determining stationarity using DF test.
  • 3) Determining the highest, autocorrelated lags that fall within a significant stationary result.
  • 4) Creating a quadratic model of the two identified lags that best represents a stationary model with a high autocorrelation.

What are seasonally lagged variables?
Seasonally lagged variables are variables that represent trading months. So a lag of 25 would be 1 month, 50, 2 months, 75, 3 months, etc.

When it displays this model, it will show us what the results of the t-statistic are for the DF test, whether the data is stationary, and the result of the autocorrelation assessment.
It will then display the model detail in the tip table, which includes the equation, the current lags being used, the R2 and the correlation value.

Concluding Remarks

That's the indicator in a nutshell!
Hope you like it!

One final thing, you MUST have your chart set to daily, otherwise you will get a runtime error. This can ONLY be used on the daily timeframe!

Feel free to leave your questions, comments and suggestions below.

My "ultimate" indicators are made to give the functionality of multiple indicators in one. If you like this one, you may like some of my others:

Thanks for checking out the indicator!

Premium indicators and content have launched! Get access at:
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?