RTD and CQG Conditions

CQG offers a collection of conditions you can use to mark points on a chart when the condition is met. In addition, you can create your own custom conditions. You can easily bring conditions into Excel using RTD formulas. Excel displays a 1 if the condition is currently true or a 0 if the condition is currently false.

In Figure 1, the cqg.ADXHigh condition is highlighted.

Figure 1: CQG Formula Builder, Conditions tab

Right above the description box is the title B.cqg.ADXHigh. This is what you enter for the symbol parameter in an RTD Study Data formula for 15-minute bars using symbol EP:

= RTD("cqg.rtd",,"StudyData", "B.cqg.ADXHigh(EP)", "Bar", "", "Close", "15", "0", "all", "", "","True")

You have to include a symbol. In this example, EP is in parenthesis. This condition will use the same parameters that are in CQG Integrated Client. In this case, there are two parameters: Period and Threshold, which you can modify in the CQG Formula Builder.

You can also use the formula from the description box, ADX(EP,Period) >= Theshold, and enter your own parameters:

= RTD("cqg.rtd",,"StudyData", "ADX(EP,10) >= 20", "Bar", "", "Close", "15", "0", "all", "", "","True")

You can include all of the parameters named and you can edit the parameters:

= RTD("cqg.rtd",,"StudyData", "B.cqg.ADXHigh(EP,Period:=10,Threshold:=20)", "Bar", "", "Close", "15", "0", "all", "", "","True")

The higher level of parameter details is helpful with a more complex condition such as one using Bollinger Bands:

= RTD("cqg.rtd",,"StudyData", "B.cqg.CAboveUBB(EP,MAType:=Sim,Period1:=20,Percent:=2.00,Divisor:=0,InputChoice:=Close)", "Bar", "", "Close", "15", "0", "all", "", "","True")

The downloadable Microsoft Excel® sample conditions spreadsheet provides RTD formulas for the list of available CQG conditions and an example of pulling historical data for the cqg.ADXHigh condition. Two of the conditions, cqg.StochFalling and cqg.StochRising, exceed Excel's character limit for the Formula Bar and are broken into two segments.

Download the Excel File ‌‍‍‍‍

Microsoft Excel is a registered trademark of Microsoft Corporation in the United States and/or other countries.