Skip to content

Indicator · BOOK

OFI

Size joining and leaving the best bid and ask, added up: which side the top of the book leans to.

What it shows

OFI, order flow imbalance, watches only the top of the order book: the best bid, the best ask and the size resting at each. Every time the book changes, it scores the change at the top, and the chart adds the scores up bar after bar into a line in its own pane under the price, in the base asset.

How each change at the top scores
At the best bid or askScore
Size added to the best bid, or a higher bid appearsPlus that size.
Size leaves the best bid, or the best bid drops lowerMinus that size.
Size added to the best ask, or a lower ask appearsMinus that size.
Size leaves the best ask, or the best ask moves higherPlus that size.

How it works

This is the order flow imbalance of Cont, Kukanov and Stoikov: buyers lift the book by adding bids and taking asks, sellers press it by adding asks and taking bids. A trade at the touch counts through the size it takes from the book, a cancel through the size it removes.

  1. 1Quotes going nowhere

    In a range the best bid and ask move up and down by turns, the scores cancel, and the line drifts.

  2. 2Quotes stepping up

    When the best bid and ask keep moving up, each new higher bid adds its size and each ask that leaves adds what it held. The line climbs with the rally.

  3. 3A large ask eaten at the touch

    Once a large ask is the best ask, every buy that takes from it scores the size it took, so OFI jumps while the wall is traded through.

  4. 4Only the touch counts

    A large bid well below price is pulled. The book changed, but not at the best bid, so OFI barely moves: the Walls and Liquidity heatmap layers are the ones that show it.

How to use it

Turn on OFI in the Indicators menu, in its Flow group; it draws in a pane of its own. Its settings set the line’s color and width, Runs on (the chart’s timeframe or a fixed one) and Method: Live book updates, the default, adds up every change at the best bid and ask while the chart is open; Per minute (as backtests) compares each minute’s closing best bid and ask with the minute before, from the recorded book, so it covers bars from before you opened the chart and matches what a backtest sees.

  • Read its direction and swings; it starts at zero when you open the chart, so its level says nothing.
  • Compare it with CVD: CVD counts market orders, OFI counts what happened to the quotes, cancels and new orders included.
  • A rise in price with OFI flat or falling says the quotes did not follow the trades up.

What it does not tell you

  • On Live book updates it comes from the live order book while the chart is open and is not rebuilt from the recorded book, so bars from before you opened the chart have no OFI. The examples here have a synthetic book from the start.
  • Per minute (as backtests) sees only each minute’s closing quotes, with the size resting within 0.25% of the mid standing in for the size at the touch, so it misses changes within the minute. The forming minute counts as it stands and settles when the minute closes.
  • Size further from the touch, however large, does not count until it becomes the best bid or ask.
  • It cannot tell a cancel from a trade, or one order from many: it sees the size at each price. A score says the size changed, not who changed it or why.
  • Quotes change many times a second; it says how the top of the book leaned, not where price goes next.

Test it in the Strategy Builder

Backtests compute OFI minute by minute from the recorded book. Set the line’s Method to Per minute (as backtests) to see on the chart the values a backtest reads. For other ideas about the book, use Book imbalance and the order book event nodes.

Other layers in this family

  • TFINet delta over all delta in a window of bars, from −100% (all sells) to +100% (all buys), smoothed.
  • CVDMarket buys minus market sells, added up bar after bar: who has been more aggressive, and how much.

Questions

No. CVD adds up market buys minus market sells. OFI adds up how the size at the best bid and ask changed, which includes new orders and cancels as well as trades. They often move together and can split when quotes are pulled or stacked without trading.

On Live book updates, the default, it is counted from the live order book as each update arrives, from when the chart opened, and is not rebuilt for earlier bars. Set its Method to Per minute (as backtests) to build it from the recorded book for every bar.

See it on a real market

Trading Glass is in private beta and reads Binance data. Every layer described here runs in the chart on that data.