TSF -- Time Series Forecast

 
Is anyone willing to build this indicator for me? I've seen it in other packages and want to make use of it. I've included some basic information below. If you need more info I think I could find some. I could provide the code from another package if that would be helpful.

Time Series Forecast
The Time Series Forecast function displays the statistical trend of a security's price over a specified time period based on linear regression analysis. Instead of a straight linear regression trendline, the Time Series Forecast plots the last point of multiple linear regression trendlines. This is why this indicator may sometimes referred to as the "moving linear regression" indicator or the "regression oscillator."

Because a linear regression line is a straight line as close as possible to all of the given values, a Time Series Forecast does not exhibit as much delay as a Moving Average when adjusting to price changes. This is because the indicator is continuously "fitting" itself to the data rather than simply averaging them. Note that this type of prediction is purely mathematical as it is ultimately the equivalent of drawing a line through the recent points and projecting that line forward.

The Time Series Forecast at the beginning of a data series will not be defined until there are enough values to fill the given period.


Calculation:

The Time Series Forecast is determined by calculating a linear regression trendline using the "least squares fit" method. The least squares fit technique fits a trendline to the data in the chart by minimizing the distance between the data points and the linear regression trendline.

The linear regression formula is:

y = a +bx

Where:

a = (Sig(y) - b(Sig)x) / n

B = (n(Sig(xy) - (Sig(x)) (Sig(y))) / (n(Sig)(x^2) - (Sig(x))^2)

x = The current period

n = The total number of time periods

 
Qman,

Did you find someone to help you with this? If not, I would be interested. The code from another package might be helpful. You can contact me at bwilhiteforex at yahoo dot com.
 
I am not sure if this is what you means. This EA calculates the slope and constant (your b and a) from one time serie against another one through linear regression. I use it to look at GOLD=c1+c2*EURUSD. You have to give the independent varianble (EURUSD in my example) and the number of periods.
Files:
jt-ar-03.mq4  3 kb
 

JosTheelen:
I am not sure if this is what you means. This EA calculates the slope and constant (your b and a) from one time serie against another one through linear regression. I use it to look at GOLD=c1+c2*EURUSD. You have to give the independent varianble (EURUSD in my example) and the number of periods.

Thank you for this code, but i think it is not useful in this case. You may use cointegration and/or corelation together .. first you should find a corelation between two pairs, after that you should find which one independent i meant Causality Analysis..

 
assassin:
Thank you for this code, but i think it is not useful in this case. You may use cointegration and/or corelation together .. first you should find a corelation between two pairs, after that you should find which one independent i meant Causality Analysis..
Why are you dredging up a 6 year old thread . . . and replying to it ? Please do not do this unless you have an exceptional reason, you do not on this occasion.


Thread start date - 2007.01.30