Measuring the acceleration of an indicator is very easy to do. The market may be in bullish acceleration or in bearish acceleration.
Measuring bullish or in 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 computed on price on 20 periods.
Measuring price acceleration
You can now easily measure price acceleration thanks to the difference between the slope variable 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 means 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"
Bullish acceleration example
Bearish acceleration example
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 acceleration indicator crosses under zero that mine the end of the bullish trend.
End of bullish trend example
End of bearish trend example
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” by your preferred indicator in « LinearRegressionSlope[period](close) » instruction.
If you want to learn more about automated trading, please see our automated trading learning section.
Subscribe to our newsletter!
If you are any questions, please ask me in a comment and if this article pleased you I would be grateful to see you share it.