BTCManager Logo with clear background. Orange and white font.

BITCOIN PRICE: 7,500.00     HIGH: 7,944.73     LOW: 7,267.24

Next Event

Africa Blockchain Conference 2018 • May 23-24, 2018

Organized by The Blockchain Association of Uganda, with support from the Government of Uganda, the Africa Blockchain Conference will concentrate…

Click for more details

A Guide to Trading Cryptocurrency Part 7: Linear Regression


A Guide to Trading Cryptocurrency Part 7: Linear Regression

To read Part 6 of BTCManager’s ‘A Guide to Trading Cryptocurrency,’ click here.

In this trading guide, we will introduce you to a useful concept that can be used for trading, amongst other things. Linear regression is a simple, easy-to-use strategy that can be utilized to identify entry and exit points based on the price action of the cryptocurrency.

What is a Linear Regression?

A linear regression is a mathematical method used to capture the determination of a specific variable. In our case, let’s say the price of bitcoin. We want to know what factors determine the price of bitcoin. A linear regression can be modeled. Let’s call price of bitcoin in period t, yt, and use the price in the previous period as a determinant, yt-1:

  • Yt = byt-1 + e

Once we apply this model to the financial time series data, we will end up with estimates for the parameters b and e. The parameter b basically tell us the relationship between the past and current price of bitcoin. The parameter e captures all other variables effect on price and is known as the residual.

Of course, this model can be extended to include as many time periods as you like. We could go even further and add other variables if we wanted to. Using various diagnostics, we can assess the fit of the model to the data and forecast based on this model. For each time period, we would simply update the data, run the model again and produce a new forecast.

HOwever, this is no crystal ball, and the purpose is not to obtain a point forecast. Instead, we obtain an estimate such that we can map out the possible underlying values based on the estimate we have made and accounting for standard errors, known as a confidence interval. As for the confidence interval, we can think of it visually as a normal distribution. Then we can say, we are 99, 95 or 90 percent certain that the price of bitcoin will be $X at a certain date.

The middle of the shape above would be our estimate and provided we have good enough estimators, the true value of the relationship we are estimating will lie somewhere in the bell-shaped curve.

Return to the mean

Another interesting thing to note is that most financial time series data have a property known as a unit root. It basically means the variable exhibits a behavior known as mean reversion. To read more about mean reversion applied to litecoin, Coin Metrics’ post observes this property for the altcoin’s Network Value to Transaction ratio.

The weekly chart of bitcoin below shows 12 out of the past 89 weeks, BTC-USD has touched the middle line – the mean. And in the author’s opinion, looks to cross it again very soon, given that the price action is moved away from the -2 standard deviation (bottom line).

We will see in the next section how mean reversion is relevant to the linear regression trading indicator.

Trading with Linear Regression

OK, so let’s apply what we have learned so far. We can visually represent a linear regression similar to the example outlined above on charts such as TradingView. See below for the linear regression for bitcoin on the daily timeframe.

The author prefers to use Fibonacci numbers and usually the 89 and 144 for long-term view on the weekly outlook, while you can also use lower numbers on lower timeframes for smaller trends. The higher, the better, since you capture more of the data available, but requires more patience to act upon. If you prefer zen trading, use higher period for the linear regression indicator, if you’re more of a scalper, use a lower period.

In the chart above, we have used 89, so 89 periods are included in the regression sample to provide an estimate. The mean – or expected value – is displayed by the line in the middle.

Now with TradingView, you will have to add ‘Linear Regression’ as an indicator twice, and set one to +/-1 standard deviation and set the other to +/-2 standard deviation; this is basically our confidence interval we explained earlier. Now, for any period of time, we can determine whether the price is within the channel and in which zones are ‘extreme.’ Remember, most financial time series data have a property of mean reversion, and we can see this below. In 89 periods, the price has bobbed toward and away from the mean numerous times.

Moreover, we can think of each of these lines displayed as supports/resistances. Once a support or resistance breaks, we should not fight against the market, but flow with it.

As shown above, we can see clear sell signals in mid-February and early March, but a word of caution is here. At the time, the chart would have looked different so the main point here is that when the price approaches or even leaves the zone highlighted by the linear regression, we should consider selling/buying. For instance, we see that the price on March 4 closed above the zone highlighted by the indicator (and was also a hanging man candlestick pattern), so indicating to sell.

At the time of writing, the price of bitcoin is again approaching the +2 standard deviation, suggesting we may look for a short position soon. However, the downtrend in bitcoin has been going on since December 2017, more than three months and the 89-period regression shows a downward trend. It could be that the price of bitcoin breaks out of the channel illustrated above, in which case we should revert to a different period for the regression or a different timeframe and best capture the shorter-term trend.

For instance, say we believe the downward channel will be broken. We can draw a new linear regression on the chart by changing the timeframe in one of two ways; change the period or change the timeframe. The chart below changes from daily to 4-hour price action and where the channel indicates to sell is much higher as with the places to buy. By May 3, $10,000 is comfortably within the lower line, meaning that around this date, the psychological level is part of a support zone. Of course, this is assuming the current trend holds.


Comparing with the previous chart (daily), it suggests that any move above $10,000 should be dumped on. However, when aligning the regression period with the newer upward trend, it paints a different picture with an estimate of $10,500 by May 3. In essence, we have to find the current structure of the market, monitor and eye our buy and sell zones.

Linear regression is based on extrapolation – meaning it is based on the historical price action. It should be obvious that past patterns are not necessarily repeated in the future. This is one drawback of the linear regression method and highlights the importance of staying on top of fundamental and sentiment development of the asset in question to anticipate any change in the market’s structure.

Great technical analysis is not a house that stands on one pillar. As with all trading indicators, using them on their own may give you some insight into the true behavior of markets, but you are more likely to succeed when combining synergistic indicators; for example, one based on price action, one based on momentum, one based on volume, etc. In the next section, we will show you what indicators work best with Linear Regression.

A Strategy Based on Linear Regression

Linear regression is an indication of price action. Therefore, we would like such additional indicators to enhance and confirm our signals. In the author’s opinion, momentum indicators like RSI, MACD, Stochastics, or the Awesome Oscillator, Parabolic SAR, and volume are enough.

Momentum Indicators

Momentum indicators indicate oversold/overbought conditions and can act as a second call on the direction of the market in light of a signal given by the Linear regression method.  For instance, if the price is near the +2 standard deviation line and the RSI is nearing, or above 65, then we have confirmed the Linear Regression signal that the upward trend may be running out of steam soon. If, on the other hand, the price is near the +2 standard deviation line and the RSI is near 50, there may be some fuel left in the tank for an upward continuation.

Parabolic SAR

The Parabolic SAR is a very simple indicator which can only tell you one thing; when to enter/exit positions. It does nothing more than providing a signal saying – you need to buy (or sell) in this session! The Parabolic SAR is represented by a dot. Say it is above the price action, and then you observe it moves now to below the price action, we have a buy signal, and vice versa for a sell signal. Not only that, we must also look for the dots to become ‘parabolic’ to support the move in the asset.

When combined with the Linear Regression indicator, both signals can help reinforce each other. While both can be used to provide an entry, Linear regression will be more useful in planning an exit.


Finally, volume is an important indicator that should be included in any trading strategy. Volume precedes price action, meaning changes in volume are key in determining future trends of the price of a cryptocurrency.

The chart below shows how these pieces come together. At the time of writing, we should be long already since April 23, and we would look to exit when the price action reaches the +2 standard deviation, or the Parabolic SAR switches back above the price action. The price has been around the mean for some time, suggesting bitcoin could be propelled further upward.

Another Example

So the author was playing around with an example, AEON. On April 5, the market for AEON-BTC is illustrated below, and you see the price had already touched the -2 standard deviation, motivating an entry into a long position. The signal was confirmed later on by using the ‘record session’ method of counting lows (or highs) until 7-10 record sessions are observed.

On April 24, we see that the signal has almost been delivered –  we are in week three of no new low – meaning the count will be restarted and bull trend taking hold. AEON-BTC also attempted to test the resistance at -1 standard deviation, suggesting we will move back to the mean and possible extend higher to the +1/+2 standard deviation over the long term.

The chart below shows where you would exit from a long, and assumes we have already entered/about to enter a long.

In part, it depends on the date. In the chart above, we see that 0.00037 is a good exit for late June 2018. Further along, in September/October, we can notice the +1 standard deviation provides resistance around the 0.00050 handle. Finally, another exit point could be near the 2018 high 0.00064 for early 2019.

Of course, the trend could be broken and force the linear regression to have a smaller gradient (or an even higher one) so that the channel changes its direction, so these charts need to be monitored every week to adjust your exit positions or find new entries. For instance, a move above the -1 standard deviation line would prompt another long entry, as would a move above the mean.


In summary, the linear regression is a trading indicator allowing you to time entries and exit on cryptocurrencies. It does not tell you anything about momentum or volume, so ensure you use it with indicators measuring these aspects of the market.


To read the full series of ‘A Guide to Trading Cryptocurrency,’ click here.

Join our Telegram Channel!