Hello Professor
@kouba01. It's good to be back in the academy, and even better to do it with this wonderful class with this indicator which is very useful for our trading operations.
Let's get start it!
Image edited by me in Powerpoint
1. Discuss your understanding of the principle of linear regression and its use as a trading indicator and show how it is calculated?
Thinking about linear regression reminds me of my days in college, specifically in Statistics where I once did a paper on this topic.
From the strict statistical point of view Linear regression is a technique used to represent a continuous response variable (dependent) as a function of other variables (independent). Consequently it helps to analyze and predict the behavior of complex systems, such as market behavior.
In theory it could be used as a tool to predict the future of an asset price by tracking price values and their deviation from the average.
As a trading indicator it consists of a smoothed line which represents the curve that best fits the actual price over a given period of time. So the interaction of this line with the price represents whether at that instant there are more buyers or sellers dominating the market, depending on whether the line is below or above the price.
It is therefore an invaluable aid in determining the continuity or otherwise of the direction of a trend.
For the explanation of the formula I will use a real example of the CAKE/USDT chart, at one hour time frame.
Image taken from: Source
My control period will be the one corresponding to 17:00 hrs on December 13, and for calculation purposes I will also take the closing prices of the previous 14 periods.
The calculation is summarized in solving the formula of a linear equation, which represents the optimal or smoothed function of the price, the formula of a linear function is:
Image edited by me in Powerpoint
Where each element is calculated as follows:
Image edited by me in Powerpoint
n= total number of periods calculated
y= closing prices
x=corresponding sequential number.
To be honest this calculation process is quite complex if you want to do it by hand, so with the use of an EXCEL table you sort the closing prices collected from the chart as follows.
Data edited by me in Excel
To perform the calculation, we must do it with the command (PRONOSTICO) and select the corresponding values from the table. In this way we will be calculating in an EXCEL assisted way the value of the linear regression.
Data edited by me in Excel
Finally we can see that the result was 10.9665, which is very close to the value obtained by the tradingview chart.
Data edited by me in Excel
2. Show how to add the indicator to the graph, How to configure the linear regression indicator and is it advisable to change its default settings? (Screenshot required)
1- Start in the upper panel of the tradingview, click on the indicators and strategies button.
Image taken from: Source
2- A pop-up window will appear on which we must type "LINEAR REGRESSION FORMULA". Then select the indicated option.
Image taken from: Source
3- As you can see, the LRI line will appear on the price chart. Then to configure the indicator parameters click on the "configuration options" button.
Image taken from: Source
4- Again, a pop-up window will appear with the configuration and appearance options. First of all it is important to note that the default length setting in Tradingview is 14, however it is not the most recommended.
Image taken from: Source
For this reason many authors and experts recommend using a length of 66 or even 63 periods, as this shows a better interaction of the indicator with the price. For example as you can see, with a parameter of 14 periods at a 1 hour time frame, the line is completely inside the price bars, making it impossible to determine the behavior of the line with respect to the price.
However when we change the parameter to 66 periods, the positioning of the line with respect to the price is better observed.
Image taken from: Source
3. How does this indicator allow us to highlight the direction of a trend and identify any signs of a change in the trend itself? (Screenshot required)
This indicator works in conjunction with the price to show several continuation or trend change signals that complement each other. In fact this indicator works in a similar way to the EMAs.
So first of all when the LRI line is below the price we can say that we are in a bullish period, and as long as the slope remains constant the trend will remain strong.
On the other hand when the LRI line is above the price, we can say that we are in a bearish period.
Image taken from: Source
TREND REVERSAL
Trend changes are very easy to identify in this indicator. First of all, one way to identify a possible trend reversal is through the break of the LRI line by the price. So any time the price breaks the indicator line is an early sign of trend reversal.
If the price cuts the indicator from the bottom to the top it is expected the start of an uptrend. On the other hand if the price cuts the indicator from above downwards, the start of a bearish cycle is expected.
It may be the case where several cuts occur before a real trend change, for such reason this first signal is complemented by a second signal... the change in slope of the LRI curve.
The change of direction in the slope of the LRI works as a support signal or confirmation of the first break signal. In this case it functions as a confirmation of the trend change.
Image taken from: Source
4. Based on the use of price crossing strategy with the indicator, how can one predict whether the trend will be bullish or bearish (screenshot required)
As mentioned in the previous section, the parameters are as follows:
Bullish trend
1-The chart starts in a downtrend, so the price is below the LRI indicator line.
2-To predict a new uptrend the price candle must first approach the LRI line and then cut it from below in an upward direction, thus positioning the price above the LRI line. Not only this, but the close of the bullish candle must occur above the LRI line.
3- Next, the following candles are expected to move further away from the LRI line in an upward direction, this as a confirmation of the new uptrend.
Image taken from: Source
This trend reversal signal can be taken as an early warning to set up a buy.
Bearish trend
1-The chart starts in an uptrend, so the price is above the LRI indicator line.
2-To predict a new downtrend the price candle must first approach the LRI line and then cut it from above in a downward direction, thus positioning the price below the LRI line. Not only this, but the close of the bearish candle must occur below the LRI line.
3- Next, the following candles are expected to move further away from the LRI line in a downward direction, this as a confirmation of the new downtrend.
Image taken from: Source
This trend reversal signal can be taken as an early warning to establish a sell or close a buy.
5. Explain how the moving average indicator helps strengthen the signals determined by the linear regression indicator. (screenshot required)
The LRI is not designed to work alone, in fact it is designed to be a support to our main trading strategy, therefore the use of MA can help to give better confirmation and trend reversal signals.
Because the LRI is more dynamic than an MA, it is able to generate more signals with less delay, so we can use a strategy of employing an MA with a higher time loss that works as a slow line thus balancing the volatility of the LRI.
In other words, we will reproduce the two MA strategy, where one has a period of 50 and the other of 200 (for example), only this time we will replace one of the MAs with the LRI.
Image taken from: Source
In this case the use of both tools gives robustness and more support to our trading decisions. I argue this because of the following:
As we can see, on the 11th day starts a bullish phase in the price which is confirmed on the 12th day by the crossing of both lines (MA & LRI). In this case the LRI (fast indicator) cuts the MA (slow indicator) from below in an upward direction; this undoubtedly signals a trend change from bearish to bullish. Note also that the price cuts the LRI on the 11th day; so we have several confirmations.
However notice what happens next, around days 15 and 20 the price breaks the LRI in a downward direction, which could be warned as a possible trend reversal. However as you can see, the LRI line never crosses the MA(50) so it is determined that there is no real trend change.
Had it not been for the MA(50) it would have been highly likely that we would have exited the trade early, making us lose money.
Thanks to the combined use of the MA(50) we were able to identify that the trend was still continuing, until finally on December 2nd both indicators through a new crossover made us realize that a new bearish phase was starting.
6. Do you see the effectiveness of using the linear regression indicator in the style of CFD trading? Show the main differences between this indicator and the TSF indicator (screenshot required)
The linear regression indicator is obviously useful for all types of markets, including CFDs, however if you are looking for greater effectiveness in predicting this specific type of market the indicator you are really looking for is the TSF Indicator.
It is curious, but in reality the TSF Indicator is an alternate version of the LRI, which entails a more specialized and complex calculation (Least Squares linear regressions), taking into account not only the variables required by the LRI but takes into consideration several linear regression models, where all the points that on the graph indicate a day, are the end point of multiple linear regression, plotted in the future. For this reason this indicator is suitable for CFD.
From the point of view of operation, like the LRI, it describes a curve around the price that can be used in the same way as an MA. Thus when the price is above the TSF line the market is in a bullish phase, if on the other hand the price is below the TSF line the market is in a bearish phase.
Differences
The main difference between the two indicators is that due to its construction the TSF is more sensitive to changes and market movement, making it a preferred indicator for low timeframes and short term trading (including CFD's and Binary Trading). On the other hand, the LRI is more suitable for medium and long term operations.
Image taken from: Source
For example we can see in the image how the TSF line follows more closely the BTC/USDT price. This happens because TSF is a faster indicator with short response time. One aspect to consider is that for the TSF to be fully effective it is recommended to use it with a 9-period configuration, besides a two-indicator strategy could be used in conjunction with the LRI.
Another very interesting difference is that the TSF allows to identify areas of price regression, (high and low points) which in turn function as entry or exit signals for buy or sell trades.
7. List the advantages and disadvantages of the linear regression indicator
Advantages | Disadvantages |
It is very sensitive and reacts quickly to market movements, therefore it is perfect for long term trading and high timeframes. | The sensitivity makes it really susceptible to generate a lot of false signals, so it is not very good for short term use (like scalping) and in low temporalities. |
It is easy to use and very simple to learn for a novice. | It is not very reliable to be used alone, so it is recommended to use it as a support to a main trading strategy. |
Buy and sell signals are easily visible and identifiable. | The buy and sell signals are not 100% reliable, in fact it is recommended that traders do not take entries or exits based on what the indicator shows, but should make a study and evaluation of the context and the price action. |
CONCLUSION
We can say that the LRI is a very user friendly indicator and perfect for use by a novice trader in demo account trading or very low risk trading. Due to its simplicity and visibility it is perfect for identifying early market movement, such as possible signals of trend changes.
On the other hand it is a double-edged sword, which is presented to us as a statistical tool that helps to predict future market movement thanks to its parameters and study of previous periods. However it is not a 100% flawless tool.
The fact of how this indicator is calculated makes it especially sensitive to market movements, making it also vulnerable to false signals.
In fact during a trade it can lead us to lose a lot of money by giving us buy or sell signals before time or out of context.
So it is important again to emphasize that it is not recommended to use this indicator alone, but in conjunction with other tools or in support of a more robust primary trading strategy.
Also as I always say, it is recommended to accompany any operation with this indicator with a responsible risk management strategy.
Hi Albert,
Thanks for covering the topic and sharing your experience here. Crypto trading with linear regression indicator is a good idea but what is market is crashing like these days? Is it effective enough in all the market conditions.
I always use Relative Strength Index indicator, and invest in fundamentally strong cryptocurrencies like BTC, ETH, and MATIC etc.