Skip to content

Average price calculation

The average entry price is the basis for PnL, the position zone in the order book and auto TP/SL. SmartDOM can calculate it in four ways.

Settings → Trading → Average price method. One setting for all instruments. Default: Dynamic.

When adding to a position all methods except Fixed give the same volume-weighted average. The difference shows on partial close: which lots are considered closed.

Method Rule Average
Dynamic Volume-weighted, as on the exchange. Recalculated when adding, unchanged on partial close. matches the exchange
FIFO First in, first out. On partial close the earliest lots are closed, the average is taken over the remaining ones. differs from the exchange
LIFO Last in, first out. The latest lots are closed. differs from the exchange
Fixed The average equals the first entry price and does not change when adding. Resets when the position closes to zero. differs from the exchange

Trades: buy 1 at 100, buy 1 at 110, sell 1 at 105. Current price 105.

Method Average Realized Unrealized
Dynamic 105 0 0
FIFO 110 +5 −5
LIFO 100 −5 +5
Fixed 100 +5 +5

The same example with a live calculation is shown under the setting.

image.png

  • Entry price and PnL in the Positions panel and on the order book PnL panel.
  • The coloured position zone in the order book: from the average to the current price, green in profit and red in loss.
  • The basis for auto Take Profit and Stop Loss.

image.png

  • A difference from the exchange is expected. Exchanges calculate only the dynamic average. With FIFO, LIFO and Fixed the average and realized PnL in the terminal differ from the exchange website. The actual balance does not depend on this.
  • Trade history is required. For FIFO, LIFO and Fixed the terminal rebuilds the position from your trades on the exchange. If the history does not reach the position opening, the dynamic average is shown. History depth by exchange: Binance spot unlimited, futures 6 months; Bybit 2 years; OKX 3 months; MEXC spot 30 days, futures 90; Bitget 90 days; KuCoin spot 7 days, futures 3 months.
  • Delayed recalculation. During active trading the average updates about a second after the last trade.
  • PnL is calculated from the order book. The terminal takes the best price from its order book, while exchanges show futures PnL by mark price. During sharp moves the numbers may differ.