Apply Studies to Different Chart Types

The Microsoft Excel® RTD Studies sample offers a collection of RTD CQG study formulas applied to the Bar chart type. If you want to use other chart types, such as no gap or constant volume bars, then the solution is to include the chart type in the symbol parameter in the RTD formula. In addition, if the chart type includes a setting or settings, then the setting also needs to be included in the symbol parameter.

This article details the various chart type symbols to use. The example study is a 5-period moving average applied to a 1-minute chart. Each chart type has a link to a CQG Help file for more details about the chart type. For more general information about RTD formulas, an RTD Tutorial is available. A previously posted article detailed similar information for the four new chart types released in CQG 2015.

Chart Types

The Fill Gap chart type does not have any parameters:

= RTD("cqg.rtd",,"StudyData","FillGap(NGE)", "MA", "InputChoice=Close,MAType=Sim,Period=5", "MA","1","0","all",,,,"T")

The No Gap chart does have parameters. You can choose to remove gaps occurring at the start of session, end of session, start and end of session, or all gaps. That setting is a number from zero to three:

  • Start of session = 0
  • End of session = 1
  • All gaps = 2
  • Start and end of session = 3

= RTD("cqg.rtd",,"StudyData","NoGap((RBE), 2)", "MA", "InputChoice=Close,MAType=Sim,Period=5", "MA","1",,"all",,,,"T")

The Constant Volume chart type has a couple of parameters. You have to set the number of contracts required to complete a CV bar. Below, the formula is using 1,000 contracts. You also can choose to use traded volume (UseActualVolume) or tick volume (UseTickVolume).

= RTD("cqg.rtd",,"StudyData","NewCVB(CLE,1000,1,UseActualVolume)", "MA", "InputChoice=Close,MAType=Sim,Period=5", "MA","",,"all",,,,"T")

The Equalize Sessions chart type does not have additional parameters:

= RTD("cqg.rtd",,"StudyData","EqualizeSessions(CLE)", "MA", "InputChoice=Close,MAType=Sim,Period=5", "MA","1",,"all",,,,"T")

The Percent Bar chart type includes parameters for calculating percent change based on a price, an index (such as 20 bars back), or a date (such as the last day of the previous year). In this example, we use daily bars ("D"):

  • Index = 0
  • Price = 1
  • Date = 2

In this formula below, we use Date as 2 in the setting following the symbol:

= RTD("cqg.rtd",,"StudyData","PCB((CLE),2,5000,20,""12/31/2015"")", "MA", "InputChoice=Close,MAType=Sim,Period=5", "MA","D","0","all",,,,"T")

In the RTD formula above, if the 2 was replaced by 0, then the percent change would be based on the change from 20 days ago. If 2 was replaced by 1, then the price of $50.00 would be used for the net percent change. Notice the Date is in double quotes (""12/31/2015"").

The Point and Figure chart type requires you to use either the high price of the column, the low price, or the midpoint of the column:

  • High-price = PFHigh
  • Low-price = PFLow
  • Mid-price = PFMid

Below, the moving average is using the high of the column, the box size setting is 1, and the reversal is 3:

= RTD("cqg.rtd",,"StudyData","PFHigh(EP,1,3)", "MA", "InputChoice=Close,MAType=Sim,Period=5", "MA","","0","all",,,,"T")

For Spread charts, there is a setting to use a snapshot of the spread for building the bar. Below, every one minute (1X) snapshot is used to build a 30-minute bar of the spread:

= RTD("cqg.rtd",,"StudyData", "Consolidate(Spread(CLE?1-CLE?2),1X, Spread(CLE?1-CLE?2),1,0)", "MA", "InputChoice=Close,MAType=Sim,Period=5", "MA","30","0","all",,,,"T")

The TFlow chart type does not use time. The link to the help file explains how the bars are built. There are three types of aggregation for the TFlow bars.

  • A number of individual TFlow bars are compressed into a single bar: TFlowSimpleAggregation
  • A tick range is required to be exceeded to start a new TFlow bar: TFlowTickAggregation
  • A CQG proprietary smoothing algorithm is applied to the TFlow bars: TFlowSmooth

Below, the 5-bar moving average is applied to a 5-bar aggregated TFlow bar:

= RTD("cqg.rtd",,"StudyData", "TFlowSimpleAggregation(TFlowOp(EP, 0, 0), 5)", "MA", "InputChoice=Close,MAType=Sim,Period=5", "MA","","0","all",,,,"T")

The Tick chart type has two settings: first is to turn on/off flat ticks, and second is to turn on aggressive.

The RTD formula below has both flat ticks turned on (the first 1 following the symbol) and aggressive (the 1 at the end of the symbol parameter). To turn off these two, then use a 0:

= RTD("cqg.rtd",,"StudyData","TickChart((CLE),1,0,1)", "MA", "InputChoice=Close,MAType=Sim,Period=5", "MA","1",,"all",,,,"T")

The Tick Chart Smoothing chart type displays ticks aggregated with a smoothing algorithm. It is based on trade ticks only. The RTD formula below is using an Aggregation Level of 5 (the last setting in the symbol), which tells the system to create a new bar for every 5 bars or when the range exceeds 5 ticks:

= RTD("cqg.rtd",,"StudyData","TickChartSmooth(TickChart((CLE),1,1,0),5)", "MA", "InputChoice=Close,MAType=Sim,Period=5", "MA","",,"all",,,,"T")

The Yield chart requires a cash fixed income symbol, such as CUS10 or BUS10. If you use a fixed income futures contract symbol, such as TYA, then the yield calculation will use the contract's default specifications (i.e., a 6% coupon), which will generate an incorrect yield.

This formula is returning the current yield of the on-the-run 10-year US Treasury:

= RTD("cqg.rtd",,"StudyData","Yield(CUS10)", "MA", "InputChoice=Close,MAType=Sim,Period=5", "MA","1",,"all",,,,"T")

This sample spreadsheet includes all of the above formulas:

Download the spreadsheet ‌‍‍‍‍

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