Files
wickra/docs/wiki/indicators/volume/Indicator-ForceIndex.md
T
kingchenc d2f99efd78 F13c: restructure the indicator catalogue into eight families
The original taxonomy was four classical families plus a statistics group,
with the F1-F12 expansion slotted in as sub-categories. This regroups the
whole 71-indicator catalogue into eight top-level families, each with at
least five members:

  Moving Averages (12), Momentum Oscillators (13), Trend & Directional (9),
  Price Oscillators (5), Volatility & Bands (12), Trailing Stops (5),
  Volume (9), Price Statistics (7).

- Wiki: docs/wiki/indicators/ reorganised into eight family folders; all 71
  indicator pages moved with `git mv`. Every internal cross-link is
  normalised to `../<family>/Indicator-X.md`, each page's `Family` field is
  set to its new family, and two pre-existing `../Indicator-Chaining.md`
  links (should have been `../../`) are corrected. A link check confirms
  every relative wiki link resolves.
- Indicators-Overview.md fully rewritten around the eight families;
  Home.md indicator reference and the README family table follow suit.
- Warmup-Periods.md gains the eight F13 indicators; CHANGELOG records the
  46-indicator expansion (25 -> 71) and the eight-family taxonomy.
- Tests: Node indicators.test.js and Python test_new_indicators.py cover
  all eight new indicators (Node 91/91, Python 117/117 green).

cargo fmt + clippy (core/wickra/data/wasm/node) clean; 508 core tests,
25 data tests and 74 doctests green.
2026-05-22 21:21:56 +02:00

4.3 KiB
Raw Blame History

ForceIndex

Force Index — Alexander Elder's price change scaled by volume, then smoothed with an EMA.

Quick reference

Field Value
Family Volume
Input type Candle (uses close, volume)
Output type f64
Output range unbounded around zero
Default parameters period = 13 (Python)
Warmup period period + 1
Interpretation Conviction behind a move; sign and zero-crossings are the signal.

Formula

raw_t   = (close_t  close_{t1}) · volume_t
Force_t = EMA(raw, period)_t

The raw force is positive on an up-close and negative on a down-close, with a magnitude that grows with the volume backing the move — a large move on heavy volume registers a large force, a large move on thin volume does not. Smoothing the raw series with an EMA turns the noisy per-bar reading into a tradeable line; Elder's classic period is 13.

Parameters

period — the EMA smoothing period. The Python binding defaults it to 13; the Rust and Node constructors require it explicitly.

Inputs / Outputs

From crates/wickra-core/src/indicators/force_index.rs:

impl Indicator for ForceIndex {
    type Input = Candle;
    type Output = f64;
    // update(&mut self, input: Candle) -> Option<f64>
}

ForceIndex is a candle-input indicator that reads close and volume. In Python the streaming update accepts a 6-tuple or a dict; the batch helper takes close, volume numpy arrays. Node and WASM expose update(close, volume) and the matching batch.

Warmup

ForceIndex::new(13).warmup_period() == 14. The first candle only establishes the previous close, so the first raw force appears on candle 2 and the first smoothed value on candle period + 1.

Edge cases

  • First candle. Establishes the previous close only; emits None.
  • Up- vs down-trend. A strictly rising series gives a positive force, a strictly falling series a negative one (pure_uptrend_is_positive and pure_downtrend_is_negative pin this).
  • period = 1. EMA(1) has alpha = 1, so the Force Index passes the raw force through unsmoothed.
  • Reset. fi.reset() clears the previous close and the EMA.

Examples

Rust

use wickra::{BatchExt, Candle, Indicator, ForceIndex};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // ForceIndex(1): EMA(1) passes the raw force through.
    let mut fi = ForceIndex::new(1)?;
    let out = fi.batch(&[
        Candle::new(10.0, 10.0, 10.0, 10.0, 100.0, 0)?,  // seeds the previous close
        Candle::new(12.0, 12.0, 12.0, 12.0, 100.0, 1)?,  // raw = (12-10)·100
        Candle::new(11.0, 11.0, 11.0, 11.0, 200.0, 2)?,  // raw = (11-12)·200
    ]);
    println!("{:?}", out);
    Ok(())
}

Output:

[None, Some(200.0), Some(-200.0)]

This matches the reference_values test in crates/wickra-core/src/indicators/force_index.rs.

Python

import numpy as np
import wickra as ta

fi = ta.ForceIndex(1)
close = np.array([10.0, 12.0, 11.0])
volume = np.array([100.0, 100.0, 200.0])
print(fi.batch(close, volume))

Output:

[  nan  200. -200.]

Node

const ta = require('wickra');
const fi = new ta.ForceIndex(1);
console.log(fi.batch([10, 12, 11], [100, 100, 200]));

Output:

[ NaN, 200, -200 ]

Interpretation

Elder reads the Force Index on two horizons. A short period (the classic 2) is a sensitive entry timer — it crosses zero often. A longer period (13) tracks the conviction behind the prevailing trend: it staying above zero confirms buyers are in control. Divergence between a 13-period Force Index and price flags an exhausting move.

Common pitfalls

  • Comparing levels across instruments. The force scales with raw volume, so a value of 200 means nothing without knowing the instrument.
  • Feeding it scalar prices. It needs close and volume.

References

Alexander Elder's Force Index, introduced in Trading for a Living (1993).

See also