Skip to main content

mzMarketDepth

The mzMarketDepth indicator visualizes limit orders resting in the order book (Depth Of Market). It displays DOM data on the chart as a historical heatmap and as a real-time histogram on the right chart margin. The indicator includes liquidity analysis, liquidity migration tracking, order book imbalance detection, quantitative depth metrics, and alert levels.

Data required: Level 2 (DOM data)

Key Features

  • Real-time DOM histogram on the right chart margin with bid/ask ladders
  • Historical DOM heatmap on past chart bars with 4 filtering modes
  • 4 color modes — Solid, Saturation, Heatmap, GrayScaleHeatmap
  • Hold levels — extend significant DOM levels beyond their original scope
  • Hold higher volume — track maximum liquidity spikes per price level per bar
  • Liquidity plots — overall bid/ask liquidity as lines or candles (OfferBid, OfferBidDelta, BidOfferDelta)
  • Liquidity Migration — track adding and removing of limit orders in the DOM
  • Order book Imbalance — percentage-based bid/ask imbalance detection with threshold
  • Quantitative Depth — HQA, UQ, AC metrics for high-frequency order book analysis
  • Alert Levels — interactive support/resistance levels with cross/touch alerts
  • Cumulative depth lines — running totals on each DOM side
  • Pop-up info — detailed level information on mouse hover

Real-time DOM

The real-time DOM displays a colored histogram (ladders) of current bid and ask limit orders on the right chart margin. The number of visible levels is controlled by the Depth of market setting — this reflects the visible portion of the order book provided by the exchange (e.g., ES provides 10 levels nearest to the current price).

Color Modes

ModeDescription
SolidUniform selected color for all levels
SaturationColor intensity scales with volume — larger orders are more saturated. 4 presets available
HeatmapMulti-color gradient from cool to hot based on volume
GrayScaleHeatmapMonochrome intensity gradient

Imbalance Detection

When Imbalance: show is enabled, individual DOM levels where volume is disproportionate relative to the average volume on that side are highlighted. The Imbalance: ratio controls the threshold — for example, a ratio of 2 means all volumes that are two times greater than the average volume of the given DOM side will be marked as imbalanced.

Extreme Volume Coding

When Code extremal is enabled, DOM levels with volumes in the extreme range are rendered using the Extremal Bid / Extremal Offer colors and text colors, making large resting orders stand out visually.

Cumulative Lines

When Cumulative: show is enabled, two lines display the running cumulative volume level by level on each DOM side. This shows how total depth builds up from the best bid/ask outward.

Historical DOM

The historical DOM renders order book snapshots on past chart bars as a colored heatmap. Each price level shows the resting limit order volume at the time the bar was forming.

Filtering Modes

ModeDescription
PercentageDisplay only limit orders with volume above a given percentage of the maximum order size. For example, 60% with a 100-lot maximum displays only 41-lot orders or greater. If the maximum grows to 200-lot, the threshold adjusts to 81-lot
AbsoluteDisplay only limit orders with volume greater than or equal to a fixed contract value
AdaptiveLessUses the initial percentage as a starting point and slightly adjusts the minimum display threshold over time. Produces a moderately filtered view that adapts to changing order sizes
AdaptiveMoreCalculates the minimal DOM order size to display starting from DOM initialization and maintains it. Produces a strictly filtered view. Both adaptive modes provide a clear historical DOM picture that automatically adapts to future orders' sizes

Hold Levels

When Hold levels is enabled, DOM levels that move out of the visible depth-of-market scope continue to be displayed. The actual liquidity may no longer be there, but the last known quantities are kept for analysis. Use Extend levels, px to project held levels onto the right chart margin.

Hold Higher Volume

When Hold higher volume is enabled, only the maximum limit order volume observed within the current bar at each price level is displayed. This lets you spot liquidity spikes — moments when large orders briefly appeared at a level.

Display Options

  • Show volumes — display volume numbers on historical DOM levels
  • Show max volumes — show maximum volume in brackets next to the real-time volume
  • Show pop-up info — detailed level information on mouse hover
  • History depth, bars — maximum number of chart bars for which historical DOM is rendered (range: 10–10000). Use smaller values if you have performance issues

Liquidity

Liquidity plots show overall (total) DOM liquidity at the bottom or top of the chart. These plots aggregate all visible bid and ask levels into a summary view.

Plot Types

TypeDescription
OfferBidTwo lines — total volume on Offer side and total volume on Bid side
OfferBidDeltaOne line or candles — total Offer volume minus total Bid volume
BidOfferDeltaOne line or candles — total Bid volume minus total Offer volume

Plot Styles

StyleDescription
LineContinuous line for all plot types
CandleCandle representation for OfferBidDelta and BidOfferDelta types

Liquidity Cross pattern: On OfferBid plots, a symmetrical cross can form where bid and ask liquidity lines intersect. An entry can be made after the right parts of the cross break its low and high bound.

Liquidity Migration

Liquidity Migration tracks the process of adding and removing limit orders in the DOM. Individual migration events are shown as colored markers at the price level where they occur.

Migration Markers

MarkerDefault ColorDescription
Added OfferFuchsiaLimit orders added to the ask side
Added BidAquaLimit orders added to the bid side
Removed OfferYellowLimit orders removed from the ask side
Removed BidGreenLimit orders removed from the bid side

Only events exceeding the Added volume filter or Removed volume filter thresholds are displayed.

Overall Migration Plots

Overall migration plots aggregate migration activity into summary lines or candles at the bottom/top of the chart.

  • Overall methodDiscrete calculates migration per each price level and then sums on each Level 2 update. Totals sums liquidity on each price level on each Level 2 update and then calculates migration
  • Overall type — OfferBid, OfferBidDelta, or BidOfferDelta (same as Liquidity plot types)
  • Cumulate — when enabled, migration accumulates from bar to bar. Migration for a new bar starts from the migration value of the previous bar

Interpreting Liquidity Migration

  • Added Bid clusters at a price level suggest passive buy interest building — potential support
  • Removed Offer clusters above the price suggest sellers pulling back — potential for upside
  • Added Offer clusters above the price suggest passive sell interest — potential resistance
  • Removed Bid clusters below the price suggest buyers pulling back — potential for downside
  • Combine with the overall migration plots to see the net direction of order book changes

Imbalance

Order book imbalance is calculated as the percentage ratio of buy and sell limit order total quantities. When the imbalance exceeds the threshold, it is plotted as a line on the chart.

  • Imbalance, % — threshold to display imbalance (default: 20%). Changing this value does not affect historical bars
  • Bid imbalance — line style when bid side dominates
  • Offer imbalance — line style when offer side dominates
  • No imbalance — line style when bid and offer are balanced

Note: When Imbalance: Show is enabled, mzMarketDepth auto-scales the chart to fit the DOM. To disable this, uncheck the Auto scale option in the Visual section of NinjaTrader's built-in settings.

Quantitative Depth

Quantitative Depth provides three metrics that analyze high-frequency order book behavior at configurable intervals.

MetricDescription
HQA (High Quoting Activity)Detects price levels where limit orders are being placed and canceled at a high rate — indicates active algorithmic participation
UQ (Unbalanced Quoting)Identifies asymmetric quoting behavior between bid and ask sides — may signal directional intent
AC (Abnormal Cancellation)Flags levels where an unusually high proportion of placed orders are subsequently canceled — potential spoofing or order faking activity
  • Interval, ms — calculation interval in milliseconds (default: 1000)
  • Output — enable data output for external analysis

Levels

Alert levels let you place interactive horizontal lines on the chart at significant price levels. Each level acts as a support or resistance marker with configurable alerts.

Adding and Removing Levels

ActionDefault Shortcut
Add a levelLeft Mouse Click + Left Shift
Remove a levelLeft Mouse Click + Left Shift on an existing level, or click the remove button
Adjust level durationLeft Mouse Click + Left Alt on a level
Drag a levelClick left mouse button on the level (don't hold), move the cursor, then click again

Click inside a Footprint bar or Volume profile to set that visual as the starting point of the level.

Level Settings

  • Support level / Resistance level — default line styles (support is below price, resistance is above)
  • Value position — Left, Right, AboveLeft, AboveRight, or None
  • Alert on — LevelCross or LevelTouch
  • Rearm — re-enable the alert after it fires. Rearm interval, sec controls the cooldown (0 = immediate rearm)

Note: Levels are saved in the workspace XML file when you click Save workspace. Levels not saved in the workspace file will not be restored after reloading the indicator or re-establishing the data connection. You can export levels or replicate them on another chart using Templates > Save as from the chart context menu.

Use Cases for ES

The following presets demonstrate common mzMarketDepth configurations for E-mini S&P 500 (ES). Each use case lists only settings that differ from defaults.

Real-time DOM Heatmap with Imbalance

Visualize current order book depth with imbalanced levels highlighted.

SettingValue
Show histogramtrue
Color mode (Realtime DOM)Heatmap
Code extremaltrue
Imbalance: showtrue
Imbalance: ratio2
Cumulative: showtrue
Ladders: width, px250

Heatmap coloring gives instant visual weight to the largest resting orders. Imbalance ratio of 2 highlights levels with twice the average volume on their side. Cumulative lines show how total depth builds up from the inside out. Extreme volume coding in a different color makes the biggest orders unmissable. Useful for scalping — watch for imbalanced levels that align with cumulative depth buildups.

Historical Support/Resistance from DOM Levels

Identify significant historical liquidity levels that acted as support or resistance.

SettingValue
Show (Historical DOM)true
Filtering modeAdaptiveLess
Display volume, %70
Extreme volume, %15
Code extremal (Historical DOM)true
Color mode (Historical DOM)Saturation
Hold levelstrue
Extend levels, px50
Hold higher volumetrue

AdaptiveLess filtering adapts thresholds over time for a clean view. 70% display volume shows only the top 30% of orders. Hold levels extends significant levels forward — even after they leave the visible DOM depth, you can see where large orders were resting. Hold higher volume captures fleeting liquidity spikes. Extreme volume coding makes the largest historical levels stand out. Look for price reactions at held extreme levels.

Liquidity Migration Tracking

Track where large limit orders are being added and removed in real time.

SettingValue
Show (Liquidity Migration)true
Added volume filter50
Removed volume filter50
Show Overall (Liquidity Migration)true
Overall type (Liquidity Migration)OfferBidDelta
Plot (Liquidity Migration)Candle
Cumulatetrue
Show Overall (Liquidity)true
Overall type (Liquidity)OfferBid
Plot (Liquidity)Line

Migration markers on the chart show where 50+ contract orders are being placed and pulled. OfferBidDelta candles at the bottom summarize net migration direction — positive candles mean more offer-side migration (selling pressure building), negative means bid-side (buying pressure). Cumulate mode shows the running total across bars. Liquidity OfferBid lines at the top show absolute bid/ask depth. Look for migration divergence: price rising while bid migration is negative (buyers pulling) warns of potential reversal.

DOM Imbalance Scalping

Use order book imbalance as a real-time directional bias for scalping entries.

SettingValue
Show (Imbalance)true
Imbalance, %15
Show histogramtrue
Color mode (Realtime DOM)Saturation
Imbalance: show (Realtime DOM)true
Imbalance: ratio1.5
Cumulative: showtrue

Two layers of imbalance detection work together: the Imbalance section plots the overall bid/ask ratio as a line, while the Realtime DOM imbalance highlights individual levels. A 15% imbalance threshold on the overall ratio catches moderate shifts. Ratio 1.5 on individual levels highlights any level 50% above average. When the imbalance line shows bid dominance and the DOM histogram shows bid-side imbalanced levels clustering, the market has upward pressure. Enter on pullbacks within that bias.

Comprehensive Market Depth Analysis

Full-featured setup combining historical DOM, liquidity, migration, and imbalance for swing analysis on ES.

SettingValue
Show (Historical DOM)true
Filtering modePercentage
Display volume, %60
Extreme volume, %20
Code extremal (Historical DOM)true
Color mode (Historical DOM)Heatmap
Hold levelstrue
Show Overall (Liquidity)true
Overall type (Liquidity)BidOfferDelta
Plot (Liquidity)Candle
Plots position (Liquidity)Top
Show (Liquidity Migration)true
Added volume filter30
Removed volume filter30
Show Overall (Liquidity Migration)true
Overall type (Liquidity Migration)OfferBidDelta
Cumulatetrue
Plots position (Liquidity Migration)Bottom
Show (Imbalance)true
Imbalance, %20

Four views working together: historical DOM heatmap reveals where large orders rested, liquidity BidOfferDelta candles at the top show net depth bias, migration at the bottom tracks order flow changes, and the imbalance line captures ratio shifts. Look for convergence — when historical extreme levels, positive liquidity delta, and bid-side migration all align at a price, that level has strong support. Best on 5–15 min charts with several hours of data loaded.

Settings Reference

Common

SettingDefaultDescription
Depth of market10Number of DOM levels to display (range: 1–1000). Reflects the visible portion of the exchange order book
Multiple Market MakerfalseEnable for stock markets with multiple market makers. Do not enable for futures via IQFeed
BidDodgerBlueColor for buy-side limit orders
OfferSteelBlueColor for sell-side limit orders
Extremal BidLimeColor for extreme buy-side limit orders
Extremal OfferCrimsonColor for extreme sell-side limit orders
Bid textWhiteText color for bid volume values
Offer textWhiteText color for offer volume values
Extremal Bid textBlackText color for extreme bid values
Extremal Offer textBlackText color for extreme offer values
Level min height, px4Minimum pixel height per DOM level (range: 0–100)

Real-time DOM

SettingDefaultDescription
Show histogramtrueShow DOM histogram ladders on the right margin
Histogram borderBlackBorder style for histogram bars
Show volumestrueShow volume numbers on DOM levels
Side total as %falseShow each side's total as a percentage
Volumes filter0Hide levels with volume below this value
Volume fontMontserrat, 12ptFont for volume text
Code extremalfalseHighlight extreme volumes with extreme colors
Color modeSolidColor rendering — Solid, Saturation, Heatmap, or GrayScaleHeatmap
Saturation preset3Saturation level (range: 1–4)
Imbalance: showfalseShow imbalanced DOM levels
Imbalance: ratio1.5Ratio threshold for imbalance detection (range: 0.01–100)
Imbalance: Bid colorDarkGreenColor for bid-side imbalance
Imbalance: Offer colorFirebrickColor for offer-side imbalance
Cumulative: showtrueShow cumulative bid/offer depth lines
Cumulative: Bid colorGreen, 2pxLine style for cumulative bid depth
Cumulative: Offer colorRed, 2pxLine style for cumulative offer depth
Ladders: width, px200Maximum histogram width in pixels (range: 40–1900)
Ladders: extendfalseExtend all ladders to full width
Margin: left, px5Left margin in pixels (range: 0–1000)
Margin: right, px5Right margin in pixels (range: 0–1000)
Margin: control righttrueControl the minimum width of the chart right margin

Historical DOM

SettingDefaultDescription
ShowtrueShow historical DOM on the chart
History depth, bars2000Maximum bars for historical DOM display (range: 10–10000)
Filtering modePercentageFiltering mode — Percentage, Absolute, AdaptiveLess, or AdaptiveMore
Display volume, %100Display levels above this percentage of the maximum order size (Percentage/Adaptive modes)
Extreme volume, %20Top percentage of displayed volumes treated as extreme (Percentage/Adaptive modes)
Display volume50Minimum volume in contracts to display (Absolute mode)
Extreme volume500Volumes at or above this contract size are extreme (Absolute mode)
Code extremalfalseHighlight extreme volumes with extreme colors
Color modeSaturationColor rendering — Solid, Saturation, Heatmap, or GrayScaleHeatmap
Saturation preset4Saturation level (range: 1–4)
Hold levelstrueContinue displaying levels that move out of DOM scope
Extend levels, px0Extend held levels onto the right margin by this many pixels (range: 0–10000)
Hold higher volumefalseDisplay only the maximum volume observed per price level per bar
Show pop-up infofalseShow level details on mouse hover
Pop-up info fontFont for the pop-up window
Show volumesfalseDisplay volume numbers on historical DOM levels
Show max volumesfalseShow max volume in brackets next to real-time volume
Volume fontMontserrat, 10ptFont for volume text

Liquidity

SettingDefaultDescription
Show OverallfalseShow overall liquidity plots
Overall typeBidOfferDeltaPlot type — OfferBid, OfferBidDelta, or BidOfferDelta
PlotLinePlot style — Line or Candle
Plot Bid/Up-candleCyan, 2pxLine style for bid liquidity / color for up-candles
Plot Offer/Down-candleRed, 2pxLine style for offer liquidity / color for down-candles
Plots positionTopPlots placement — Top or Bottom
Plots height, px140Height of plots area (range: 10–1000)
Plots backgroundtrueShow background behind plots
Plots background colorBlackBackground color
Plots background opacity, %60Background transparency (range: 0–100)
Grid linesfalseShow grid lines on plots

Liquidity Migration

SettingDefaultDescription
ShowfalseShow liquidity migration markers
Added volume filter20Minimum added volume to display a marker
Removed volume filter20Minimum removed volume to display a marker
Added offerFuchsiaColor for added ask-side orders
Added bidAquaColor for added bid-side orders
Removed offerYellowColor for removed ask-side orders
Removed bidGreenColor for removed bid-side orders
Show OverallfalseShow overall migration plots
Overall methodTotalsCalculation method — Discrete or Totals
Overall typeOfferBidDeltaPlot type — OfferBid, OfferBidDelta, or BidOfferDelta
CumulatefalseAccumulate migration values from bar to bar
PlotCandlePlot style — Line or Candle
Plot Bid/Up-candleCyan, 2pxLine style for bid migration / color for up-candles
Plot Offer/Down-candleRed, 2pxLine style for offer migration / color for down-candles
Plots positionBottomPlots placement — Top or Bottom
Plots height, px140Height of plots area (range: 10–1000)
Plots backgroundtrueShow background behind plots
Plots background colorBlackBackground color
Plots background opacity, %60Background transparency (range: 0–100)
Grid linesfalseShow grid lines on plots

Imbalance

SettingDefaultDescription
ShowtrueShow order book imbalance line
Imbalance, %20Threshold percentage for imbalance display. Changing this value does not affect historical bars
Bid imbalanceYellowLine style for bid-side imbalance
Offer imbalanceYellowLine style for offer-side imbalance
No imbalanceGrayLine style when bid/offer are balanced

Quantitative Depth

SettingDefaultDescription
EnablefalseEnable quantitative depth metrics
Interval, ms1000Calculation interval in milliseconds
OutputfalseEnable data output for external analysis

Notifications

SettingDefaultDescription
Extreme alertfalseAlert when extreme limit order volume appears
Extreme soundding.wavSound file for extreme volume alerts
tip

See Sound Files for the full list of pre-installed sounds and how to add custom WAV files.

General

SettingDefaultDescription
Optimize render performancetrueLimit rendering time to free CPU/GPU resources
Maximal render time, ms100Maximum rendering time before frame skip. Chart may flash — adjust for balance between performance and visual comfort
Refresh delay250Refresh delay in milliseconds

Performance Tips

mzMarketDepth processes Level 2 market data on every DOM update, which is significantly more data than Level 1 tick-based indicators. To keep charts responsive:

  • Set History depth, bars to the minimum you need — 2000 bars of historical DOM data can consume significant memory
  • Use Optimize render performance (enabled by default) and adjust Maximal render time, ms to 20–50 ms if the chart lags
  • Use AdaptiveLess or AdaptiveMore filtering modes instead of Percentage — adaptive modes automatically manage the display threshold and reduce the number of rendered levels
  • Reduce Depth of market if you don't need all 10 levels
  • Disable Hold levels and Hold higher volume when not needed — they increase the number of rendered elements
  • Remove unused indicators from the chart or use the visibility toggle (eye button) to temporarily hide indicators you need only periodically
  • For multi-session analysis, use two mzMarketDepth instances with different Start/Stop time settings instead of one instance covering the full day