# Pulling into Excel® Historical Delta Bars (DBars) Study Values

Delta Bars or DBars is a MarketDelta study which is used with the MarketDelta Footprint chart.

Delta is the difference between buys and sells. Delta Bars, displayed as candles, are colored based on bids and asks. Using default colors, the candle is green when there are more asks and red when there are more bids.

The Delta Bars RTD formula uses the FootPrint Operator for the chart type. Here are the RTD formulas for the open, high, low and close for symbol EP and 5-minute bars:

`= RTD("cqg.rtd",,"StudyData","DBarsOpen( FootPrintOP(EP,0))", "Bar", "", "Close","5","0","All",,,"False","T")`

`= RTD("cqg.rtd",,"StudyData","DBarsHigh( FootPrintOP(EP,0))", "Bar", "", "Close","5","0","All",,,"False","T")`

`= RTD("cqg.rtd",,"StudyData","DBarsLow( FootPrintOP(EP,0))", "Bar", "", "Close","5","0","All",,,"False","T")`

`= RTD("cqg.rtd",,"StudyData","DBarsClose( FootPrintOP(EP,0))", "Bar", "", "Close","5","0","All",,,"False","T")`

Alternatively, you can turn on the Accumulate parameter to plot the OHLC of delta, where the bar starts not at zero but where the previous bar closed. This essentially creates a candlestick chart of delta.

Here are the RTD formulas for the open, high, low and close with the Accumulate parameter used:

`= RTD("cqg.rtd",,"StudyData","DDBarsOpen( FootPrintOP(EP,0),DDayPer:=StartOfDay)", "Bar", "", "Close","5","0","All",,,"False","T")`

`= RTD("cqg.rtd",,"StudyData","DDBarsHigh( FootPrintOP(EP,0),DDayPer:=StartOfDay)", "Bar", "", "Close","5","0","All",,,"False","T")`

`= RTD("cqg.rtd",,"StudyData","DDBarsLow( FootPrintOP(EP,0),DDayPer:=StartOfDay)", "Bar", "", "Close","5","0","All",,,"False","T")`

`= RTD("cqg.rtd",,"StudyData","DDBarsClose( FootPrintOP(EP,0),DDayPer:=StartOfDay)", "Bar", "", "Close","5","0","All",,,"False","T")`

You can replace StartofDay with StartofSession in the above RTD formulas.

The third version of DBars you can turn on the Imbalance parameter. When using the Imbalance parameter the Imbalance Delta is calculated as the sum of the ask volume minus the previous bid volume when the bid or ask meet the “strong bid” or “strong ask” criteria in the footprint. Here are the RTD formulas for the Imbalance DBars for open, high, low and close using the default parmaters:

`= RTD("cqg.rtd",,"StudyData","ImbDBarsOpen( FootPrintOP(EP,0),Data:=Exchange,ImbalancePercent:=200,ImbalanceMinDiff:=25)", "Bar", "", "Close","5","0","All",,,"False","T")`

`= RTD("cqg.rtd",,"StudyData","ImbDBarsHigh( FootPrintOP(EP,0),Data:=Exchange,ImbalancePercent:=200,ImbalanceMinDiff:=25)", "Bar", "", "Close","5","0","All",,,"False","T")`

`= RTD("cqg.rtd",,"StudyData","ImbDBarsLow( FootPrintOP(EP,0),Data:=Exchange,ImbalancePercent:=200,ImbalanceMinDiff:=25)", "Bar", "", "Close","5","0","All",,,"False","T")`

`= RTD("cqg.rtd",,"StudyData","ImbDBarsClose( FootPrintOP(EP,0),Data:=Exchange,ImbalancePercent:=200,ImbalanceMinDiff:=25)", "Bar", "", "Close","5","0","All",,,"False","T")`

The downloadable Excel sample includes all of these RTD formulas for pulling in historical DBars data.

Requires CQG Integrated Client or CQG QTrader version 18 or higher, Microsoft Excel 2010 or higher, and the Footprint Charts and Studies (MarketDelta) enablement.