Calling Conditions in Excel Using RTD

Traders can use pre-built conditions or create their own conditions in CQG to mark bars when a particular condition is met. They can then pull this information into Excel using RTD formulas. The RTD formulas are similar to study RTD formulas. The difference is that the letter B and a period are required (“B.”) in the symbol.

For example, here is the RTD formula to call for the CQG ADX High condition applied to a five-minute chart using the symbol EP:

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

When the ten-period ADX study is greater than 25, then a 1 is returned in the cell in Excel. When this is not true, a 0 is returned. As long as the condition remains true, the cell will contain a 1.

This next condition returns a 1 when the five-period moving average crosses above the 25-period moving average. The condition uses the CQG XAbove function and will be true for just one bar. If the five-period moving average is still above the 25-period moving average on the next bar, a zero is returned since it is not the bar the two averages crossed.

= RTD("cqg.rtd",,"StudyData", "B.cqg.MA1XAboveMA2(EP,MA1Period:=5,MA2Period:=25)", "Bar",, "Close","5","0", "all", "", "","True")

You can pull historical values by replacing the “0” with a negative number, such as “-1” for yesterday or “-5” for five days ago.

The downloadable CQG-powered Excel RTD spreadsheet pulls in three CQG conditions:

  1. CQG.ADXHigh
  2. CQG.RSIHigh
  3. CQG.MA1XAboveMA2

Requires CQG Integrated Client or CQG QTrader and Excel 2010 or more recent.

Downloads

Tags

Disclaimer

Trading and investment carry a high level of risk, and CQG, Inc. does not make any recommendations for buying or selling any financial instruments. We offer educational information on ways to use our sophisticated CQG trading tools, but it is up to our customers and other readers to make their own trading and investment decisions or to consult with a registered investment advisor. The opinions expressed here are solely those of the author and do not reflect the opinions of CQG, Inc. or its affiliates.