This post "CQG Primer: The Level Function" introduced the Level Function. The Level Function plots two lines, which identify the highest and lowest levels attained over a defined period. The default lookback period is 20 bars. Basically, the highest high and the lowest low over the last 20 bars are plotted on the chart. Traders think of these lines as support and resistance levels.
What was also highlighted is the Level Function can be applied to studies. The post used the Bollinger Bands Difference study (BDIF). This study is the difference between the high and low Bollinger Bands (an example is below).
The post showed how the Level Function could be applied to the BDIF study and create a frame of reference for the study values by calculating a ratio:
(Study Value - Low Level Study Value)/(High Level Study Value - Low Level Study Value)
Or:
(BDIF(@,Sim,20,2.00)-LoLevel(BDIF(@,Sim,20,2.00),20,0))/(HiLevel(BDIF(@,Sim,20,2.00),20,0)-LoLevel(BDIF(@,Sim,20,2.00),20,0))
The BDIF study and the Level function applied to the BDIF study (LvlBBDI) are displayed on the chart below.
This same data can be pulled into Excel using RTD formulas, the topic of this post.
In column H, starting with cel H2 is the RTD formula for the BDIF study:
= RTD("cqg.rtd",,"StudyData", "BDIF("&$L$2&",MAType:=Sim,Period1:="&$L$14&",Percent:=2.00,InputChoice:=Close)", "Bar",, "Close",$L$4,-A2,$L$6, "", "",$L$8,$L$12)
Column I, starting with cell I2 is the ratio of the Level function applied to the BDIF Study:
= RTD("cqg.rtd",,"StudyData", "(BDIF("&$L$2&",Sim,"&$L$14&",2.00)-LoLevel(BDIF("&$L$2&",Sim,"&$L$14&",2.00),"&$L$16&",0))/(HiLevel(BDIF("&$L$2&",Sim,"&$L$14&",2.00),"&$L$16&",0)-LoLevel(BDIF("&$L$2&",Sim,"&$L$14&",2.00),"&$L$16&",0))", "Bar",, "Close",$L$4,-A2,$L$6, "", "",$L$8,$L$12)
The parameters, such as symbol, time frame, etc., are in cells L1 through L16.
The downloadable sample Excel spreadsheet is the same as the image above. The CQG PAC from the first post is also posted.
Requirements: CQG Integrated Client or QTrader, and Excel 2016 (locally installed, not in the Cloud) or more recent.