Advanced Analytics



Download 0.61 Mb.
Page12/20
Date29.01.2017
Size0.61 Mb.
#11326
1   ...   8   9   10   11   12   13   14   15   ...   20

Creating Custom Studies


Description

Custom studies return specific measurements of market action that you can define, chart, and analyze. These studies are an effective means of obtaining data for extreme situations.

Situational example

Create a VWAP with proprietary bands

Formula components

Custom studies are composed of bar and parameter values.

Formula example

MIVClose(@) - HVOL(@,Percent,HVolPeriod,HVolAnnFctr)

Measures the spread between Implied Volatility and Historical Volatility.



Location

Formula Builder Custom Studies window

Toolbox


Add Studies window

Used with

Custom studies can be used in the same ways standard studies can.

Pre-defined

Custom studies


22.To create a custom study


Defining a custom study involves entering the following:

A Study Name

A Study Name Abbreviation (if desired)

Study Curve Names (instead of the c1 ,c2, c3, and so forth, default names)

Study Curve Formulas


  1. Click the New button in the Study Names group on the Custom Studies tab in Formula Builder.

  2. Enter a study name. The system automatically enters an abbreviation, but you can Enter a study abbreviation, if you want to.

  3. Click in the New Study Abbrev and Curve Name box and enter no more than 7 characters. The custom study abbreviation must start with a letter rather than a number or symbol. CQG uses the abbreviation name when you use one custom study as the basis for another custom study.

  4. Click the OK button.

23.To establish curves for a custom study


Establishing curves for a custom study involves assigning names and defining the curve characteristics.

If the selected custom study does not already have curves defined, the Curves For: [study name] information is not displayed.



  1. On the Custom Studies tab of Formula Builder, left click the Show Curves button.

  2. The Curves for: [Study Name] information appears under the Permissions button.

  3. Click the New button under Curves for: [Study Name].

  4. Enter a name for the new curve.

  5. Click the OK button to close the Create a Study Curve window.

24.To enter a curve formula


The Curve Formula Editor displays the formula or expression associated with the study curve selected in the Curves for section. It is empty when a new curve name is initially selected.

The editor consists of the editor area, where the selected study curve's formula is shown, and several Editor buttons. The expressions can be modified directly in the Editor, or they can be modified using the Editor buttons.



  1. If the Curves for: [study name] information is not already displayed, left click the Show Curves button.

  2. Click the study name in the Study Names list.

  3. Click the New button in the Curves for section.

  4. Enter a name for the new study curve.

  5. Enter the desired Curve Formula directly in the Formula for Curve section.

You can also click the Toolbox button to display the Formula Toolbox window and use the Toolbox to define the curve formula.

Custom Studies use scales that are unique to that study. However, an operator can be added to a Custom Study curve formula to force the Custom Study to share the scale of the underlying chart.

Currently, the ShareScale operator is added in the Custom Study curve formula. The ShareScale operator has two parameters separated by a comma. The first parameter is the Custom Study curve formula itself. The second parameter identifies whether the Custom Study curve shares a scale.

Example: ShareScale(custom study formula, @) forces the curve to share the scale with the bar scale, identified by @.

Study Outputs cannot be changed within the Curve Editor. However, you can modify them by selecting the Study Output and then by selecting the Setup button to display the parameters.

When the cursor is placed on a Study Output or one of its parameters, the entire Study Output expression is selected. All or none of the Study Output expression must be removed at one time. Individual parts of a Study Output expression cannot be removed.

The clipboard can be used to cut and paste text into the Curve Editor.


25.To add a custom study to a chart with the Study button


  1. Click the Study button in the Chart toolbar to display a list of available studies including Custom studies.

  2. Click the desired Custom Study Names to select those studies. Custom study names appear with the symbol “^” following the abbreviated study name.

  3. Click the Add button to add the selected studies to the Chart window.

26.To place a custom study button on the Chart toolbar


Individual Custom Study buttons can be placed on the Chart toolbar to access frequently used studies. After a study button is placed in the Chart toolbar, the button can be used to add/remove the associated study to/from the active chart window.

  1. Click the Study button in the Chart toolbar to display a list of available studies to open the tabbed version of the Add Study window.

  2. Click the Custom Studies tab.

  3. Click the Custom Study Abbreviation to the left of the custom study name to add the corresponding Custom Study button to the Chart toolbar. Custom study names appear with an ^ following the abbreviated study name.

  4. Click the study name itself and the Add button to display the study on the active chart without adding a button to the toolbar.

  5. Click the study abbreviation name and the Add button to add the custom study button to the toolbar and the study curves to the current chart.

Once a custom study button has been placed on the Chart toolbar, it can display the associated custom study.

  1. Click the button with the desired study name to display the associated custom study.

  2. Right-click the button of the desired Custom Study to remove the associated study if it is currently displayed.

27.To change the parameters of a Custom Study


  1. Move the mouse pointer to a custom study line. When the mouse text appears:

  2. Right-click the custom study line to display a menu.

  3. Click Modify … to display the Setup Study Parameters window for the custom study.

  4. Click the parameter setting to change.

  5. Enter a new parameter value, or

  6. Select the Drop Down List button, where available.

  7. Click the OK button to apply the changes to the custom study and close the Setup Study Parameters window.

While display parameters for the custom study can be modified in the Setup Study Parameters window, study curve formulas must be modified in the Define Study window.

28.To remove a custom study


  1. Move the mouse pointer so that it points to a custom study line and the mouse text appears.

  2. Right-click to display a menu.

  3. Click Remove Custom Study Name

You can also right-click the associated custom study button to remove the study.

29.To use a MATLAB® function in a custom study


CQG, in conjunction with The MathWorks™, has integrated CQG IC and MATLAB by developing a communication channel between the applications using CQG’s API. MATLAB functions are used within CQG custom studies. You can incorporate an existing MATLAB function or create your own.

You call the MATLAB function through CQG IC, MATLAB serves as the calculation engine, MATLAB returns the results to CQG IC where you can view them and integrate them into your conditions, trade systems, charts, etc.

In CQG IC, add the MATLAB function to your custom study, using this syntax:

MatLab(@, , , , )

For example: MatLab(@, 100, my_matlab_function, Close(@), Open(@), High(DD), 1.5, 3.2)

That is, for my_matlab_function, return an array of 100 closes of the source chart, an array of 100 opens of the source chart, and an array of 100 highs of DD using numeric inputs 1.5 and 3.2.

Parameter

Description

MatLab(@

Constant way that all MATLAB-associated formulas must begin.

Array

Size of the data array. Must be at least 1.

For example, if you want 100 bars of the moving average returned, then this value would be 100.



MATLAB function

Name of MATLAB function to call.

Data Sources

Data sources to collect data from. All inputs after function and before first numeric input are treated as inputs to populate data array.

Numeric Input

All numeric inputs after data sources are considered parameters to be passed to MATLAB function.

)

Constant closing parenthesis.

The Backtesting/Trade system feature allows you to create and graphically display the results of trade systems.

The Backtesting/Trade systems feature is part of Formula Builder.


30.Custom Study Definitions


CQG provides several custom studies that you can use as a basis for your own custom studies.

Find preset custom studies on the Add Studies window (click the Studies button on the chart toolbar):



Find them on Formula Builder and in the Toolbox:




BAVolCross (BAVolCr)


The Bid Ask Volume Cross custom study is available on the Add Studies window, on the Custom Studies window (Formula Builder), and in the Toolbox.

The BAVolCross study displays two lines: the rolling 5-bar sum of traded volume at the ask price (buying) and rolling 5-bar sum of traded volume into the bid (selling).

Formula of curves:

AskVolume curve: Buy := Sum( AskTradeVol(@),RunningSum)

BidVolume curve: Abs(Sum( BidTradeVol(@),RunningSum))

Setup parameters:

Display

OB/OS


Running Sum: The used for the calculations of sum.

BAVolCrOsc (BAVolCO)


The Bid Ask Volume Cross Oscillator custom study is available on the Add Studies window, on the Custom Studies window (Formula Builder), and in the Toolbox.

The BAVolCrOsc study displays the difference between two lines of the Bid Ask Volume Cross.

Formula of curves:

Sum(AskTradeVol(@),RunningSum) - Abs(Sum(BidTradeVol(@),RunningSum))

Setup parameters:

Display


OB/OS

Running Sum: The used for the calculations of sum.


BolOfS (BolOfS)


The Fixed Bollinger Bands study is available on the Add Studies window, on the Custom Studies window (Formula Builder), and in the Toolbox.

Formula of curves:

BMA curve: BMA(@,Sim,5)[-1]

BHI curve: BHI(@,Sim,5,1)[-1]

BLO curve: BLO(@,Sim,5,1)[-1]

In this example, the fixed Bollinger Bands plot one standard deviation away from a simple moving average of 5 bars. The standard Bollinger Bands setup uses the current live price. Consequently, Bollinger Bands are expanding and contracting around the current bar. Here we use the previous value of the Bollinger Bands. Now, you have a fixed frame of reference on the chart. This gives you precise price levels that do not fluctuate. In addition, you can display the Bollinger Bands' values on the DOMTrader®”

Setup parameters:

Display


OB/OS

cqg.Bid_Ask (Bid_Ask)


The Bid Ask study displays two lines: price of the last ask and price of the last bid.

Formula of curves:

Bid curve: Label(@,LastBid)

Ask curve: Label(@,LastAsk)

Setup parameters:

Display


OB/OS

cqg.Correl.CL (CorrCL)


This custom study is the correlation between the active instrument and Crude Light Settlement Futures over a user specified period. It is available on the Add Studies window, on the Custom Studies window (Formula Builder), and in the Toolbox.

Formula of curve:

Correlation(@,F.CL,Period)

Setup parameters:

Display

OB/OS


Period: The period used for the calculations of correlation.

cqg.Correl.CP (CorrCP)


This custom study is the correlation between the active instrument and Copper Settlement Futures over a user specified period. It is available on the Add Studies window, on the Custom Studies window (Formula Builder), and in the Toolbox.

Formula of curve:

Correlation(@,F.CP,Period)

Setup parameters:

Display

OB/OS


Period: The period used for the calculations of correlation.

cqg.Correl.EQ (CorrEQ)


This custom study is the correlation between the active instrument and three equity indexes over a user specified period. It is available on the Add Studies window, on the Custom Studies window (Formula Builder), and in the Toolbox.

Formula of curves:

Dow Jones Index: Correlation(@,X.DJI,Period)

S&P 500 Index: Correlation(@,X.SPC,Period)

NASDAQ Composite Index: Correlation(@,X.NQC,Period)

Setup parameters:

Display

OB/OS


Period: The period used for the calculations of correlation.

cqg.Correl.FX (CorrFX)


This custom study is the correlation between the active instrument and three FX indexes (DXC, EUR and JPY) over a user specified period. It is available on the Add Studies window, on the Custom Studies window (Formula Builder), and in the Toolbox.

Formula of curves:

Dollar Index: Correlation(@,X.DXC5,PERIOD)

DM-Euro / United States Index: Correlation(@,X.IEURUSD,PERIOD)

Japan (Yen) Index: Correlation(@,X.IUSDJPY,PERIOD)

Setup parameters:

Display

OB/OS


Period: The period used for the calculations of correlation.

cqg.Correl.MA (CorrMA)


This custom study is the correlation between two moving averages over a user specified period.

Formula of curve:

Correlation(MAx1(@,Sim,MA1),MAx2(@,Sim,MA2),CorrPeriod)

Setup parameters:

Display

OB/OS


MA1: The short term moving average.

MA2: The longer term moving average.

CorrPeriod: The period used for the calculations of correlation.

cqg.Correl.TY (CorrTY)


This custom study is the correlation between the active instrument and 10-year Treasury Notes (Combined) Futures over a user specified period. It is available on the Add Studies window, on the Custom Studies window (Formula Builder), and in the Toolbox.

Formula of curve:

Correlation(@,F.TYAA,Period)

Setup parameters:

Display

OB/OS


Period: The period used for the calculations of correlation.

Cqg.DDiffMA (DDiffMA)


This custom study displays the difference of the DMIUp and DMIDn curves and its moving average. DMI is the Directional Movement Index. It is available on the Add Studies window, on the Custom Studies window (Formula Builder), and in the Toolbox.

Formula of curves:

Difference of DMIUp and DMIDn: DIFF(@,DDif,Period)

MA of difference of DMIUp and DMIDn: MA(DIFF(@,DDif,Period),Exp,MA.Period)

Setup parameters:

Display


OB/OS

DDif Period and MA Period: The period used for the calculations of difference of the DMIUp and DMIDn and its moving average.


cqg.DMI with ADX (DMIwADX)


This custom study displays DMIUp, DMIDn, the difference of the DMIUp and DMIDn and the Average Directional Movement Index.

This study combines the Directional Movement Indicators into one study by using multiple curves. All the curves share the user-defined period, which allows modification from the chart.

Formula of curves:

DMIu: DMIu(@,Period)

DMId: DMId(@,Period)

ADX: ADX(@,Period)

DIFF: DIFF(@,Period)

Setup parameters:

Display

OB/OS


Period: The period used for the calculations of directional movement indicators.

cqg.MACD Histogram (MHist)


This custom study is MACD Histogram, the difference between the MACD and the MACD signal line.

The MACD Histogram study displays three charts: MACD Histogram, MACD signal line, and MACD.

Formula of curve:

MACD(@,13.000,26.000) - MACDA(@,13.000,26.000,9.000)

Setup parameters:

Display


OB/OS

cqg.MACD with Histogram (MACDwMH)


This custom study displays the MACD Histogram, MACD, and MACD signal line in a chart.

Formula of curves:

MACD: MACD(@,MA1,MA2)

MACDA: MACDA(@,MA1,MA2,MA3)

MHist: MACD(@,MA1,MA2)- MACDA(@,MA1,MA2,MA3)

Setup parameters:

Display

OB/OS

cqg.Noon (Noon)


This custom study is the closing price of the active instrument at a user specified time.

HourX is used for calculating the closing price.

Formula of curve:

Close(@) WHEN Hour(@) = HourX

In this example, the study displays the movement of price in an hour in advance of 8 a.m. (the user specified time) and constant value equals to the closing price at 8 a.m. for the rest time of the day.

Setup parameters:

Display

OB/OS

cqg.PivotPts (PvtPts)


The pivot point is the arithmetic average of the high (H), low (L), and closing (C) prices of the active instrument, P = (H + L + C) / 3. This custom study uses the Pivot points for calculations of the curve. It plots 5 curves: the pivot point; 2 projected highs and 2 projected lows. Note that the Overlaid checkbox has been selected so that these curves will be plotted over the bars like a moving average. It is available on the Add Study window. The ,D after each term forces the system to use a daily bar. This method allows the user to apply daily values to an intraday chart.

Formula of curves:

Res2: (HLC3(@),D)[-1] + (Range(@),D)[-1]

Res1: (2 * (HLC3(@),D)[-1]) - (Low(@),D)[-1]

PIVOT: (HLC3(@),D)[-1]

Sup1: (2 * (HLC3(@),D)[-1]) - (High(@),D)[-1]

Sup2: (HLC3(@),D)[-1] - (Range(@),D)[-1]

Setup parameters:

Display

OB/OS

cqg.RSI with MA (RSIma)


This custom study plots the RSI with a trailing moving average.

RSIPeriod is used for calculating the RSI.

MAPeriod is used for calculating the MA.

Formula of curves:

RSI: RSI(@,RSIPeriod)

MA: MA(RSI(@,RSIPeriod),Sim,MAPeriod

Setup parameters:

Display


OB/OS

cqg.VolSpread (VolSprd)


This custom study measures the spread between Implied Volatility and Historical Volatility.

HVolPeriod: Historical Volatility Period is used for calculating the Historical Volatility.

HVolAnnFctr: Historical Volatility Annualization is used for calculating the MA.

Formula of curve:

MIVClose(@) - HVOL(@,Percent,HVolPeriod,HVolAnnFctr)

Setup parameters:

Display

OB/OS

OBV_TB1 (OBV_TB1)


This custom study measures the On Balance Volume beginning at a user specified time. It is available on the Add Studies window, on the Custom Studies window (Formula Builder), and in the Toolbox.

Formula of curves:

StartOfDay:= Hour(@) = SHour AND Minute(@) = SMinute

EndOfDay:= Hour(@) = EHour AND Minute(@) = EMinute

TimeToCalculate :=SetReset( StartOfDay ,EndOfDay) ;

myVol := IF(StartOfDay,0,

IF(TimeToCalculate, Accum(TBTF1.NET^@,B.BeginOfDay(@,BHour:=7,BMinute:=55)) ,0))

Setup parameters:

SHour: Start Hour used for the calculation.

SMinute: Start Minute used for the calculation.

EHour: End Hour used for the calculation.

EMinute: End Minute used for the calculation.

BHour: Beginning Hour used for the calculation.

BMinute: Beginning Minute used for the calculation.


TBTF1 (TBTF1)


This custom study plots four curves: Bid Trade Volume, Ask Trade Volume, Net Bid-Ask Trade Volume, and Net change in closing price. Formula of curves:

Hit_Bid: -1* BidTradeVol(@)

Lift_Offer: AskTradeVol(@)

NET: AskTradeVol(@) - BidTradeVol(@)

FutNet: ( Close(@)- Close(@)[-1])/100

Setup parameters:

Display

OB/OS


Download 0.61 Mb.

Share with your friends:
1   ...   8   9   10   11   12   13   14   15   ...   20




The database is protected by copyright ©ininet.org 2024
send message

    Main page