On dYdX, we use three different prices:
Mid Market Price
The Mid Market Price is determined by the orderbook and is simply the mid point or average between the lowest ask (sell price) and highest bid (buy price) on the orderbook.
The Index Price is an aggregate price based off price data from multiple exchanges and is used to trigger stop orders. To provide optimal performance, the index price is managed off-chain to ensure minimal delay and slippage in stop order triggering.
Since the index price is aggregated across multiple exchanges, users are protected from events such as flash crashes on any single exchange.
The Oracle Price is also an aggregate price calculated using multiple on-chain price oracles. Collateralization and liquidations on dYdX are determined using the oracle prices of each asset. You can learn more about the oracles dYdX uses here: https://help.dydx.exchange/en/articles/2953486-usd-price-data-on-dydx
Since the oracle price is also an aggregate price, it offers similar protection from flash crashes as the index price does.