Steversteves

All about ARIMA Modeling

השכלה
SP:SPX   מדד S&P 500
ARIMA or ARIMA modelling, is a quantitative approach to stock price and volatility projection commonly used to MMs and other big financial institutions.

Its interesting because if you use implied moves from options, 99% of the time the implied move on options correspond to my own ARIMA and linear models, which is just a dead give away of how the MMs are calculating these things.

So what we will cover in this idea is:

a) What is it?
b) What can it do?
c) How its done? and
d) How you can do it.

So let's get into it!

Firstly, What is it?

ARIMA stands for AutoRegressive Integrated Moving Average. It is a model that is based in time series forecasting methods and is commonly used in statistics and econometrics. It combines auto-regression (AR), differencing (I for integrated), and moving averages (MA) to capture and predict trends and patterns in time-series data.

Autoregressive Component: The autoregressive component of ARIMA models the relationship between a data point and its past values. For example, it will take sequential close prices and calculate the difference between each sequential close price.

NOTE: IF you are interested in the concept of autoregression, check out my autoregressive cloud indicator which has a corresponding video that elaborates on the concept of autoregression and its use in stocks and trading, available here.

Differencing: The I component represents differencing to make the series stationary. Essentially, differencing involves taking the difference between consecutive data points in a time series. It aims to make the time series stationary by removing trends and seasonality, which simplifies the modeling process and allows for more accurate forecasts using auto-regression and moving average components.

Moving average: The MA component accounts for the influence of past forecast errors. ARIMA models are widely used for tasks such as financial market analysis, economic forecasting, and various other applications where historical data trends need to be analyzed and future values predicted.

What can it do?

So, the logical question is what can it do?
The most notable and practical application of ARIMA modelling is predicting stock price. As an example, below is an example of my own ARIMA model and its prediction of the likely close prices between October 16, through till October 20th, and the actual close prices which resulted for the ETF SPY :


You can see that ARIMA accurately predicted the confines of our trading range for the week and despite the volatility and whipsaw, we took out the first ARIMA predicted low target on the week, but managed to remain confined within the ARIMA model parameters.

So how can you use this?

I am not sure if you were able to put 2 and 2 together from what I just shared, but if not, that is fine, I will be more obvious in my explanation.

A well tuned and created ARIMA model is generally able to accurately predict the trading ranges and max/min values on most indices. Meaning that, indices are likely to quite reliability remain confined within the ARIMA predicted range (note that I emphasize indices here because the same is not true for regular stocks that respond more dramatically to catalysts and events).

This explains why its a popular go to tool for MMs, because you can effectively use ARIMA to set your confine parameters of max and min ranges, then proceed to sell options outside this range, with the anticipation of the likelihood they are going to expire worthless.

In the example above, the bottom of the weekly ARIMA predicted range was 418. So as the stock tanked, it would have been pretty lucrative to sell a put option with a 418, Friday expiry into the tank, knowing that it was statistically unlikely for SPY to close at or below this level.

What about its use for speculative buyers?

So if you are a speculative buyer like me and most retail, the benefits of ARIMA modelling are more indirect. First of all, it empowers us to know what the MMs are likely anticipating.

Second of all, it helps us to ascertain the likely trading range on the week and can help us determine when we are outside of an anticipated range.

While I don't rely personally on ARIMA trading ranges, because as we see, a well tuned ARIMA model is more likely to show us where we aren't going than where we are going (by accurately predicting the absolute top and bottom for a designated period), I do use it to take advantage of its ability to determine these absolute tops and bottoms for a defined period of time.

Let's take a look at the ARIMA results from Oct 18 - the 22nd, during the FOMC announcements:


While it came close, the range did manage to remain confined to the absolute top and absolute bottom predicted in the ARIMA range.


🎯 Application Tip 🎯

Now that we covered what it can do, let's take a quick second to go over the key concepts for application.

ARIMA Can be used for:

  • Determining the likely absolute top and absolute bottom of a trading range.

  • Can help traders to know when would be more appropriate to get long (i.e. approaching the absolute bottom of the range) and when to get short (approaching the absolute top of the range).

  • Gives traders insight to what MMs are likely considering in their positioning into the week.

  • Helps us determine if we are over-extended, either over or under an anticipated trading range.


How its done?

Alright, time to get into the technical details.

ARIMA is calculated through a series of steps.

Step #1: As explained earlier, differencing is applied to the time series data to make it stationary, removing trends and seasonality.

Step #2: Auto-regression and moving average parameters are determined by analyzing the autocorrelation and partial autocorrelation functions. Once the model order (p, d, q) is established, ARIMA performs a forecast by regressing future values on past observations, incorporating the model's parameters.

Note on Model Order:

Model order simply refers to the selection of appropriate values to determine the p, d, q, order. The p, d, q, refers to:

Certainly! In the context of ARIMA modeling, p, d, and q are key components that define the model's order.

p: Or Auto-Regressive Order. This represents the number of lag terms (past observations) used in the auto-regression component. It reflects the degree of influence of past values on the current one. A higher p means the model considers more past data.

d: Or Integrated Order. This is the differencing component, representing the number of times differencing is applied to make the time series stationary. Differencing removes trends and seasonality from the data.

q: Or Moving Average Order.. This indicates the number of lag terms used in the moving average component, which captures the relationship between past forecast errors and the current observation. A higher q implies that more past errors are considered in the model.

Alright, now that, that's out of the way, the final steps involve:

Choosing appropriate values for p, d, and q involves analyzing the autocorrelation and partial autocorrelation functions of the time series data. These components play a crucial role in shaping the behavior of the ARIMA model and determining its forecasting accuracy.

The values we look at to determine their appropriateness includes the statistical significance (R) value, the R2 value and, sometimes, the effect size value.

After all of that, we then evaluate model's through back-testing and the process may involve iterating and fine-tuning to optimize forecasts for time series data.

Its important to know, advanced Software like R and SPSS (And to a lesser extend, Excel) are capable of sorting the data automatically and will do these steps for you. However, its important that you don't accept the auto parameters without first back-testing and making adjustments accordingly.

Now that we have looked at how it is done, let's look at the key concepts to takeaway below.

🎯Application Tips 🎯

  • ARIMA is calculated by organizing p, d, q.

  • Determining the variables and arrangement of p, d, q is accomplished through the use of the R and R2 value as well as the statistical significance between variables.

  • Most advanced packages, including Excel and SPSS, will auto-fit ARIMA model which is not always sufficient, sometimes some manual tweaking is important. Thus:

  • Once a model is built, it should be back-tested to ensure efficacy and accuracy.


How can it be done?

Basic ARIMA modelling is not as difficult as you expect. It can be done through most statistical software, including:

  • Excel (Paid)
  • SPSS (Paid)
  • SAS (Paid)
  • R (Free)
  • Pinescript (Free)

Additionally, in my own push to create statistics based indicators and bring advanced functions to Pinescript, you can use my own, publically accessible and free indicator in Pinescript, hence why I have added it.

I have used SPSS, R and Excel to do ARIMA, but for brevity I am not going to go over how to do it step by step in this post. You can look at some of my other content or Google these functions based on which software you have access to. But assuming you have access to Pinescript and Tradingview, as you are reading this post, we will quickly go over the Pinescript version I have created.

If we launch that indicator called SPTS (statistical package for the trading sciences, available here) and plot an ARIMA model from our October low till now on SPX, this is what we get:


Now, you will see that the range is a bit different from what perhaps we would expect from Excel or SPSS. The reason being is the way this indicator approaches differencing. If you remember, a way to difference is by using moving averages. Moving averages difference the data by removing elements of seasonality, but it doesn't quite remove the trend completely.

As such, we can expect to "pop out" of the range a bit more frequently then using an ARIMA model on, say, Excel. However, this is helpful to offer us insight into when a may be operating in an "over-extended" state, either to the upside or to the downside.

If you are using SPTS to determine the trading range, here are the preferred settings for ARIMA modelling:


Set the desired variable to close, switch from EMA to SMA and set the forecast to between 50, 100, 150 or 200 bars into the future.

This is a helpful, quick way to plot ARIMA like parameters, though I have to honestly say, nothing beats creating your own, customized ARIMA model in R, Excel or SPSS, or your own Pinescript coded indicator specifically set to your specific ARIMA parameters.

If you are interested in a more in-depth tutorial on how to either use Pinescript to build an ARIMA model or use one of the softwares mentioned above to build an ARIMA model, leave a comment and it can likely be a future idea on here.

Now that we covered how to do it, let's recap the key points from this section.

🎯Application tips: 🎯

  • ARIMA can be accomplished through using Excel, SPSS, R, SAS or Pinescript.

  • If using Pinescript, currently the only indicator I have been able to locate to perform basic ARIMA functionality is my own, that indicator is called SPTS and is listed on the indicator menu but linked above for ease of access.


And that concludes today's lesson on ARIMA modelling!
Hope you enjoyed and leave your questions and comments below!

Take care and safe trades everyone!

Premium indicators and content have launched! Get access at: www.patreon.com/steversteves
כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.