Efficiency ratio
How directly the price moved: 1 for a straight line, near 0 for noise.
Inputs
| Name | Type | Default | Range |
|---|---|---|---|
| source | source | close | |
| period | int | 10 | 1 to 5000 |
Outputs
| Name | Type | Required | Description |
|---|---|---|---|
| efficiency_ratio | value | Optional | color theme.accent, style line, width 1 |
- Warm-up
- period bars (10 at the defaults)
- Repaints
- No
- Parity
- None
Formula
ER[i] = |x[i] - x[i-period]| / sum(|x[j] - x[j-1]|) for j from i-period+1 to i
When the sum is zero, ER is 0. A window holding a missing value has no value.