I just released a neat library for Forecasting stock and equities. In it, it has a couple of novel approaches to forecasting (namely, a Moving Average forecaster and a Z-Score Forecaster). These were accomplished applying basic theories on Autoregression, ARIMA modelling and Z-Score to make new approaches to forecasting.
This is one of the novel approaches, the Z-Score forecaster. How this function works is it identifies the current trend over the duration of the Z-Score assessment period. So, if the Z-Score is being assessed over the previous 75 candles, it will identify the trend over the previous 75 candles. It will then plot out the forecasted levels according to the trend, up to a maximum of the max Z-Score the ticker has reached within its period. At that point, it will show a likely trend reversal.
Here is an example:
This shows that SPY may go to 475.42 before reversing, as 475.42 is the highest z-score that has been achieved in the current trend.
When it is in an uptrend, the forecast line will be green, when in a downtrend, it will be red. The forecasting line is accomplished through pinescript's new polyline feature.
In addition to the line, you can also have the indicator plot out a forecast table. The Z-Score Forecast table was formatted in a similar way to ARIMA, where it makes no bias about trend, it simply plots out both ends of the spectrum. So, if an uptrend were to continue, it will list the various uptrend targets along the way, vice versa for downtrends. It will also display what Z-Score these targets would amount to. Here is an example:
Looking at SPY on the daily, we can see that a likely upside target would be around 484 at just over 2 Standard Deviations (Z-Score). Its not liklely to go higher than that because then we are getting into 3 and 4 standard deviations.
Remember, everything generally should be within 1 and -1 standard deviations of the mean. So if we look at the table, we can see that would be between 466 and 430.
Customization
You can customize the Z-Score length and source. You can also toggle off and on alerts. The alerts will pop up when a ticker is trading at a previous maximum or previous minimum.
I have also added a manual feature to plot the Z-Score SMA, which is simply the SMA over the desired Z-Score lookback time.
And that's the indicator! If you are interested in the library, you can access it here.
Thanks for checking this out and leave your questions below!
진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.