Computing The Linear Regression Using The WMA And SMAPlot a linear regression channel through the last length closing prices, with the possibility to use another source as input. The line is fit by using linear combinations between the WMA and SMA thus providing both an interesting and efficient method. The results are the same as the one provided by the built-in linear regression, only the computation differ.
Settings
length : Number of inputs to be used.
src : Source input of the indicator.
mult : Multiplication factor for the RMSE, determine the distance between the upper and lower level.
Usage
In technical analysis a linear regression can provide an estimate of the underlying trend in the price, this result can be extrapolated to have an estimate of the future evolution of the trend, while the upper and lower level can be used as support and resistance levels.
The slope of the fitted line indicates both the direction and strength of the trend, with a positive slope indicating an up-trending market while a negative slope indicates a down-trending market, a steeper line indicates a stronger trend.
We can see that the trend of the S&P500 in this chart is approximately linear, the upper and lower levels were previously tested and might return accurate support and resistance points in the future.
By using a linear regression we are making the following assumptions:
The trend is linear or approximately linear.
The cycle component has an approximately constant amplitude (this allows the upper and lower level to be more effective)
The underlying trend will have the same evolution in the future
In the case where the growth of a trend is non-linear, we can use a logarithmic scale to have a linear representation of the trend.
Details
In a simple linear regression, we want to the slope and intercept parameters that minimize the sum of squared residuals between the data points and the fitted line
intercept + x*slope
Both the intercept and slope have a simple solution, you can find both in the calculations of the lsma, in fact, the last point of the lsma with period length is equal to the last point of a linear regression fitted through the same length data points. We have seen many times that the lsma is an FIR filter with a series of coefficients representing a linearly decaying function with the last coefficients having a negative value, as such we can calculate the lsma more easily by using a linear combination between a WMA and SMA: 3WMA - 2SMA , this linear combination gives us the last point of our linear regression, denoted point B .
Now we need the first point of our linear regression, by using the calculations of the lsma we get this point by using:
intercept + (x-length+1)*slope
If we get the impulse response of such lsma we get
In blue the impulse response of a standard lsma, in red the impulse response of the lsma using the previous calculation, we can see that both are the same with the exception that the red one appears as being time inverted, the first coefficients are negative values and as such we also have a linear operation involving the WMA and SMA but with inverted terms and different coefficients, therefore the first point of our linear regression, denoted point A , is given by 4SMA - 3WMA , we then only need to join these two points thanks to "line.new".
The levels are simply equal to the fitted line plus/minus the root mean squared error between the fitted line and the data points, right now we only have two points, we need to find all the points of the fitted line, as such we first need to find the slope, which can be calculated by diving the vertical distance between B and A (the rise) with the horizontal distance between B and A (the run), that is
(A - B)/(length-1)
Once done we can find each point of our line by using
B + slope*i
where i is the position of the point starting from B, i=0 give B since B + slope*0 = B , then we continue for every i , we then only need to sum the squared distance between each closing prices at position i and the point found at that same position, we divide by length-1 and take the square root of the result in order to have the RMSE.
In Summary
The following post as shown that it was possible to compute a linear regression by using a linear combination between the WMA and SMA, since both had extremely efficient computations (see link at the end of the post) we could have a calculation for the linear regression where the number of operations is independent of length .
This post took me eons to make because it's related to the lsma, and I am rarely short on words when it comes to anything related to the lsma. Thx to LucF for the feedback and everything.
Trend
HTF Candlestick Patterns [TradingView] vX by DGTCandlesticks are graphical representations of price movements for a given period of time. They are commonly formed by the opening, high, low, and closing prices of a financial instrument. They have their origins in the centuries-old Japanese rice trade and have made their way into modern day price charting.
It’s important to note that candlestick patterns aren’t necessarily a buy or sell signal by themselves. They are instead a way to look at market structure and a potential indication of an upcoming opportunity. It is always useful to look at candlestick patterns in context like any other market analysis tool and candlestick patterns are most useful when used in combination with other techniques. There are countless candlestick patterns that traders can use to identify areas of interest on a chart, where some candlestick patterns may provide insights into the balance between buyers and sellers, others may indicate a reversal, continuation, or indecision.
Reversal patterns are quite useful when used in context. Reversal patterns should form at the bottom of a downtrend or at the top of an uptrend. Otherwise, they are not a reversal patterns, but continuation patterns. Most reversal patterns require confirmation such as price move in the direction of reversal accompanied by appropriate trading volume. The reversal patterns can further be confirmed through other means of traditional technical analysis—like trend lines, momentum, oscillators, or volume indicators—to reaffirm buying or selling pressure. The patterns themselves do not guarantee that the trend will reverse. Investors should always confirm reversal by the subsequent price action before initiating a trade.
This study implements some of the most commonly used candlestick patterns in a context with directional movement indicator. On request users can adjust the strong trend threshold from dialog box, eighter can disabled correlation with directional movement indicator. To add additional sight to analysis the simple moving averages of 20, 50, 100 and 200 periods are added (configurable)
You may add additional indicators of your choice. Colored DMI, BB Cloud or Price Distance to its MAs may help
Enjoy it!
Disclaimer: The script is for informational and educational purposes only. Use of the script does not constitutes professional and/or financial advice. You alone the sole responsibility of evaluating the script output and risks associated with the use of the script. In exchange for using the script, you agree not to hold dgtrd tradingview user liable for any possible claim for damages arising from any decision you make based on use of the script
Trend Risk Indicator (TRI)The Trend Risk Indicator is a simple bands indicator made of 2 custom averages of candlesticks ranges calculated within the variable “ BandBars ” period.
Upper and lower channel bands width can be adjusted with the “ Deviation ” variable, which act as a simple factor to enlarge the spread between them.
When Close crosses over the upper band, it is a bearish signal and candlesticks are painted in Red.
When Close crosses under the lower band, it’s a bullish signal and candlesticks are painted in Green.
One of the most interesting indicators for 1 minute scalping. Recommended to use on Renko bars.
*drag to chart and pin to scale, also remove borders from candlesticks.
Attributable VolumeA volume indicator which calculates "Attributable Volume”, the portion of volume which contributed to the direction in which the candle moved.
Attributable Volume is calculated as: Total volume excluding the "counter wick" volume.
Where for a green (up) candle, the "counter wick" volume is the top wick volume.
In theory, Attributable Volume should better represent the effort of directional thrust of each candle.
By default, this indicator displays “Attributable RVOL”, but can be set to:
Attributable RVOL
RVOL
Attributable Volume
Volume
Note: RVOL = Relative Volume, the current volume divided by the Volume moving average. RVOL can be used to identify major moves, and potential starts/ends to trends.
VWAP [Gu5]VWAP is primarily used by technical analysts to identify market trends.
This design is more intuitive
green: Bullish Trend
red: Bearish Trend
orange: Range
---
El VWAP lo utilizan principalmente los analistas técnicos para identificar las tendencias del mercado.
Este diseño es mas intuitivo
verde: Alsista
rojo: Bajista
naranja: Rango
[RS][UCS]Murrey's Math Oscillator ModificationExperimental:
modifications includes 2 extra channel types to read volatility's range.
this is a update and modification to the Murrey's Math Lines Oscillator published by UCSgears here:
MACD_trendtraderThis is my modified macd indicator. It uses moving averages to determine the trend of the market. It is best used on lower time frames such as 5min and 15min. I found it useful especially with Forex pairs and also traditional markets.
This indicator will help you get in at a pullback in a trending market.
RED background tells you the trend is down. A possible entry happens when you get a sell signal from the macd oscillator above the 0 line.
GREEN background tells you the trend is up. A possible entry happens when you get a buy signal from the macd oscillator below the 0 line.
a couple of examples:
Leave your feedback in the comments. Enjoy:)
Sto RSI and kijun-sen line to determine and follow the trend This script uses 25-75 treshold of stochastic RSI with the help of kijun-sen as confirmation, to find entry points to any trend either newly developed or an established one. I just realized it on the 1 hour SPX chart. Sure it can be used on other symbols. Crossing above/below 25/75 line of sto RSI is considered as buy/sell signal. Signals are evaluated whether price be above/below kijun-sen line. If a sell signal below kijun-sen is generated it is a continuation signal for downtrend, otherwise it is a countertrend signal (maybe a signal for a new downtrend). A countertrend signal must be evaluated carefully and only accepted in the right side of kijun-sen. e.g entering a sell signal generated above kijun-sen should be accepted only below the kijun-sen, vice-versa.
3MA'S + KAMA Trend (20EMA,50MA,200MA + KAMA Trend)This indicator, combines the traditional FOREX moving averages (20EMA, 50ma, 200ma) into a single indicator with
an adaptive moving average (AMA) taken from a user defined timeframe to show trend direction (by default, it plots
the daily 10/2/34 KAMA overlayed on any timeframe chart.
An AMA moves slowly when markets are sideways but swiftly during periods of volatility as a result it reacts much fast than
traditional options for moving average trends.
If the price is above the KAMA, trend is up. Below the KAMA, trend is down.
Ehlers Decycler [CC]The Decycler was created by John Ehlers (Cycle Analytics For Traders pgs 40-41) and this is a moving average that has an extremely low lag even though it uses a fairly high length to calculate everything. This can also work well as a trendline. Buy when the indicator line is green and sell when it is red.
Let me know if there are other scripts you would like to see me publish or if you want something custom done!
Arnaud Legoux Trend IndicatorArnaud Legoux Trend Indicator (ALTI) was designed for Identifying the primary trend, secondary trend and minor trend in a clearer way. Using the trend for continuation trade and detect potential reversals are two common ways to use it. However, combining ALTI with good volume indicators also has special results.Good luck, traders.
Fechamento de Reversao - ValenteThis indicator will paint bars green if the candle has a lower low and a higher closer than the previous candle, and will paint it red if the candle has a higher high and a lower close than the previous candle.
There is an EMA filter you can apply to only have long signals when close above EMA and short signals when close below EMA.
The checkbox will activate and deactivate the filter.
Este indicator pinta de verde os candles que possuem minima mais baixa e fechamento mais alto que o candle anterior, e pinta de vermelho os candles que tem maxima mais alta e fechamento mais baixo que o candle anterior.
É possivel aplicar um filtro com a EMA para só dar sinais de long com fechamentos a cima da EMA e sinais shorts com fechamento abaixo da EMA.
Com o checkbox vice pose ativar ou desativar o filtro.
Ehlers Sinewave Indicator [CC]The Sinewave Indicator was created by John Ehlers (Rocket Science For Traders pgs 97-99) and this is a few indicators in one. Simply put it is a leading indicator which you don't see too many of those these days. If the blue line crosses over the red line then within the next few bars the price will start an uptrend and if the blue line crosses below the red line then in the next few bars it will start a downtrend. I have also included an immediate buy and sell signal on the 0 line which is green when you should buy and red when you should sell.
Let me know if you would like to see any other scripts or if you want something custom done!
ADX TriggerThis script fires off a buy alert when the ADX is rising and above a user-defined value (default 25). It fires off a sell signal when ADX starts sloping downward. The lookback period to determine if it is sloping up/down (in bars) is also configurable by the user. The plot highlights green when there is a "go" signal. Thanks to @9e52f12edd034d28bdd5544e7ff92e for the idea.
Simple EMA trend indicatorSimple EMA trend indicator , pretty straightforward green equates to bullish and usually a retest/wick is often seen , same for the flipside viceversa
Weighted Close [CC]The weighted close isn't an option for an input yet on TV so here is my contribution. It gives more weight to the close prices and I have included a signal line to look for buy and sell signals. Buy when the indicator goes over its signal line and sell when it falls below it.
This was a special request so let me know what other scripts you would like to see me publish or if you want something custom done!
Elder's Impulse System with weekly EMA Filter - ValenteThis indicator was based on the Elders Impulse System by astraloverflow.
The only difference is that I included the weekly EMA26 as a filter and you can plot it on the graph if you want (unchecking the Weekly EMA26 won't turn the filter off, will only stop plotting it).
The indicator works this way:
When the MACD Histogram is growing UP, the EMA13 is pointing UP AND the Weekly EMA26 is pointing UP, the bar is Green
When the opposite is true, the bar is Red.
When any condition from both green and red is not true, the bar is blue.
In my opinion, this particular indicator works better on the D1 time frame. I recommended using the original one, by astraloverflow for other time frames.
I hope it is useful!
Ehlers Fisher Transform Indicator [CC]The Fisher Transform Indicator was created by John Ehlers and the beauty of this indicator is that it provides sharp and clear turning points that are also very early. Buy when the indicator line is green and sell when it is red.
This was a special request so let me know if you would like me to publish other scripts or if you want something custom done!
Ehlers Market State Indicator [CC]The Market State Indicator was created by John Ehlers (Stocks & Commodities V. 38:06 (8–15)) and this is technically part of three indicators in one so I'm splitting each one to a separate script. This particular indicator was designed for the market state which acts as a trend direction and tells you whether the trend is strong in either direction. Keep in mind that when the indicator rapidly switches then the market is choppy and when it is a steady line then it is a very strong trend. Essentially buy when the indicator line is green and sell when it is red.
Let me know if you would like me to publish other scripts or if you want something custom done!
Note: I'm republishing this because the original script couldn't be found in searches so this will fix that.
End Point Moving Average [CC]The End Point Moving Average was created by Patrick E. Lafferty (Stocks & Commodities V13 (413-417)) and it is essentially a variation of the weighted moving average but the weight system is different. Feel free to change the offset and length amounts to adjust to your needs but I'm using the default amounts in my script. This hugs the price very closely and I think you will enjoy this script as much as I had making it. As always buy when the indicator line is green and sell when it is red!
Let me know if you would like me to publish other scripts or if you want something custom done!
Note: I'm republishing this because the original script couldn't be found in searches so this will fix that.
Jsa Moving Average [CC]The Jsa Moving Average was created by George R. Arrington, Ph .D. (Stocks & Commodities V. 11:10 (427-431)) and it is an extremely simple formula but has very many great uses. For one thing it acts as support and resistance levels and it also acts like a trailing stop. It gives a wide enough berth during extended up or down trends to let you ride the wave up or down and when it gets close to the price it means that it is a choppy market. Buy when the indicator line is green and sell when it turns red.
Let me know if you would like to see me publish other indicators or if you want something custom done!
Note: I'm republishing this because the original script couldn't be found in searches so this will fix that.
Rex Oscillator [CC]The Rex Oscillator measures market behavior based on the relationship of the close to the open, high and low values of the same bar. A big difference between the high and close on a bar indicates weakness, and wide disparity between the low and close indicates strength. The difference between open and close also indicates market performance. Buy when the indicator is green and sell when it turns red.
Let me know if you would like me to publish other scripts or if you want something custom done!