Forecasting - Simple Mean MethodThis is a continuation of my series on forecasting techniques. The idea behind the Simple Mean method is to somehow extend historical mean to the future. In this case a forecast equals to last value plus average change.
Forecasting
Forecasting - Locally Weighted Regression (rescaled)UPDATE: the original version works only with BTC. Here's a general version with rescaling.
Forecasting - Vanilla Locally Weighted RegressionThere is not much to say - just vanilla locally weighted regression in PineScript 4.
see: medium.com
also: cs229.stanford.edu
Forecasting - Holt’s Linear Trend ForecastingHolt's Forecasting method
Holt (1957) extended simple exponential smoothing to allow the forecasting of data with a trend. This method involves a forecast equation and two smoothing equations (one for the level and one for the trend):
Forecast equation: ŷ = l + h * b
Level equation: l = alpha * y + (1 - alpha) * (l + b)
Trend equation: b = beta * (l - l) + (1 - beta) * b
where:
l (or l) denotes an estimate of the level of the series at time t,
b (or b) denotes an estimate of the trend (slope) of the series at time t,
alpha is the smoothing parameter for the level, 0 ≤ alpha ≤ 1, and
beta is the smoothing parameter for the trend, 0 ≤ beta ≤ 1.
As with simple exponential smoothing, the level equation here shows that l is a weighted average of observation y and the one-step-ahead training forecast for time t, here given by l+b. The trend equation shows that b is a weighted average of the estimated trend at time t based on l-l and b, the previous estimate of the trend.
The forecast function is not flat but trending. The h-step-ahead forecast is equal to the last estimated level plus h times the last estimated trend value. Hence the forecasts are a linear function of h.
Stationary Extrapolated Levels OscillatorIntroduction
The oscillator version of the stationary extrapolated levels indicator. The methodology behind the extrapolated levels where to minimize the risk of making a decision based only on a forecast, therefore the indicator plotted levels in order to determine possible reversal points, signals where generated when the detrended series crossed over/under those levels.
The Indicator
First we detrend the price, this is because forecasting the trend is often harder than a series without trend (stationarity > non-stationarity) , then we forecast the detrended price with a linear extrapolation over a period of length and apply a max/min filter twice to the forecast, the max/min filters are just the highest and lowest function in pine. So the max/min filter have lag length/2 , by applying it two times we have a lag of length which is the period of the forecast. Because we use highest and lowest we can apply min-max normalization in the form of :
x' = (x - min(x, min'))/(max(x,max') - min(x, min'))
where x is the detrended price, max' the highest of the forecast of x and min' the lowest of the forecast of x . This result in a scaled oscillator in a range of (1,0),
When the indicator is equal to 1 or 0 there are high chances of reversals, more in depth this mean that the detrended price have crossed the highest/lowest of the forecast, when the indicator is equal to 0 or 1 for a long time this mean that the forecast was quite inaccurate, you can minimize risk by focusing on the cross between the detrended price and the 0.8/0.2 levels.
Conclusion
I've shown an oscillator version of my previous "Stationary extrapolated levels" indicator, the method involving taking the highest and lowest of the forecast is a great way to minimize the risk involved by time-series forecasting driven decisions. So i hope you find an use to it.
Thanks for reading !
EW Correction on choppiness with CB Composite index [yoxxx]Sometimes it is more than convenient to differ fast from a genuine high or
a B in an expanded flat (a very impulsive counter within a correction, resulting in an higher high than the genuine.)
I tried to use the typical choppiness of Bs in general to indicate them (orange box in example).
Therefore i used a momentum of close, relative to the bar's heights (=vola).
I turned out, that it works like charme to show ALL correction phases in a trend cycle. (And hence the impulses as well.)
(Credit:The choppiness of the Bs is a hint of Constance Brown, which i adopted. Bow to her.)
Note1: I tested it on all Timeframes, but mainly on D; and only in bull markets.
Note 2: I added the composite index of Constance Brown which is faster than the rsi and - special skill -
can inidcate divergences to prices where rsi fails. Use it as a hint for choppiness changes to come.
Since its strength lies in being not normalized, sometimes you may adjust the composite for fitiing it to the EW bars.I inserted a line for that in the script.
Feedback welcome!
yoxxx
Alpha-Sutte ModelThe Alpha-Sutte model is an ongoing project run by Ansari Saleh Ahmar, a lecturer and researcher at Universitas Negeri Makassar in Indonesia, that attempts to make forecasts for time series like how Arima and Holt-Winters models do. Currently Ahmar and his team have conducted research and published papers comparing the efficacy of the Alpha-Sutte and other models, such as Arima and Holt-Winters, on topics ranging from forecasting Turkey's CPI data, Bitcoin prices, Apple's stock prices, primary energy supply of Indonesia, to infant mortality rates in China.
The Alpha-Sutte model in comparison to the other two models listed above shows promise in providing a more accurate forecast, and the project has been able to receive some of its funding from organizations such as the US Agency for International Development, which is a part of the US Federal Government, so maybe the project has some actual merit.
How it works:
In this model there are four values presented at the top of the window.
1) The first value in blue is the value of the Alpha-Sutte model whose purpose is to forecast the price of the current bar.
2) The second value in yellow is an adaptive version of the Alpha-Sutte model that I made. The purpose of the adaptive Alpha-Sutte model is to expand upon the Alpha-Sutte by allowing new information to be introduced, causing the value to change during the current period, hence the adaptiveness of it.
3) The third value in aqua is the moving average of the low% Sutte line which is a predictive line that is based off of the close and low of the current and previous periods.
4) The fourth value in red is the moving average of the high% Sutte line which is a predictive line that is based off of the close and high of the current and previous periods.
Trend signals:
If low% Sutte (aqua value/line) is greater than high% Sutte (red value/line) then this is a buy signal.
If high% Sutte (red value/line) is greater than low% Sutte (aqua value/line) then this is a sell signal.
Caveat:
Even though this model's purpose is to forecast the future, will it be able to predict periods of large movements? No, of course not, but it will adjust quickly to try to make more accurate forecasts for the next period. This was also a reason why I made an adaptive version of this model to try to reduce some of the discrepancies between the Alpha Sutte and price when there is a large unexpected move.
*WARNING before using this I would highly recommend that you look up "Sutte Indicator" online and read some of the papers about this model before you use this , even though this model has shown merit when compared to Arima and Holt-Winter models this is still an ongoing project.*
Hopefully this project will actually come to something in the near future as the calculation for this time series predictive model is much easier to calculate and program in pine editor than something like an Arima model.
*Also, if you know how to use R language there is a package for the "Alpha-Sutte model".*
Meister Shredder - Simple Moving Averages x4 ForecastIncludes the 21, 50, 100 and 200 SMA and 6 bar forecast
Linear ExtrapolationBasic extrapolator for forecast a time-series, all forecasts are mades length periods ahead.
This is not a estimation of the exact price
This should only be used for forecasting direction, dont expect the price to be at the same value of its forecast.
Bias, Mean absolute error, Mean percentage error...etc look useless here, its better to use correlation as a accuracy measurement.
Correlation(Forecast ,close,period)
Rescaling for a better forecast ?
Transforming a non-stationary signal to a stationary signal can increase the forecasting accuracy, this can be done by detrending. Here is a list of somes detrending methods:
Auto-Bias : price - price
Mean-Bias : price - price moving average
Log transform : log(price/price moving average)
Correlation : correlation(price,n,period)
[RS]Fractal MA V0EXPERIMENTAL: concept for fractal ma. can be used as zigzag as is, intended for hidden S&R extraction(kinda failed :p ).