OPEN-SOURCE SCRIPT

Depth of Market (DOM) [LuxAlgo]

Updated
The Depth Of Market (DOM) tool allows traders to look under the hood of any market, taking price and volume analysis to the next level. The following features are included: DOM, Time & Sales, Volume Profile, Depth of Market, Imbalances, Buying Pressure, and up to 24 key intraday levels (it really packs a punch).

snapshot

As a disclaimer, this tool does not use tick data, it is a DOM reconstruction from the provided real-time time series data (price and volume). So the volume you see is from filled orders only, this tool does not show unfilled limit orders.

Traders can enable or disable any of the features at will to avoid being overwhelmed with too much information and to make the tool perform faster.

The features that have the biggest impact on performance are Historical Data Collection, Key Levels (POC & VWAP), Time & Sales, Profile, and Imbalances. Disable these features to improve the indicator computational performance.

🔶 DOM

snapshot

This is the simplest form of the tool, a simple DOM or ladder that displays the following columns:

  • PRICE: Price level
  • BID: Total number of market sell orders filled or limit buy orders filled.
  • SELL: Sell market orders
  • BUY: Buy market orders
  • ASK: Total number of market buy orders filled or limit sell orders filled.


The DOM only collects historical data from the last 24 hours and real-time data.

Traders can select a reset period for the DOM with two options:

  • DAILY: Resets at the beginning of each trading day
  • SESSIONS: Resets twice, as DAILY and 15.5 hours later, to coincide with the start of the RTH session for US tickers.


The DOM has two main modes, it can display price levels as ticks or points. The default is automatic based on the current daily volatility, but traders can manually force one mode or the other if they wish.

For convenience, traders have the option to set the number of lines (price levels), and the size of the text and to display only real-time data.

By default, the top price is set to 0 so that the DOM automatically adjusts the price levels to be displayed, but traders can set the top price manually so that the tool displays only the desired price levels in a fixed manner.

🔹 Volume Profile

snapshot

As additional features to the basic DOM, traders have access to the volume profile histogram and the total volume per price level.

This helps traders identify at a glance key price areas where volume is accumulating (high volume nodes) or areas where volume is lacking (low volume nodes) - these areas are important to some traders who base their decision-making process on them.

🔹 Imbalances

snapshot

Other added features are imbalances and buying pressure:

  • Interlevel Imbalance: volume delta between two different price levels
  • Intralevel Imbalance: delta between buy and sell volume at the same price level
  • Buying Pressure Percent: percentage of buy volume compared to total volume


Imbalances can help traders identify areas of interest in the price for possible support or resistance.

🔹 Depth

snapshot

Depth allows traders to see at a glance how much supply is above the current price level or how much demand is below the current price level.

Above the current price level shows the cumulative ask volume (filled sell limit orders) and below the current price level shows the cumulative bid volume (filled buy limit orders).

🔶 KEY LEVELS

snapshot

The tool includes up to 24 different key intraday levels of particular relevance:

Previous Week Levels

  • PWH: Previous week high
  • PWL: Previous week low
  • PWM: Previous week middle
  • PWS: Previous week settlement (close)


Previous Day Levels

  • PDH: Previous day high
  • PDL: Previous day low
  • PDM: Previous day middle
  • PDS: Previous day settlement (close)


Current Day Levels

  • OPEN: Open of day (or session)
  • HOD: High of day (or session)
  • LOD: Low of day (or session)
  • MOD: Middle of day (or session)


Opening Range

  • ORH: Open range high
  • ORL: Open range low


Initial Balance

  • IBH: Initial balance high
  • IBL: Initial balance low


VWAP

  • +3SD: Volume weighted average price plus 3 standard deviations
  • +2SD: Volume weighted average price plus 2 standard deviations
  • +1SD: Volume weighted average price plus 1 standard deviation
  • VWAP: Volume weighted average price
  • -1SD: Volume weighted average price minus 1 standard deviation
  • -2SD: Volume weighted average price minus 2 standard deviations
  • -3SD: Volume weighted average price minus 3 standard deviations


  • POC: Point of control


Different traders look at different levels, the key levels shown here are objective and specific areas of interest that traders can act on, providing us with potential areas of support or resistance in the price.

🔶 TIME & SALES

snapshot

The tool also features a full-time and sales panel with time, price, and size columns, a size filter, and the ability to set the timezone to display time in the trader's local time.

The information shown here is what feeds the DOM and it can be useful in several ways, for example in detecting absorption. If a large number of orders are coming into the market but the price is barely moving, this indicates that there is enough liquidity at these levels to absorb all these orders, so if these orders stop coming into the market, the price may turn around.

🔶 SETTINGS

  • Period: Select the anchoring period to start data collection, DAILY will anchor at the start of the trading day, and SESSIONS will start as DAILY and 15.5 hours later (RTH for US tickers).
  • Mode: Select between AUTO and MANUAL modes for displaying TICKS or POINTS, in AUTO mode the tool will automatically select TICKS for tickers with a daily average volatility below 5000 ticks and POINTS for the rest of the tickers.
  • Rows: Select the number of price levels to display
  • Text Size: Select the text size


🔹 DOM

  • DOM: Enable/Disable DOM display
  • Realtime only: Enable/Disable real-time data only, historical data will be collected if disabled
  • Top Price: Specify the price to be displayed on the top row, set to 0 to enable dynamic DOM
  • Max updates: Specify how many times the values on the SELL and BUY columns are accumulated until reset.
  • Profile/Depth size: Maximum size of the histograms on the PROFILE and DEPTH columns.
  • Profile: Enable/Disable Profile column. High impact on performance.
  • Volume: Enable/Disable Volume column. Total volume traded at price level.
  • Interlevel Imbalance: Enable/Disable Interlevel Imbalance column. Total volume delta between the current price level and the price level above. High impact on performance.
  • Depth: Enable/Disable Depth, showing the cumulative supply above the current price and the cumulative demand below. Impact on performance.
  • Intralevel Imbalance: Enable/Disable Intralevel Imbalance column. Delta between total buy volume and total sell volume. High impact on performance.
  • Buying Pressure Percent: Enable/Disable Buy Percent column. Percentage of total buy volume compared to total volume.
  • Imbalance Threshold %: Threshold for highlighting imbalances. Set to 90 to highlight the top 10% of interlevel imbalances and the top and bottom 10% of intra-level imbalances.
  • Crypto volume precision: Specify the number of decimals to display on the volume of crypto assets


🔹 Key Levels

  • Key Levels: Enable/Disable KEY column. Very high performance impact.
  • Previous Week: Enable/Disable High, Low, Middle, and Close of the previous trading week.
  • Previous Day: Enable/Disable High, Low, Middle, and Settlement of the previous trading day.
  • Current Day/Session: Enable/Disable Open, High, Low and Middle of the current period.
  • Open Range: Enable/Disable High and Low of the first candle of the period.
  • Initial Balance: Enable/Disable High and Low of the first hour of the period.
  • VWAP: Enable/Disable Volume-weighted average price of the period with 1, 2, and 3 standard deviations.
  • POC: Enable/Disable Point of Control (price level with the highest volume traded) of the period.


🔹 Time & Sales

  • Time & Sales: Enable/Disable time and sales panel.
  • Timezone offset (hours): Enter your time zone\'s offset (+ or −), including a decimal fraction if needed.
  • Order Size: Set order size filter. Orders smaller than the value are not displayed.


🔶 THANKS

Hi, I'm makit0 coder of this tool and proud member of the LuxAlgo Opensource team, it's an honor to be part of the LuxAlgo family doing something I love as it's writing opensource code and sharing it with the world. I'd like to thank all of you who use, comment on, and vote for all of our open-source tools, and all of you who give us your support.

And of course thanks to the PineCoders family for all the work in front of and behind the scenes that makes the PineScript community what it is, simply the best.

Peace, Love & PineScript!
Release Notes
- Minor changes
bidaskdashboarddeltadepthofmarketDOMkeylevelluxalgoorderbookPivot points and levelssentimentstatistics

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Get access to our exclusive tools: luxalgo.com

Join our 150k+ community: discord.gg/lux

All content provided by LuxAlgo is for informational & educational purposes only. Past performance does not guarantee future results.
Also on:

Disclaimer