Measuring the acceleration of an indicator is very easy to do. The market may be in bullish acceleration or bearish acceleration.

Measuring bullish or bearish market acceleration takes two steps. Firstly, you will need to compute the market direction and secondly, you will be able to see if this direction is growing.

## Measuring price direction

It’s very easy to measure price direction thanks to the linear regression slope on a period. The “LinearRegressionSlope” instruction proposed by Prorealcode allows you to obtain this slope.

`regSlop = LinearRegressionSlope(close)`

In the previous example, the linear regression slope is computed on price on 20 periods.

## Measuring price acceleration

You can now easily measure price acceleration thanks to the difference between the slope variable’s actual value and her previous value.

`acceleration = regSlop - regSlop`

The result of this calculation is a kind of the second derivative. You can consider that as a “variation of variation” of price.

If the acceleration variable is greater than zero, that would mean two things :

• price increase more and more strongly, that is a bullish acceleration
• price decrease less and less strongly, that is an end of the bearish trend

If the acceleration variable is less than zero, that would mean two things :

• price decrease more and more strongly, that is a bearish acceleration
• price increase less and less strongly, that is an end of the bullish trend

### Price acceleration indicator

Here the acceleration measuring indicator that I use :

```regSlop = LinearRegressionSlope(close)
acceleration = (regSlop - regSlop) * 1000000
averageAcceleration = Average(acceleration)
ZERO = 0
RETURN averageAcceleration AS "Acceleration", ZERO AS "0"```

### Detect the End of Trend thanks to acceleration measuring

You can detect the end of the trend when the acceleration indicator crosses zero :

• If the acceleration indicator crosses over zero that mine the end of the bearish trend.
• If the acceleration indicator crosses under zero that mine the end of the bullish trend.

## Measure acceleration on other indicators

This method of acceleration measuring which we calculated on price can be transposed on any technical indicators. You just need to replace “close” with your preferred indicator in the « LinearRegressionSlope[period](close) » instruction.

1. 1. 