Indicators: Directional Efficiency Ratio

 

Directional Efficiency Ratio:

The Efficiency Ratio (ER) was first presented by Perry Kaufman in his 1995 book "Smarter Trading". It is calculated by dividing the price change over a period by the absolute sum of the price movements that occurred to achieve that change. The resulting ratio ranges between 0 and 1 with higher values representing a more efficient or trending market.

This version is different from the original. The original efficiency ratio is not showing the direction / trend of the price changes. This version is showing the direction and is adding a levels criteria to estimate if the market is trending or ranging. That way the indicator becomes a tool not only to show if the market is trending but to show the direction of the market as well. To help the estimation, smoothing option is added. With very mild smoothing, it is much easier to estimate the trend and a lot of false signals are avoided. To avoid smoothing, set the smoothing period to <= 1.

Author: Mladen Rakic

 

Bug - inconsistency with the formula (there should be a difference between [i]-year and [i-period]), because of which there is a difference in the results with other similar indicators(for example), including those from the same author.

double _efr   = (_noise!=0 && i>inpPeriod) ? (prices[i]-prices[i-inpPeriod+1])/_noise : 0;
 
Stanislav Korotky #:

Bug - inconsistency with the formula (there should be a difference between [i]-year and [i-period]), because of which there is a difference in the results with other similar indicators(for example), including those from the same author.

Maybe this, found a levels version he did making the efr a function and changed it to that.
 
Stanislav Korotky #:

Bug - inconsistency with the formula (there should be a difference between [i]-year and [i-period]), because of which there is a difference in the results with other similar indicators(for example), including those from the same author.

No bug