QFormulas for Spreads

Using QFormulas


Quote Formulas (or QFormulas as they are more popularly known) allow users to create custom calculations within CQG for use inside of trading interfaces, charts and quoteboards. This can be very useful if one is looking to trade a particular spread electronically and the data for that spread either does not exist or is thin. Cash to 3-month metals spreads, various energy cracks as well stock and commodity arbitrages (among many others) can all be created using a QFormula.

In this 2-part blog we will firstly explore how to create a custom spread using a Qformula and in part 2 we will look at how to trade it using CQG Spreader.


Using QFormulas to Generate Unseen Pricing

Take for example the ICE Heating Oil/WTI crack (see figure 1). The CQG code for this instrument on a 60-minute basis shows a flow of data that is likely too thin to actively daytrade. However, by using QFormulas we can recreate the ICE Heating Oil/WTI Crack synthetically by using data from the individual component contracts, leveraging the outright liquidity to create a tradeable instrument.

Figure 1


Figure 2 shows a chart of the synthetic spread.


Figure 2


Note the distinct difference in the data. The synthetic contract represents a tradeable instrument and can be treated as such within CQG. View the price data in a quote spreadsheet or perform technical analysis in the normal way (Figure 3). Note that CQG Spreader would be required to trade such a strategy and this is something we will explore in part 2.


Figure 3


Creating Synthetic Spreads via a QFormula

So how does one create such synthetic strategies? Coding QFormulas is easier than you may expect and normally involves just one line of code. In the Formula dialogue:

1. Select the QFormulas tab

2. Click 'new' and name your QFormula. It is important to have some kind of naming convention here as 'test 1'(or similar) is likely to have you scratching your head when you reopen it in 6 months.

3. Go ahead and code your formula. In order to create a bar or candle chart of a spread simply type SPREAD() and enter your code into the brackets. The example uses Spread(42*QHO?1-CLE?1, L1, ).01, 1:2, T:BA, 1).

4. Once you are happy with your formula click 'Apply' then 'Close'.

Each new QFormula is automatically given a QNumber by CQG Integrated Client. It can be seen just to the left of the 'name' column. Use this QNumber as handy shorthand whenever you wish to view your data in charts or quote spreadsheets.