Time Series ForecastIntroduction
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 linear regression which is definitely not adapted to forecast financial markets, instead we mainly use it as support/resistance indicator. So i wanted to try making a forecasting tool based on the lsma that might provide something at least interesting, i hope you find an use to it.
The Method
Remember that the regression model and the lsma are closely related, both share the same equation ax + b but the lsma will use running parameters while a and b are constants in a linear regression, the last point of the lsma of period p is the last point of the linear regression that fit a line to the price at time p to 1, try to add a linear regression with count = 100 and an lsma of length = 100 and you will see, this is why the lsma is also called "end point moving average".
The forecast of the linear regression is the linear extrapolation of the fitted line, however the proposed indicator forecast is the linear extrapolation between the value of the lsma at time length and the last value of the lsma when short term extrapolation is false, when short term extrapolation is checked the forecast is the linear extrapolation between the lsma value prior to the last point and the last lsma 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 lsma. Those intervals can be interpreted as possible support and resistance 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 lsma points direction, the forecast tend to become inaccurate during a trend change or when noise affect heavily the lsma.
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 linear regression of both period 200, the linear regression 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.
Conclusion
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 lsma to provide a forecast is still an interesting method that might require further studies.
Thanks for reading !
רגרסיה ליניארית
[RD] LCS - line channels (basic) v3 - [republish]==================================================================
July 18 2019 - LCS - line channels (basic) by RootDuk
Version : v3 - read the notes
==================================================================
Easy script to draw channels based on ie. GANN using the following
input params
- ibback : barsback to search for high and low
- ffactor : factor to up/downscale the lines
- oextend : extend lines, left, right, both, none
- bshowline : show horizontal lines yes/no
- bsshowdown : show diag down lines yes/no
- bsshowup : show diag up lines yes/no
- bshowindm : show index marker, where is you current ibback
===================================================================
Notes
===================================================================
When you use this code, pls let me know where and how you used it
as iam always curious what some can do with it. Thanks!
===================================================================
Updates
===================================================================
v1
v2 - July 17 2019
- Removed support wallets from source code. I think the source
- has been deleted because of this, find no other clue.
v3 - July 18 2019
- Republish
Linear Regression Channel with AlertNote: I use Google Translate.
Added alert function to "Linear regression" of built-in indicator.
I use Pine script version 4.
The basic behavior is the same as the built-in indicator,
The following points are different.
1. Fills between line objects are only lines because they do not correspond in Version 4.
2. The "Use Deviation" switch can not be reproduced, so it is displayed or hidden.
3. Line color and line width can not be changed.
4. You can use 3 types of alerts: "upper and lower channel line", "center line" and "all lines".
I get a warning of repainting, but I think there is no problem.
Please contact me if there is something wrong.
内臓インジケーターの「線形回帰」にアラート機能を追加しました。
Pineスクリプト Version4を使用しています。
基本的な挙動は内臓インジケーターと変わりませんが、
以下の点が異なります。
1.ラインオブジェクト間の塗りつぶしは、Version4で対応していないようなので線のみです。
2.「偏差を使う」の切り替えは再現できていないので、表示か非表示かになっています。
3.線色、線の太さの変更はできません。
4.「上下のチャネルライン」、「センターライン」、「すべてのライン」の3種類のアラートを使うことができます。
リペイントのWarningが出ますが、特に問題ないと思います。
何か問題があればご連絡ください。
linear and Bollingers Bands and Fibonacci ratios This model give us the following
1 .linear regression channel
2.dynamic upper and lower fibs
3. upper and lower bollinger bands
each specific to the time frame that you use
So by using all 3 in one indicator it easy to see ressistance and support level
Session AverageThis indicator finds the average time of High or Low formed in sessions.
This is a request from trader @Salmanmahmood15 . You need permission from him to fully use it
Slices of Bitcoin
A very simple indicator that shows how many times a currency fits into Bitcoin. In other words, the higher the value, the weaker the currency against Bitcoin.
You can easily see that since the beginning of 2019 Stellar Lumen (XLM) lost half of its BTC-value while the USD-value was constant.
[AU] Fibonacci Fractal Regression ChannelFibonacci Fractal Regression Channel v01
Based upon:
Fractal Regression Channel V0 () by @RicardoSantos
Note: For use on 4H charts and lower intervals/timeframes
Fractal Regression Channel V0.1Port of @RicardoSantos' Fractal Regression Channel V0 from pinescript 2 to pinescript 3.
// Source:
// Original Author: @RicardoSantos
BB Forecast PrototypeExperiment to try apply @atrader2's MA Forecast () to bollinger bands - didn't exactly work out how I expected it to, especially with the Upper/Lower forecast projections.
Sniper & Strategy SniperTrading permite detectar los momentos exactos de compra y venta obteniendo un buen rendimiento.
Como aplicarlo:
* Realice una compra cuando el indicador de COMPRA aparezca en la pantalla.
* Realice una venta cuando el indicador de VENTA aparezca en la pantalla.
linear regression channelThe linear regression indicator is used for trend identification and trend following in a similar fashion to moving averages.
Best time frames to use the indicator: H1/H4
DepthHouse - Peak DivergenceDepthHouse - Peak Divergence indicator uses the same linear regression calculation as my Peak Momentum Oscillator to help determine and plot peak momentum points.
These peak levels are then plotted by either red or green lines above or below the candle.
Red lines represent a peak in bear momentum while green represents peaks in bull momentum.
These levels are then used to determine momentum divergence in the displayed market.
If divergence is present the bars colors will change represent either bull or bear div.
Important Notes:
If the price crosses a peak line and the bar color does not change; it means momentum has increased/decreased with the price and the divergence has been canceled.
If divergence is present, and then the following candle is not colored then momentum has increased to cancel the previously present divergence.
By default, the look-back period is set to zero , which automatically calculates the distance for the peak levels to look-back. However this number can be set to whatever look-back period you would like.
At time of release this indicator is in its early stages. So please leave feedback on how it can be improved!
B3 MTF OHLCMy idea by using Linear regression and some other filters. Great results without repaint :)
Linear regressionThis is my idea by using Linear regression and some other filters. Great result without repaint :)
MACD SlopeShows slopes of macd line, signal line and histogram. A negative and rising slope shows improvement within a downtrend. A positive and falling slope shows deterioration within an uptrend.
Linear regression slope as SARThis model calculate the slope of the linear regression and give you the uptrend or the down trend of the slope
red line are downtrend and green line are up trend
using len 1 you can make it longer or shorter (I put it on length of 40 but you can change that to what ever you want )
Similar to SAR it can give us the trends of buy and sell only by doing it by the linear way
try longer length to see if it smooth the signal
4 hour graph
TH_HMA+ HistogramHistogram version of HMA+. This Centered Oscillator show more accurately when trends are reversing thanks to the U-shape reversals and clouds switching Red/Green. Fast MA getting above/under the base implies a establish Bullish/Bearish bias.
There is a flagging circles that will be visible depending how price is under or above the Fast MA which can also provide early indication of trend direction.
Linear Regression (Backtest / Trailing Stop)A Strategy with Backtest and Trailing Stop for Long/Short
Credits: Study by RafaelZioni - Thanks buddy!
linear regression newSo this is new attempt to plot linear regression ,
I hope TV will make it free so we will not need to break our heads on this important indicator
Back - Front Futures Spread 4hr IndicatorThis puts a normalized back - front spread based on the close price.