OPEN-SOURCE SCRIPT

Autoregressive Cloud

Hello,

I am releasing this indicator called the Autoregressive Cloud Indicator.

What it does:

The indicator performs an autoregression analysis on 3 price variables of a ticker, those being the High, the Low and the Close. It uses a 1-lag system and looks back at the previous close, high and low’s effect on the proceeding high, low and close. It then plots out the anticipated range for the ticker based on the autoregression analysis, as well as displays the lag-correlation (autocorrelation) in a table.

What is Autoregression analysis?

Autoregression is a modelling technique used to describe a time series based on its own past values. It assumes that the current value of a variable is a linear combination of its previous values and a random error term.

And what is autocorrelation?

Autocorrelation measures the correlation between a time series and its lagged values. It quantifies the degree to which the current value of a series is related to its past values at different lags, indicating any patterns or dependencies in the data over time. Autoregression and autocorrelation are closely related concepts used to analyze and model time series data.

So how does it work?

The indicator calculates autoregressive values for the close, high, and low prices of a security based on the specified lookback length (which is defaulted to 50). It then plots three sets of clouds representing the smoothed autoregressive values for each price component (done using the SMA function). The transparency of the clouds can be adjusted using the "Transparency" input. Additionally, the code includes a correlation table that displays the correlation coefficients between the lagged values of the close, high, and low prices. The table's position can be customized using the "Position" input.

The indicator defaults to the chart timeframe; however, you can manually adjust the indicator to display the range for whatever timeframe you would like. You can view the 30 minute, 15 or even hourly range on the 1 minute or 5 minute chart if you want.

The indicator will show the anticipated “true trading range” of the stock based on the autoregression and autocorrelation of all 3 variables:

Snapshot

Above is SPY on the 5 minute timeframe with 15 minute levels overlayed. Here, you can see the anticipated trading range for that 15 minute time period.

Using the Correlation Table:

The correlation table displays the Pearson Coefficient for all 3 autoregressions.

A positive correlation: A positive autocorrelation indicates a positive relationship between past and current values of a time series variable. It suggests that when the variable has a high value at a certain time, it is more likely to have a high value in the future, and when it has a low value, it is more likely to have a low value in the future. This positive autocorrelation can imply persistence or trend in the data, indicating that past values can provide useful information for predicting future values. The rule of thumb is anything over 0.5 is considered significant.

A positive correlation among all 3 variables also indicates an uptrend. If you see a strong positive (i.e. the values are all greater than 0.8), it indicates an incredibly decisive and strong uptrend.

A negative correlation: A negative autocorrelation indicates an inverse relationship between past and current values of a time series variable. It suggests that when the variable has a high value at a certain time, it is more likely to have a low value in the future, and vice versa. This negative autocorrelation can imply mean reversion or oscillatory behavior in the data, where extreme values tend to be followed by values closer to the average. It indicates that past values can provide useful information for predicting future values by anticipating a reversal in the direction of the variable. The rule of thumb is anything below or equal to -0.5 is considered significant.
A negative correlation among all 3 variables also indicates a downtrend. If you see a strong negative (i.e. the values are all less than or equal to -0.8), it indicates an incredibly decisive and strong downtrend.

Uses of the Indicator:

The indicator can be used for the following functions:
1. Day trading and scalping within an expected range;
2. Determining the strength or weakness of an uptrend or downtrend on various timeframes;
3. Determining the relationship between previous values and past performance and its effect on future performance;
4. Can alert to changes in trend direction in advance (you may see high, low or close turn negative before others, signifying that weakness is beginning to materialize in an uptrend, or inverse in a downtrend (value changes positive)).

Customizability:

SMA: The autoregression data is smoothed by a 3 period lookback. You can change this if you want, but in order for the indicator to present the true trading range, it is recommended to leave it at <= 3.

Lookback Length: This is the length of the lookback period for the autoregression and autocorrelation functions.

Transparency settings: You can adjust the transparency of the clouds manually.

Timeframe: You can adjust the timeframe, as explained above, to display the timeframe of interest. When you adjust the timeframe, the data will all reflect that timeframe and not necessarily the current TF you have open (i.e. you select 30 minutes while viewing it on the 5 minute, it will show the data for the 30 minute TF period).

Video Tutorial:

I have prepared a video outlining the indicator and also explaining the theory of autoregression/correlation. You can find it below:


Let me know any comments, questions or suggestions below.

Thank you for taking the time to read/watch and check out this indicator.

Safe trades everyone!


statisticsTrend Analysis

Open-source Skript

Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun das Script auch andere Trader verstehen und prüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden. Die Nutzung dieses Codes in einer Veröffentlichung wird in unseren Hausregeln reguliert. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Möchten Sie dieses Skript auf einem Chart verwenden?


For real-time updates and premium indicators, consider joining my group at: patreon.com/steversteves
Auch am:

Haftungsausschluss