Forecasting is a blurry science that deal with lot of uncertainty. Most of the time forecasting is made with the assumption that past values can be used to forecast a time series, the accuracy of the forecast depend on the type of time series, the pre-processing applied to it, the forecast model and the parameters of the model.
In tradingview we don't have much forecasting models appart from the which is definitely not adapted to forecast financial markets, instead we mainly use it as indicator. So i wanted to try making a forecasting tool based on the that might provide something at least interesting, i hope you find an use to it.
Remember that the regression model and the are closely related, both share the same equation ax + b but the will use running parameters while a and b are constants in a , the last point of the of period p is the last point of the that fit a line to the price at time p to 1, try to add a with count = 100 and an of length = 100 and you will see, this is why the is also called "end point moving average".
The forecast of the is the linear extrapolation of the fitted line, however the proposed indicator forecast is the linear extrapolation between the value of the at time length and the last value of the when short term extrapolation is false, when short term extrapolation is checked the forecast is the linear extrapolation between the value prior to the last point and the last value.
long term extrapolation, length = 1000
short term extrapolation, length = 1000
How To Use
Intervals are create from the running mean absolute error between the price and the . Those intervals can be interpreted as possible levels when using long term extrapolation, make sure that the intervals have been priorly tested, this mean the intervals are more significants.
The short term extrapolation is made with the assumption that the price will follow the last two points direction, the forecast tend to become inaccurate during a trend change or when noise affect heavily the .
You can test both method accuracy with the replay mode.
Comparison With The Linear Regression
Both methods share similitudes, but they have different results, lets compare them.
In blue the indicator and in red a of both period 200, the is always extremely conservative since she fit a line using the least squares method, at the contrary the indicator is less conservative which can be an advantage as well as a problem.
Linear models are good when what we want to forecast is approximately linear, thats not the case with market price and this is why other methods are used. But the use of the to provide a forecast is still an interesting method that might require further studies.
Thanks for reading !
Become a Patreon and get access to exclusive technical indicators!
You can also check out some of the indicators I made for luxalgo : https://www.tradingview.com/u/LuxAlgo/#published-scripts
Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.