Skip to main content

Cumulative Ofi

Quick Reference

PropertyValue
Dimensionsignal
Categoryorder_flow
Versionv0.9.0 (Beta)
Output Columncumulative_ofi

Cumulative Order Flow Imbalance: cumsum(ofi) - running cumulative sum (unbounded state)

Formula

cumsum(ofi, 0)

CDM Inputs

ColumnCDM TableDescription
best_bid_sizecdm_lob_snapshotOrder book snapshot data 鈥?depth levels, bid/ask prices and sizes
best_ask_sizecdm_lob_snapshotOrder book snapshot data 鈥?depth levels, bid/ask prices and sizes
oficdm_lob_snapshotOrder book snapshot data 鈥?depth levels, bid/ask prices and sizes

Parameters

This FeatureType has no configurable parameters.

Output

Column: cumulative_ofi

Cumulative sum of order flow imbalance

Market Intuition & Trading Rationale

Cumulative OFI is the running sum of OFI: cumsum(ofi, 0). While OFI captures instantaneous flow pressure (the net change in bid vs ask size at each update), cumulative OFI captures the accumulated directional pressure over time. It's an unbounded state variable 鈥?it rises with sustained buying pressure, falls with sustained selling pressure, and stays flat when flow is balanced.

The level of cumulative OFI reveals whether the market has experienced net buying or net selling over the observable history. A positive cumulative OFI means the market has absorbed more buying pressure than selling pressure since the start of the observation window 鈥?this accumulated demand may eventually push prices higher. A negative cumulative OFI means accumulated selling pressure. Divergence between cumulative OFI and price (cumulative OFI rising while price is flat or falling) is a particularly strong signal 鈥?buying pressure is accumulating without being reflected in price yet.

The turning points of cumulative OFI are more informative than the level. When cumulative OFI peaks and starts declining, buying pressure has exhausted 鈥?potential top. When it troughs and starts rising, selling pressure has exhausted 鈥?potential bottom. These turning points often lead price reversals by seconds to minutes.

Usage Cases

  • Flow-pressure divergence: When cumulative_ofi trends up but price trends down, buying pressure is accumulating beneath the surface 鈥?a bullish divergence. When cumulative_ofi trends down but price trends up, selling pressure is building 鈥?a bearish divergence.
  • Order flow accumulation pack: The primary accumulator in the order_flow_accumulation feature set, where it's paired with trend slope (linear_regression_slope) to detect when accumulation is turning into directional price movement.
  • Exhaustion detection: When cumulative_ofi reaches an extreme and reverses, the dominant side has exhausted. Use as an entry signal for mean-reversion strategies 鈥?enter in the opposite direction of the cumulative flow after the reversal is confirmed.
  • VPIN alternative: Cumulative OFI provides a simpler, faster alternative to VPIN for tracking directional order flow imbalance. Unlike VPIN (which requires volume bucketing), cumulative OFI updates on every order book change.

YAML Definition

name: cumulative_ofi
description: 'Cumulative Order Flow Imbalance: cumsum(ofi) - running cumulative sum
(unbounded state)'
category: order_flow
version: v0.9.0 (Beta)
dimension: signal
status: Pre-release
required_inputs:
- best_bid_size
- best_ask_size
- ofi
output_column: cumulative_ofi
output_description: Cumulative sum of order flow imbalance
tags:
- cumulative
- ofi
- order_flow
- stateful
- accumulator
- microstructure
parameters: {}
formula: cumsum(ofi, 0)