Elder's Force Index (EFI)
Summary
Alexander Elder's Force Index (Trading for a Living, 1993): volume-weighted momentum. Each bar's close-to-close move is weighted by that bar's volume, and the result is smoothed with an exponential moving average. The sign is the direction of the move; the size combines how far price travelled with how much volume stood behind it.
Elder reads two settings — 2 for the short term, which he pairs with a 22-period EMA of price to mark corrections against an established trend, and 13 for the intermediate term, the default here. A divergence against price can be confirmed by a zero-line cross. Beyond Elder, much longer settings are also in use, 100 or so, for the longer-term balance between buyers and sellers. Nothing normalises the result, so it scales with the instrument's own volume: read its sign and its shape over time, not its level against another instrument.
Chart
Chart metadata i
Outputs
outReal:line·zero·positive·negative
Formula
force_t = ( close_t - close_{t-1} ) * volume_t; EFI = EMA( force, optInTimePeriod )
The EMA is TA-Lib's, seeded with a simple average of the first optInTimePeriod force values. A period of 1 leaves the raw one-bar Force Index.
Inputs
inClose— Close price of each barinVolume— Volume of each bar
Outputs
outReal— Smoothed force
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInTimePeriod | integer | 13 | 1–100000 | EMA period applied to the force series |
Properties
Numerical Stability: Initial Unstable Period — Inherited from EMA, which EFI computes internally; tunable via EMA's unstable period.
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
| ☐ Display Shift |
| ☐ Can Output NaN or ±Inf |
| ☐ Identity at Period 1 |
| ☐ Uses Transcendental |
| ☐ Input Must Be Positive |
Example
#include <stdio.h>
#include <ta_libc.h>
int n = 252;
double close[252]; /* your data, oldest first */
double volume[252]; /* your data, oldest first */
double out[252];
int outBegIdx, outNBElement;
TA_Initialize();
TA_EFI( 0, n - 1, close, volume, 13, &outBegIdx, &outNBElement, out );
printf( "%d values from bar %d: [%.4f, ..., %.4f]\n", outNBElement, outBegIdx, out[0], out[outNBElement - 1] );use ta_lib::Core;
let close = vec![0.0; 252]; // your data, oldest first
let volume = vec![0.0; 252]; // your data, oldest first
let mut out = vec![0.0; 252];
let core = Core::new();
let range = core.efi(0, close.len() - 1, &close, &volume, 13, &mut out)?;
println!("{} values from bar {}: [{:.4}, ..., {:.4}]", range.count, range.beg_idx, out[0], out[range.count - 1]);import io.github.talib.Core;
import io.github.talib.OutRange;
import java.util.Locale;
double[] close = new double[252]; // your data, oldest first
double[] volume = new double[252]; // your data, oldest first
double[] out = new double[252];
Core core = Core.DEFAULT;
OutRange r = core.efi(0, close.length - 1, close, volume, 13, out);
System.out.printf(Locale.ROOT, "%d values from bar %d: [%.4f, ..., %.4f]%n", r.count(), r.begIdx(), out[0], out[r.count() - 1]);using System;
using TALib;
var close = new double[252]; // your data, oldest first
var volume = new double[252]; // your data, oldest first
var outReal = new double[252];
var core = Core.Default;
OutRange r = core.Efi(0, close.Length - 1, close, volume, 13, outReal);
Console.WriteLine(FormattableString.Invariant($"{r.Count} values from bar {r.BegIdx}: [{outReal[0]:F4}, ..., {outReal[r.Count - 1]:F4}]"));import { efi } from 'ta-lib';
const close = new Float64Array(252); // your data, oldest first
const volume = new Float64Array(252); // your data, oldest first
const { begIdx, values } = efi({ close, volume }, { timePeriod: 13 });
console.log(values.length + ' values from bar ' + begIdx + ': [' + values[0].toFixed(4) + ', ..., ' + values[values.length - 1].toFixed(4) + ']');import (
"fmt"
"log"
talib "ta-lib.github.io/go"
)
close := make([]float64, 252) // your data, oldest first
volume := make([]float64, 252) // your data, oldest first
out := make([]float64, 252)
core := talib.NewCore()
r, err := core.EFI(0, len(close)-1, close, volume, 13, out)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])Implementation
Added in 0.8.1 (ta-lib-python 0.8.1).
TA-Lib Definition: efi.c · efi.yaml
| Native | File |
|---|---|
| C | ta_EFI.c |
| Rust | efi.rs |
| Java | Core_EFI.java |
| C# | Core_EFI.cs |
| TypeScript | efi.ts |
| Go | efi.go |
Python: talib.EFI (ta-lib-python 0.8.1 or later), see ta-lib-python.
TA-Lib is also available for R and more using a wrapper.
See Also
References
- Alexander Elder, Trading for a Living, Wiley, 1993, introduces the Force Index and the 2-period and 13-period smoothing he reads as short- and intermediate-term.
- StockCharts ChartSchool, Force Index:
Force Index(1) = {Close - Close prior} x Volume,Force Index(13) = 13-period EMA of Force Index(1). - MotiveWave, Elder's Force Index:
rawForce = vol * (price - prevP), smoothed by a moving average whose default method is EMA, at 2 and 13. No competing formula was found.