Login Page - Create Account

Technical Studies Reference


Market Depth Historical Graph

Introduction

The Market Depth Historical Graph study displays by default at each chart column the highest market depth quantity at each price level, which occurred during the timeframe of the chart bar, as a color-coded rectangle.

If the Use Last Quantity Instead Of Max Quantity For Bars Input is set to Yes, then the last market depth quantity at a price level for the chart column will be displayed instead of the maximum quantity.

This study only works with Intraday charts.

The market depth quantities displayed after the last bar in the chart from the last column currently displayed in the chart, are displayed in the space between the last column with market depth data and the right side of the chart when the Display Market Depth Quantities After Last Bar Input is set to Yes. These values will match with the data in File >> Open Market Depth Window when the Depth Quantity Type to Display After Last Bar is set to Last Depth.

The maximum market depth quantity at a price level is only shown at the chart bar during the timeframe it occurred. For subsequent bars, if there has been no market depth update at that price level, the last market depth quantity is displayed until it is deleted by the market depth data stream.

In order for the Market Depth Historical Graph study to display the color-coded rectangles for market depth, historical market depth data must be collected for the chart's symbol. Refer to Step by Step Instructions for instructions.

Replaying market depth is also supported simply by using the Chart Replay feature.

During the formation of a chart bar which covers a certain span of time, the market depth bid and ask values are continuously varying during that timeframe. Therefore, for a given price level, there can be and most likely are both bid and ask market depth quantities recorded. However, only the bid side or ask side quantity at that price level is displayed depending upon which one is dominant. Both are not displayed.

Below are examples of the Market Depth Historical Graph study on an Intraday chart:

Step by Step Instructions

  1. Select Global Settings >> Symbol Settings on the menu.
  2. Locate the symbol or symbol pattern for the Symbol in the list of symbols, that you want to use the Market Depth Historical Graph study with.
  3. Select the Intraday tab.
  4. Enable the Record Market Depth Data option.
  5. Press OK.
  6. Reconnect to the data feed with File >> Disconnect and File >> Connect to Data Feed after altering the Symbol Settings.
  7. Market Depth historical data is not currently provided. It can only be stored in real time when connected to the data feed. Therefore, it is necessary to stay connected to the data feed as much as possible to avoid missing data. If market depth data is not provided for the symbol, then only the Best Bid and Ask data will be stored. In this particular case, this will limit the number of levels to just one.
  8. Go to the chart you want to add the Market Depth Historical Graph study to.
  9. Select Analysis >> Studies.
  10. In the list of the Studies Available, select Market Depth Historical Graph.
  11. Press the Add button.
  12. Press the Settings button. Set the Study Inputs as required.
  13. Press OK.
  14. Press OK.
  15. As the market depth data starts to be received, you will see the color-coded rectangles on the chart. Sierra Chart will need to be connected to the data feed with File >> Connect to Data Feed and the market needs to be open for the symbol in order to receive market depth data.

    Otherwise, there will be no market depth data and you will not see any color-coded rectangles on the chart unless it has been previously recorded for the symbol.
  16. The market depth data is permanently recorded in depth files. One for each day. These files are located in the MarketDepthData subfolder of the Sierra Chart Data Files Folder. In the case of a Continuous Futures Contract chart, currently only historical market depth data will be displayed for the bars in the chart that are for the current futures contract symbol set with the Chart >> Chart Settings >> Symbol setting.
  17. To display lines on the chart at the most recent Bid and Ask prices at each chart bar, use the Bid and Ask Prices study. This is an optional study and not required.
  18. By default, historical market depth data is only loaded for the last 10 days of data in an Intraday chart if there is historical market depth data available for those days. To adjust this, select Chart >> Chart Settings. Increase or decrease the Use Number of Days to Load >> Market Depth setting. The default is 10.

Study Inputs

Bid Color

This is the maximum intensity color to use for price levels at which the Bid quantity is greater than the Ask quantity.

This should be set to a light color when using a dark background in the chart. The largest visible Bid market depth quantity will use this color.

It is not recommended to make this color the same as the Ask Color. Otherwise, it becomes impossible to distinguish Bid market depth from Ask market depth.

See the Block Coloring Logic section for more details.

Ask Color

This is the maximum intensity color to use for price levels at which the Ask quantity is greater than the Bid quantity.

This should be set to a light color when using a dark background in the chart. The largest visible Ask market depth quantity will use this color.

It is not recommended to make this color the same as the Bid Color. Otherwise, it becomes impossible to distinguish Bid market depth from Ask market depth.

See the Block Coloring Logic section for more details.

Minimum Volume Intensity Percent

This percentage is the intensity used for the blocks with the smallest, non-zero, market depth quantity among all of the visible blocks on the chart. The valid range for this Input is 0 to 90.

A greater value for this Input will effectively increase the visibility of blocks with little volume, but decrease the overall contrast. Whereas a lesser value for this Input will increase the contrast between blocks, but decrease the visibility of blocks for smaller market depth quantities. A value of 0 will make it so the blocks with the smallest, non-zero, market depth quantity among all of the visible blocks on the chart will have an intensity of 0 percent, effectively making them the same color as the chart background.

See the Block Coloring Logic section for more details.

Maximum Quantity For Coloring

If any visible market depth quantities are greater than this value, they will be colored as if they are equal to the Input value. This effects the overall range of quantity values used for the Block Coloring Logic.

The purpose of this Input is to prevent very large values from desaturating the rest of the graph. For example, if you were viewing a graph where most quantity values are in the range of 100~500, but there are one or two quantities that are over 5000, that would cause the large quantity values to stand out significantly while all of the other quantity values would be barely visible. With this Input, if it is set to a value of 500 or 600 for the example, the large quantity values would not stand out as much, and the details of the rest of the graph would be more visible.

Setting this to 0 means there is no maximum quantity limit.

Value Type for Graph Only Quantities Greater or Equal To

This Input controls how the value entered in the Graph Only Quantities Greater or Equal To is interpreted. The available options are the following:

  • Actual Value: This sets the value entered in the Graph Only Quantities Greater Or Equal To Input as the actual Market Depth value below which the data will not be drawn on the graph.
  • Percentage of Maximum Depth: This sets the value entered in the Graph Only Quantities Greater or Equal To Input as the Percentage of the maximum displayed depth below which the data will not be drawn on the graph.

It is important to note that when using the option Percentage of Maximum Depth this is the percentage of the highest viewable market depth value. Therefore, as scrolling through the chart, the actual value below which data is not displayed, will be constantly changing as the highest value viewable value changes. This is also the same method used to determine the range of colors that are used to color the graph.

Graph Only Quantities Greater Or Equal To

This Input sets the value for which a displayed depth at a particular price level and at a particular chart bar that are greater than or equal to the value determined by this setting and the Value Type for Graph Only Quantities Greater or Equal To will be displayed on the graph.

Any depth quantities below this threshold will be treated as if they were a quantity of zero. Since quantities below the threshold will be treated as if they are zero, this Input does affect the color shading of the blocks.

Setting this to 0 will effectively prevent any filtering.

When the Input Value Type for Graph Only Quantities Greater or Equal To is set to Percentage, values should be entered as whole percentages (for example - 20 for 20%). Additionally, any value greater than 100 is treated as 100%.

Extend Last Known Depth

When this is set to Yes, the last known market depth quantities will be drawn to extend forward into chart columns where no actual depth quantities are known, up to the right side of the chart, subject to the Percentage Of Fill Space To Display Market Depth Quantity Rectangles In Input.

This Input only has an effect when market depth data at a price level has been deleted and there has not been a market depth update at that price level at subsequent chart bars.

Show Quantity Numbers

This Input controls the display of the market depth quantities used for the colored blocks. The quantities are displayed on top of the colored blocks.

This Input has the following 4 options:

  • None: No quantity values are displayed.
  • In Bars Only: The quantities are only displayed in the price bars.
  • In Bars and After Last Bar: If the Input Display Market Depth Quantities After Last Bar is set to Yes then the quantity numbers are displayed in the price bars as well as the extended last bar on the right side of the chart. If the Input Display Market Depth Quantities After Last Bar is set to No then the quantities are only displayed in the price bars.
  • Only After Last Bar: If the Input Display Market Depth Quantities After Last Bar is set to Yes then the quantity numbers are only displayed in the extended last bar on the right side of the chart. If the Input Display Market Depth Quantities After Last Bar is set to No then no quantities are displayed.

If there is not enough space within the block to display the full number, the number will be clipped. This is something to be aware of. In this particular case you will need to increase the chart bar spacing.

Quantity Numbers Color

This is the color that is used for the displayed quantity numbers when the Show Quantity Numbers Input is set to Yes.

Display Market Depth Last Quantities After Last Bar

When this is set to Yes, the depth quantities for the last visible bar will be extended from the last bar to the right side of the chart, subject to the Percentage Of Fill Space To Display Market Depth Quantity Rectangles In Input. The depth values displayed are determined from the Input Depth Quantity Type to Display After Last Bar.

This column of blocks after the last bar which display the market depth quantities (when the Display Market Depth Last Quantities After Last Bar Input is set to Yes), will only update using market depth updates which have timestamps which are within the timeframe of the last bar. If the last bar is a variable timeframe bar, then they will only update using market depth updates with timestamps up to the timestamp of the last trade within that bar.

When a bar completes and before a new bar begins, the market depth data quantities displayed after the last bar, will not update until the new bar begins. This will cause them to appear delayed relative to the current market depth data displayed through other features displaying market depth like the Bid Size and Ask Size columns in the market data and trading columns on the right side of the chart, if enabled.

Depth Quantity Type to Display After Last Bar

This Input controls which data is displayed after the last bar when the Input Display Market Depth Last Quantities After Last Bar is set to Yes. This allows the depth data displayed after the last bar to display different information than what is in the last bar. The following options are available:

  • Maximum Depth: This displays the maximum depth value obtained at each price level.
  • Last Depth: This displays the last depth value at each price level.

Percentage Of Fill Space To Display Market Depth Quantity Rectangles In

For any depth quantities that are extended to the right side of the chart, such as from the Extend Last Known Depth or Display Market Depth Last Quantities After Last Bar Inputs, this Input controls how much of the fill space may be used for drawing those extensions.

A value of 0 means extensions will not enter the fill space, where as a value of 100 means extensions will fill all of the fill space. A value of 50 means extensions will fill into the left half of the fill space while the right half of the fill space remains untouched.

It is useful to set this to a value of less than 100 when Trade >> Draw DOM Graph on Chart is enabled.

Use Last Quantity Instead Of Max Quantity For Bars

This applies to price levels within bars where more than one depth quantity was recorded within the timeframe of the bar for that price level. When this Input is set to true, only the last quantity at the price level for the timeframe of the bar will be displayed, otherwise the maximum quantity at the price level within the timeframe of the bar will be displayed. This Input has no effect on the quantities that are displayed as extending beyond the end of a bar.

Font Size

This Input controls the size of the font that is used to display quantity values when the Input Show Quantity Numbers is set to anything other than None.

When this Input is set to a value of 0, the font size is set by the Chart Text font as defined in the Fonts and Text section of the Graphics Settings.

Maximum Levels to Display (0 for All)

This Input controls the total number of Market Depth levels that are displayed at each bar. The location of the levels is centered around the Last price of the bar.

Note that this is the total number of levels, including both Bid and Ask levels, not just the amount for one side.

Setting this Input to 0 will display all available Market Depth levels.

Block Coloring Logic

Historical market depth quantities are shown on the chart as colored blocks. Each block represents a market depth quantity within a particular time frame and price level. These blocks are colored such that blocks with greater quantities use a color that is closer to the corresponding color Input (Bid Color or Ask Color). Blocks with lesser quantities will appear faded.

Blocks are colored relative to the minimum and maximum historical market depth quantities that are currently within the visible chart bars. The maximum quantity is the greater of both the greatest Bid quantity and the greatest Ask quantity within the visible chart bars. The minimum quantity is the lesser of both the smallest non-zero Bid quantity and the smallest non-zero Ask quantity within the visible chart bars.

If the Maximum Quantity For Coloring Input is set to a value greater than zero, any historical market depth quantities that are greater than that value will be treated as equal to that value for the purposes of coloring. This Input value does not increase the maximum quantity value used for coloring if all visible historical market depth quantities are less than the Maximum Quantity For Coloring.

The study has separate color Inputs for the Bid side and the Ask side. The color used for a particular block is determined by the side with the greater quantity at that particular price level and chart column. Either the Bid quantity or the Ask quantity will be used.

Intensities for the entire graph are calculated independent of side. If the greatest historical Bid quantity is greater than the greatest historical Ask quantity, the intensity of the greatest historical Ask quantity will be less than the intensity of the greatest historical Bid quantity. Setting the color Inputs for both sides to the same color will make the Bid and Ask sides indistinguishable.

For the block (or blocks) with a quantity that matches the maximum quantity, the exact color Input for the dominant side of that block is used. Quantities less than the maximum quantity are faded into the chart background color.

For the block (or blocks) with a quantity that matches the minimum quantity, the color for that block will have an intensity equal to the Minimum Volume Intensity Percent Input. The only rare exception to this case is when the minimum quantity is equal to the maximum quantity, in which case the intensity will be 100%.

Intensity is the percentage of the dominant side Input color that is used over the chart background color. An intensity of 0% results in the chart background color, and an intensity of 100% results in the exact Input color. An intensity of 50% is half way between the chart background color and Input color.

The color intensities for blocks with quantities between the minimum quantity and the maximum quantity correspond to a linear scale between the Minimum Volume Intensity Percent and 100%.

Quantities of zero, if they need to be displayed, will use the same color as the chart background color.

Example Coloring With Default Settings

Here is an example of the colors and intensities that will be shown for a handful of quantity values using default settings.

Default Settings:

  • Bid Color = 128, 190, 255
  • Ask Color = 255, 255, 0
  • Minimum Volume Intensity Percent = 20
  • Chart Background Color = 0, 0, 0
Bid Ask Color Intensity
0 210 100% Maximum visible quantity (210).
0 110 60%
0 60 40%
0 0 0% No quantity (0), uses background color.
10 0 20% Minimum visible quantity (10), uses Minimum Volume Intensity Percent.
60 0 40%
160080%Maximum bid quantity (160) is only a fraction of the maximum visible quantity (210).

Example of Minimum Volume Intensity Percent

Here is an example of how different values of the Minimum Volume Intensity Percent can affect the same quantity values as above.

Bid Ask Minimum Volume Intensity Percent
0 -20- 40 60 80
0 210
0 110
0 60
0 0
10 0
60 0
160 0

Note that the minimum visible quantity (10) uses the Minimum Volume Intensity Percent for its intensity directly. The intensities for all other quantities are scaled proportionally between the Minimum Volume Intensity Percent and the maximum intensity of 100%.

Market Depth Historical Graph Not Displaying

Follow through the instructions here to resolve a problem where the Market Depth Historical Graph study does not display anything.

  1. The first step is to reconnect to the data feed. Stop here if the problem is resolved.
  2. Reset the defaults for the Market Depth Historical Graph study by opening the Study Settings window for the study (Analysis >> Studies >> [select study in Studies to Graph] >> Settings). Press the Reset Defaults button.
  3. Press OK.
  4. Press the Remove button on the Chart Studies window to remove the study.
  5. Add the Market Depth Historical Graph study again from the Studies Available list.
  6. Press OK. Stop here if the problem is resolved.
  7. Follow through the Step by Step Instructions. Be sure to enable the Record Market Depth Data option for the symbol or symbol pattern in the Global Symbol Settings.
  8. There must be market depth data available for the symbol. To verify this is the case open the market depth window through File >> Open Market Depth Window .
  9. Historical market depth data will only be displayed at the Date-Times in the chart at which Sierra Chart was connected to the data feed and market depth data is being recorded. It is necessary to follow through the Step by Step Instructions to set up the recording. Although the recording also happens when the Market Depth Historical Graph study is on the chart.
  10. Verify that there are data files present. Go to the \Data\MarketDepthData folder in the Sierra Chart installation folder on your system (usually C:\SierraChart), through your operating system file manager.

    This folder contains all of the market depth data files. The file extension is .depth. The filename format is [symbol].[UTC date].depth. The date on a market depth data file is the UTC date and covers a time span from 0:00:00 to 23:59:59 for that date in UTC time. If the file for a particular date does not exist, then there will be no data for that particular date in the chart.

    If the depth file does exist for a particular date but yet the data is not displayed on the chart, and the chart is updating in real-time and contains the Market Depth Historical Graph study, then as a last step, disconnect from the data feed with File >> Disconnect. Rename the market depth data file for the symbol and the current date to the same name with a .backup file extension. Connect to the data feed with File >> Connect to Data Feed. We would not normally expect this last procedure to really be necessary.

Market Depth Data Time Stamping During Real Time Updates and Replays

During real-time chart updating and also during Chart Replays, a chart that uses the market depth data in some way like through the Market Depth Window or when using the Market Depth Historical Graph study, it is important to be aware of time stamping differences between the market depth data and trades which can cause the market depth data to be out of sync with the last trade prices within the price bars.

Depending upon the particular data feed being used, trades could be timestamped using the timestamp from the data feed and the market depth data could use the local computer clock timestamp. This will cause these two different data sets to be potentially out of sync when replaying a chart.

It also could be that the time stamping of the market depth data uses the timestamp from the data feed but market depth data timestamp is not completely accurate relative to the timestamp used for trades. Sierra Chart has no control over this.

There is not necessarily a perfect solution to this kind of problem. If the local computer clock is being used for time stamping, it is recommended that your computer's clock be set extremely accurately and synchronized multiple times an hour to a network time server. Refer to Incorrect Date and/or Time Display for further information.

If the particular Data or Trading service you are using supports time stamping using the local computer clock, then set Global Settings >> Data/Trade Service Settings Service Setting >> Timestamp Using Local Computer Clock to Yes/True to use the local computer clock, if this option is available for the Service you are using.

In some cases market depth data is always time stamped using the local computer clock depending upon the particular Data/Trading service being used.

For the most accurate time stamping which does not use the local computer clock, you must use the Sierra Chart Exchange Data Feed for market data for accurate time stamping.

However, as of this time, the market depth data time stamping is only to the second and not the millisecond for all supported Data and Trading services. In a future version milliseconds will be supported This is necessary for perfect alignment of the market depth data to chart bars where there are multiple bars with the same Date-Time to the second.

Sierra Chart also timestamps trades to the second and milliseconds acts as a trade counter when there are multiple trades within the same second. Therefore, in the case of when there are multiple chart bars with the same Date-Time to the second, the market depth data for that second will all be contained on the first bar with the same Date-Time to the second as other bars. Subsequent bars with that same Date-Time will display the last received market depth data values at each price level.

Market Depth Historical Graph Timing in Relation to Chart Bar Date-Times

During real-time updating of a chart and chart replays there are rules related to market depth data in relation to the last bar Date-time and whether the market depth data with Date-Times beyond this Date-Time is displayed or not. The following are the rules for this.

During a chart replay, the reference Date-Time for market depth data will be based upon the current Date-Time of the replay whether or not the last bar in the chart includes that particular Date-Time. The current Date-Time during a chart replay depends upon the replay speed and the starting Date-Time of the replay, and the actual elapsed time.

When a chart is not replaying and the chart bars are based upon a fixed time, the reference Date-Time for market depth data is the latest ending time of the chart bar whether or not that time has yet been encountered. So in other words in the case of a 5 minute chart bar, with the starting time of 12:00:00 the ending time will be 12:04:59.999. A new bar does not begin until there is a new trade within the timeframe of that upcoming bar.

When a chart is not replaying and the chart bars are based upon a variable timeframe, Number of Trades, Volume, Range, Reversal, Renko, Delta Volume, Price Change, Point and Figure Bars, the reference Date-Time is the time of the last trade within that bar.

In all of these cases market depth activity beyond the reference Date-Time will not be displayed until a new chart bar is added to the chart which will only occur when there is a trade within the timeframe of that upcoming bar.

Drawing of Depth Quantities at Price Levels on Chart Bars where there have been No Depth Updates

The maximum market depth quantity at a price level is only shown at the chart bar during the timeframe it occurred. For subsequent chart bars, if there has been no market depth update at that price level, the last market depth quantity is displayed until it is deleted by the market depth data stream even if there has been no market depth update at that price level at a particular chart bar.

This is the standard functioning of the Market Depth Historical Graph study for price levels on chart bars where there have been no market depth updates but the prior depth levels have not been deleted by the data feed.

This is considered essential functioning of the study otherwise the Market Depth Historical Graph will have a broken appearance.

Other Related Useful Studies

Below are some studies which you may find useful to use along with the Market Depth Historical Graph study.


*Last modified Monday, 21st January, 2019.