Colorful RegressionColorful Regression is a trend indicator. The most important difference of it from other moving averages and regressions is that it can change color according to the momentum it has. so that users can have an idea about the direction, orientation and speed of the graph at the same time. This indicator contains 5 different colors. Black means extreme downtrend, red means downtrend, yellow means sideways trend, green means uptrend, and white means extremely uptrend. I recommend using it on the one hour chart. You can also use it in different time periods by changing the sensitivity settings.
Regressions
TURK RSI+ICHIMOKUTypical RSI indicators were plotted with candles and expressed wick to resemble a candle chart,
and linear regression was added to predict changes in force intensity,
which allowed us to confirm support and resistance within linear regression .
In addition, divergence signal was marked as an additional basis for the price fluctuation point due to support and resistance .
In other words,
if the diversity signal appears together when the rsi candle is supported and resisted within linear regression ,
this is the basis for predicting that it is a point of change in the existing trend.
Finally, the period value and standard deviation of linear regression can be arbitrarily modified and used.
I hope it will help you with your trading.
--------------------------------------------------------------------------------------------------------------------------------------------------------------
(+ichimoku cloud)
Clouds made of the preceding span 1 and the preceding span 2 of the balance table can predict the trend by displaying the current price balance ahead of the future.
In addition to the role of clouds in the above-described balance sheet , this indicator also shows the cloud band support and resistance of the current RSI value.
TG:- @turk_shariq
Return & Drawdown
ReDraw script calculates the historical returns and drawdown for the given periods.
By default, the return of the linear regression trends is displayed (can be turned off in settings). In this mode, two linear regression trends are being computed for both long and short periods, and the percent value indicates the "return of the trend" for the corresponding period. Observing the dynamic of the linear regression trends can give a great hint if the trend is slowing down.
When the smoothing method is set to "none" or WMA3/5, the real asset return is shown for both periods, using the formula (LastPrice-FirstPrice)/FirstPrice
The script calculates the maximum drawdown for the long period using the formula (max(Price) - LastPrice) / max(Price).
The white line under the zero is the average maximum drawdown over the long period.
When the mode is set to Compare, ReDraw will display the difference in metrics between the current and selected symbol (SPY by default).
Super trend BThis indicator is a mix of 3 well known indicators
the buy point is based on linear regression
the sell points are based on mix of super trend and Bollinger
it try to find best point to sell and buy which are independent from each other
for each time frame you need to try to search for best setting
alerts included
Mocker Market Mean IndicatorThe objective of this indicator is to find the historical mean price of a market ( Intended for Indexes or ETF's). Based off of the concept that Benjamin Graham taught, that Mr. Market is a manic depressive forever oscillating between unjustified pessimism to extreme optimism. The intent of this indicator is to supplement a regular allocation strategy to an index or ETF , to increase that allocation when it's trading below its historical mean and decrease when trading above. It does this by using an exponential regression model to find the closest approximation of the current mean price based on past growth rate, and user defined lookback period.
Relative slopeRelative slope metric
Description:
I was in need to create a simple, naive and elegant metric that was able to tell how strong is the trend in a given rolling window. While abstaining from using more complicated and arguably more precise approaches, I’ve decided to use Linearly Weighted Linear Regression slope for this goal. Outright values are useful, but the problem was that I wasn’t able to use it in comparative analysis, i.e between different assets & different resolutions & different window sizes, because obviously the outputs are scale-variant.
Here is the asset-agnostic, resolution-agnostic and window size agnostic version of the metric.
I made it asset agnostic & resolution agnostic by including spread information to the formula. In our case it's weighted stdev over differenced data (otherwise we contaminate the spread with the trend info). And I made it window size agnostic by adding a non-linear relation of length to the output, so finally it will be aprox in (-1, 1) interval, by taking square root of length, nothing fancy. All these / 2 and * 2 in unexpected places all around the formula help us to return the data to it’s natural scale while keeping the transformations in place.
Peace TV
Trend Line RegressionThis is a fast trend line regressor based on least squares regression.
(1) Supports setting regression from the Nth candle
(2) Supports the minimum and maximum regression candle interval length
(3) Supports finding the optimal regression region based on the length step among the minimum and maximum regression region lengths
(4) Supports displaying the optimal regression level
(5) The size of the regression region is 0.5 times the standard deviation by default
(6) You can filter the trend line by setting minimum trend line regression level
(6) Please properly set the parameters to avoid calculation timeout
Enjoy!
这是一个基于最小二乘法回归的快速趋势线回归
(1) 支持从第N根蜡烛开始设置回归
(2) 支持最小和最大的回归蜡烛区间长度
(3) 支持在最小和最大回归区间长度的基础上寻找最佳回归区域
(4) 支持显示最佳回归水平
(5) 回归区域的大小默认为标准差的0.5倍
(6) 可以通过设置最小趋势线回归等级来过滤趋势线
(6) 请正确设置参数以避免计算超时
使用愉快!
Price Region RegressionThis is an optimized price range regressor based on least squares regression.
(1) Supports setting regression from the Nth candle
(2) Supports the minimum and maximum regression candle interval length
(3) Supports finding the optimal regression region based on the length step among the minimum and maximum regression region lengths
(4) Supports displaying the optimal regression level
(5) The size of the regression region is two times the standard deviation by default
这是一个基于最小二乘回归的价格区间回归指标
(1) 支持设置从第N个蜡烛开始回归
(2) 支持最小和最大回归蜡烛的区间长度
(3) 在最小和最大回归区间长度中,根据长度步进寻找最优的回归区间
(4) 支持显示最优回归等级
(5) 回归区间的大小默认为2倍标准差
StrengthA mathematically elegant, native & modern way how to measure velocity/ strength/ momentum. As you can see it looks like MACD, but !suddenly! has N times shorter code (disregard the functions), and only 1 parameter instead of 3. OMG HOW DID HE DO IT?!?
MACD: "Let's take one filter (1 parameter), than another filter (2 parameters), then let's take dem difference, then let's place another filter over the difference (3rd parameter + introduction of a nested calculation), and let's write a whole book about it, make thousands of multi-hours YouTube videos about it, and let's never mention about the amount of uncertainty being introduced by multiple parameters & introduction of the nested calculation."
Strength: "let's get real, let's drop a weighted linear regression & usual linear regression over the data of the same length, take dem slopes, then make the difference over these slopes, all good. And then share it with people w/o putting an ® sign".
Fyi, regressions were introduced centuries ago, maybe decades idk, the point is long time ago, and computational power enough to calculate what I'm saying is slightly more than required for macd.
Rationale.
Linearly weighted linear regression has steeper slope (W) than the usual linear regression slope (S) due to the fact that the recent datapoints got more weight. This alone is enough of a metric to measure velocity. But still I've recalled macd and decided to make smth like it cuz I knew it'll might make you happy. I realized that S can be used instead of smoothing the W, thus eliminating the nested calculation and keeping entropy & info loss in place. And see, what we get is natural, simple, makes sense and brings flex. I also wanna remind you that by applying regression we maximize the info gain by using all the data in the window, instead of taking difference between the first and the last datapoints.
This script is dedicated to my friend Fabien. Man, you were the light in the darkness in that company. You'll get your alien green Lambo if you'll really want it, no doubts on my side bout that.
Good hunting
End Point Moving Average [EPMA]The End Point Moving Average was introduced in the October 95 issue of Technical Analysis of Stocks &
Commodities in the article "The End Point Moving Average", by Patrick E. Lafferty.
The Time Series Forecast takes this value and the slope of the regression line to forecast the next day and then plots this forecasted price as today's value.
For interpretation refer to Mr. Lafferty's article.
Please note
From line 10 starts my personal experemental modifications to this script, all above is original formula by Patrick E. Lafferty.
Bitcoin Best Value CorridorHere is my interpretation of the "Best Time To Buy" Bitcoin over its lifetime using a logarithmic regression trendline. The upper and lower lines are 10% deviations from the centre line. I calculated the trendline in excel and then coded my results into pine script.
Bitcoin Power Law Bands (BTC Power Law) Indicator█ OVERVIEW
The 'Bitcoin Power Law Bands' indicator is a set of three US dollar price trendlines and two price bands for bitcoin , indicating overall long-term trend, support and resistance levels as well as oversold and overbought conditions. The magnitude and growth of the middle (Center) line is determined by double logarithmic (log-log) regression on the entire USD price history of bitcoin . The upper (Resistance) and lower (Support) lines follow the same trajectory but multiplied by respective (fixed) factors. These two lines indicate levels where the price of bitcoin is expected to meet strong long-term resistance or receive strong long-term support. The two bands between the three lines are price levels where bitcoin may be considered overbought or oversold.
All parameters and visuals may be customized by the user as needed.
█ CONCEPTS
Long-term models
Long-term price models have many challenges, the most significant of which is getting the growth curve right overall. No one can predict how a certain market, asset class, or financial instrument will unfold over several decades. In the case of bitcoin , price history is very limited and extremely volatile, and this further complicates the situation. Fortunately for us, a few smart people already had some bright ideas that seem to have stood the test of time.
Power law
The so-called power law is the only long-term bitcoin price model that has a chance of survival for the years ahead. The idea behind the power law is very simple: over time, the rapid (exponential) initial growth cannot possibly be sustained (see The seduction of the exponential curve for a fun take on this). Year-on-year returns, therefore, must decrease over time, which leads us to the concept of diminishing returns and the power law. In this context, the power law translates to linear growth on a chart with both its axes scaled logarithmically. This is called the log-log chart (as opposed to the semilog chart you see above, on which only one of the axes - price - is logarithmic).
Log-log regression
When both price and time are scaled logarithmically, the power law leads to a linear relationship between them. This in turn allows us to apply linear regression techniques, which will find the best-fitting straight line to the data points in question. The result of performing this log-log regression (i.e. linear regression on a log-log scaled dataset) is two parameters: slope (m) and intercept (b). These parameters fully describe the relationship between price and time as follows: log(P) = m * log(T) + b, where P is price and T is time. Price is measured in US dollars , and Time is counted as the number of days elapsed since bitcoin 's genesis block.
DPC model
The final piece of our puzzle is the Dynamic Power Cycle (DPC) price model of bitcoin . DPC is a long-term cyclic model that uses the power law as its foundation, to which a periodic component stemming from the block subsidy halving cycle is applied dynamically. The regression parameters of this model are re-calculated daily to ensure longevity. For the 'Bitcoin Power Law Bands' indicator, the slope and intercept parameters were calculated on publication date (March 6, 2022). The slope of the Resistance Line is the same as that of the Center Line; its intercept was determined by fitting the line onto the Nov 2021 cycle peak. The slope of the Support Line is the same as that of the Center Line; its intercept was determined by fitting the line onto the Dec 2018 trough of the previous cycle. Please see the Limitations section below on the implications of a static model.
█ FEATURES
Inputs
• Parameters
• Center Intercept (b) and Slope (m): These log-log regression parameters control the behavior of the grey line in the middle
• Resistance Intercept (b) and Slope (m): These log-log regression parameters control the behavior of the red line at the top
• Support Intercept (b) and Slope (m): These log-log regression parameters control the behavior of the green line at the bottom
• Controls
• Plot Line Fill: N/A
• Plot Opportunity Label: Controls the display of current price level relative to the Center, Resistance and Support Lines
Style
• Visuals
• Center: Control, color, opacity, thickness, price line control and line style of the Center Line
• Resistance: Control, color, opacity, thickness, price line control and line style of the Resistance Line
• Support: Control, color, opacity, thickness, price line control and line style of the Support Line
• Plots Background: Control, color and opacity of the Upper Band
• Plots Background: Control, color and opacity of the Lower Band
• Labels: N/A
• Output
• Labels on price scale: Controls the display of current Center, Resistance and Support Line values on the price scale
• Values in status line: Controls the display of current Center, Resistance and Support Line values in the indicator's status line
█ HOW TO USE
The indicator includes three price lines:
• The grey Center Line in the middle shows the overall long-term bitcoin USD price trend
• The red Resistance Line at the top is an indication of where the bitcoin USD price is expected to meet strong long-term resistance
• The green Support Line at the bottom is an indication of where the bitcoin USD price is expected to receive strong long-term support
These lines envelope two price bands:
• The red Upper Band between the Center and Resistance Lines is an area where bitcoin is considered overbought (i.e. too expensive)
• The green Lower Band between the Support and Center Lines is an area where bitcoin is considered oversold (i.e. too cheap)
The power law model assumes that the price of bitcoin will fluctuate around the Center Line, by meeting resistance at the Resistance Line and finding support at the Support Line. When the current price is well below the Center Line (i.e. well into the green Lower Band), bitcoin is considered too cheap (oversold). When the current price is well above the Center Line (i.e. well into the red Upper Band), bitcoin is considered too expensive (overbought). This idea alone is not sufficient for profitable trading, but, when combined with other factors, it could guide the user's decision-making process in the right direction.
█ LIMITATIONS
The indicator is based on a static model, and for this reason it will gradually lose its usefulness. The Center Line is the most durable of the three lines since the long-term growth trend of bitcoin seems to deviate little from the power law. However, how far price extends above and below this line will change with every halving cycle (as can be seen for past cycles). Periodic updates will be needed to keep the indicator relevant. The user is invited to adjust the slope and intercept parameters manually between two updates of the indicator.
█ RAMBLINGS
The 'Bitcoin Power Law Bands' indicator is a useful tool for users wishing to place bitcoin in a macro context. As described above, the price level relative to the three lines is a rough indication of whether bitcoin is over- or undervalued. Users wishing to gain more insight into bitcoin price trends may follow the author's periodic updates of the DPC model (contact information below).
█ NOTES
The author regularly posts on Twitter using the @DeFi_initiate handle.
█ THANKS
Many thanks to the following individuals, who - one way or another - made the 'Bitcoin Power Law Bands' indicator possible:
• TradingView user 'capriole_charles', whose open-source 'Bitcoin Power Law Corridor' script was the basis for this indicator
• Harold Christopher Burger, whose Bitcoin’s natural long-term power-law corridor of growth article (2019) was the basis for the 'Bitcoin Power Law Corridor' script
• Bitcoin Forum user "Trololo", who posted the original power law model at Logarithmic (non-linear) regression - Bitcoin estimated value (2014)
MM Chop Filter Range BoxesMatch with the MM Chop Filter
This draw Non repainting range boxes when the oscillator see a range.
-Breakout Buy/Sell Signals and Exit signals when prices enters a range just in case you did get into a trade. .
-Alarms to match the signals
How to use
Match with the oscillator and always trade the trend with your strategy confirmation and the breakout this indicator provides
Weighted Least Squares Moving AverageLinearly Weighted Ordinary Least Squares Moving Regression
aka Weighted Least Squares Moving Average -> WLSMA
^^ called it this way just to for... damn, forgot the word
Totally pwns LSMA for some purposes here's why (just look up):
- 'realistically' the same smoothness;
- less lag;
- less overshoot;
- more or less same computationally intensive.
"Pretty cool, huh?", Bucky Roberts©, thenewboston
Now, would you please (just look down) and see the comparison of impulse & step responses:
Impulse responses
Step responses
Ain't it beautiful?
"Motivation behind the concept & rationale", by gorx1
Many been trippin' applying stats methods that require normally distributed data to time series, hence all these B*ll**** Bands and stuff don't really work as it should, while people blame themselves and buy snake oil seminars bout trading psychology, instead of using proper tools. Price... Neither population nor the samples are neither normally nor log-normally distributed. So we can't use all the stuff if we wanna get better results. I'm not talking bout passing each rolling window to a stat test in order to get the proper descriptor, that's the whole different story.
Instead we can leverage the fact that our data is time-series hence we can apply linear weighting, basically we extract another info component from the data and use it to get better results. Volume, range weighting don't make much sense (saying that based on both common sense and test results). Tick count per bar, that would be nice tho... this is the way to measure "intensity". But we don't have it on TV unfortunately.
Anyways, I'm both unhappy that no1 dropped it before me during all these years so I gotta do it myself, and happy that I can give smth cool to every1
Here is it, for you.
P.S.: the script contains standalone functions to calculate linearly weighted variance, linearly weighted standard deviation, linearly weighted covariance and linearly weighted correlation.
Good hunting
[RS]Long Term Price Range Analysis (MML)Study on Price range Regression and range (deviation multiplier needs to be accommodate manually to fit price action)
study was made for time frames above weekly
[RS]Linear Regression Bands V1experiment with linear regression, the purpose was to catch break outs early, but it creates to much visual noise
same as version 0 but with added margin filter and signal to mark entrys