TradingView
Steversteves
1 янв 2024 г., 20:37

Z-Score Forecaster[SS] 

SPDR S&P 500 ETF TRUSTArca

Описание

Hello everyone,

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!
Комментарии
supruzr
I think this indicator might have great potential. First thank you for publishing this. I did a small backtest on ES with good results. The problem I have is I can't set an alert in tradingview to notify me when the forecast is "green" bullish, or "red" bearish. Is there any way to accomplish this. Thanks so much.
vnet24
Wish to express my sincere appreciation for your work. You are truly impressive and it made a significant impact on our trading outcome. Thanks again for everything. Your contribution is invaluable and I am grateful to have you on this platform.
Joco_Gorenc
You never cease to impress. I don't trade individual stocks, but sometimes I do indices however I mostly do FX and gold. Are most of your work primarily designed for equities?
Steversteves
@Joco_Gorenc, Thank you! And most are interchangeable with all types of instruments :-)/ Actually all are, aside from the ones that specify its for a specific stock.
Joco_Gorenc
@Steversteves, What I'd like to see would be some extra digits for FX pairs, for example a Bullish POC will display as 0.67 to 0.67 on your latest volume indicator! So no calculation of lower digits(pips). Sure that would be a quick fix :)
Mr_Clark_SD
Very interesting. Wild that all the shorter time frames are pointing up on Spy, but the 1D looks like a sizable pullback.
d.umesh
Hello sir, Thnx for New indicator. One Request from my side is plz Give option for font size in Table so can adjust in mobile view.
Thnx
Ещё