Function : Linear Regression Bands
Used with Pearson Correlation. It can be used to make sense of the trends. Very successful results can be obtained with a MACD style indicator and volume indicator that gives Buy and Sell orders.Open for adaptive and mutable variable periods of moving averages. Best regards!
Linear Regression
Top Cap [aamonkey]Historically matched market tops for BTC.
It's the Average Cap (see my other indicator) multiplied by 35.
The default settings are for BTC.
If you want to test this indicator on another chart you have to change the launch date settings (and maybe play around with the multiplier).
Some Interesting Launch dates:
- BTC: 3 JAN 2009
- ETH: 30. JUL 2015
- LTC: 7. OCT 2011
Linear Regression Trend ChannelThis is my first public release of indicator code and my PSv4.0 version of "Linear Regression Channel", as it is more commonly known. It replicates TV's built-in "Linear Regression" without the distraction of heavy red/blue fill bleeding into other indicators. We can't fill() line.new() at this time in Pine Script anyways. I entitled it Linear Regression Trend Channel, simply because it seems more accurate as a proper description. I nicely packaged this to the size of an ordinary napkin within 20 lines of compact code, simplifying the math to the most efficient script I could devise that fits in your pocket. This is commonly what my dense intricate code looks like behind the veil, and if you are wondering why there is no notes, that's because the notation is in the variable naming. I excluded Pearson correlation because it doesn't seem very useful to me, and it would comprise of additional lines of code I would rather avoid in this public release. Pearson correlation is included in my invite-only advanced version of "Enhanced Linear Regression Trend Channel", where I have taken Linear Regression Channeling to another level of fully featured novel attainability using this original source code.
Features List Includes:
"Period" adjustment
"Deviation(s)" adjustment
"Extend Method" option to extend or not extend the upper, medial, and lower channeling
Showcased in the chart below is my free to use "Enhanced Schaff Trend Cycle Indicator", having a common appeal to TV users frequently. If you do have any questions or comments regarding this indicator, I will consider your inquiries, thoughts, and ideas presented below in the comments section, when time provides it. As always, "Like" it if you simply just like it with a proper thumbs up, and also return to my scripts list occasionally for additional postings. Have a profitable future everyone!
Linear Regression Channel CloneClone of tradingview Linear Regression Channel
Honorable Mentions:
jwammo12 for the Deviation code
ballofpaper for making me write it.
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 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
Colored Linear regression bandI only added color to the script of max007
Especially, when combined with Bollinger Bands, it's a feast to my eyes :)
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.
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.
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
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.
Linear regression % channelThis channel is based on Linear regression by its % difference from the price
the high and the low are determine by the % from the close price . For the best fit you need to put the TF on the same min of the graph.
I put the channel to be 3 % above and bellow the price .by the same way you can add to the script more % line to make it better
this is good indicator for filtering (if you want your signal to be above or bellow the % channel) or if you want to enter at certain price and exit by the regular TV alerts so it more easy where your target for long or short exist
Dorsey InertiaThis indicator was originally developed by Donald Dorsey (Stocks & Commodities, V.13:9 (September, 1995): "Refining the Relative Volatility Index").
Inertia is based on Relative Volatility Index (RVI) smoothed using linear regression.
In physics, inertia is the tendency of an object to resist to acceleration. Dorsey chose this name because he believes that trend and inertia are related and that it takes more effort and energy to reverse the direction of a stock or market than to keep it in the same direction. He argues that the volatility is the simplest and most accurate measure of inertia.
When the indicator is below 50, it signals bearish market sentiment and when the indicator is above 50 it signals a bullish trend.
Good luck!
Kirshenbaum BandsThis indicator was originally developed by Paul Kirshenbaum, a mathematician with a Ph.D. in economics from New York University.
It uses the standard error of linear regression lines of the closing price to determine band width. This has the effect of measuring volatility around the current trend, rather than measuring volatility for changes in trend.
Good luck!
Linear Regression Channel [jwammo12]This is a non-repaint version of the built-in linear regression indicator in pine. It creates moving bands where the current bar matches the built-in Linear Regression indicator exactly (see screenshot). The key to replicating the built-in function is calculating the std deviation across the length of bars away from the current Linear Regression line, as opposed to the linear regression line that would have been calculated at the historic bar.