Note: Function-type studies rely on the use of a condition as a parameter. When these studies are plotted on a chart, the values returned depend on the occurrence of the defined condition, as well as the other parameters used.
CQG offers these formulas (parameters in parentheses):
User values yield definite numbers. You can think of them as a way to store calculations (or even actual numbers).
They are dynamic parameters that when changed, change all instances of that user value throughout the system. Suppose you create a user value @price and set its value to mid. When you change the value of @price to high, all instances of @price across all applications are then calculated by the high and not the mid.
Conditions are composed of bar, function, and parameter values.
Note: To enable you to quickly identify inserted User Values in your formulas, CQG inserts the letter “V” in front of the condition name.
MA_DIFF_15_60: MA (@Exp15) – MA (@Exp60)
Formula Builder User Values window
Build other formulas from user values: QFormulas, conditions, custom studies, and trade systems.
User values appear as one of the choices in any study where price is a parameter.
18.To create new conditions or user values
Click the New button on the Conditions or User Values tab from Formula Builder to open the Create a New Condition (or User Value) window.
Enter a condition (user value) name in the Create a New…window. User values cannot be named the same as a bar value, for example, Open, Close, and so forth.
Click OK to open Formula Builder.
Click the Toolbox button to define the new condition (user value).
Select the elements from the Formula Toolbox to insert into the new condition (user value).
To copy a condition or user value
You can modify an existing condition or user value to use it as the basis for a new user value or formula.
Click a Condition or User Value from the Available…. section on the relevant tab in Formula Builder.
Click the Copy button to open the Copy a User Value window.
Enter a different name for the Condition or User Value.
Click OK to close the Copy a …window.
The newly named formula appears in the Formula for… section and can be modified either directly or by selecting and inserting items from the Formula Toolbox.
19.To define condition and user value parameters (Parms Button)
The Parameters window allows you to save specific, often-used values to be easily inserted into a condition, user value, custom study. Parameters are listed on the Special tab of the Formula Toolbox.
To open this window, click the Parms button associated with the condition, user value, and custom study or trade system.
To view and edit parameters used
Select the Condition, User Value, Custom Study, or Trade System for which you want to view parameters.
Click the Parms button. The standard parameters associated with the study are displayed.
Make desired changes to the parameters, including adding a column or row header.
To add a parameter
Click the Parms button.
Click the New button.
Enter a name for the parameter.
Select the Int check box if the parameter is going to be an integer. Leave the box unchecked if the parameter is going to be a floating-point decimal number.
Enter a default value.
Enter column and row header names if desired.
Enter a note if desired.
To delete a parameter
Select the Condition, User Value, Custom Study, or Trade System that contains the parameter you want to delete.
Click the Parms button.
Select the parameter you want to delete.
Click the Delete button.
To insert a parameter
After customizing and adding parameters, they can be inserted into a formula.
Click in the location you want to add the parameter in the Formula Editor.
Click the Toolbox button.
Go to the Special tab.
Click the parameter you want to add.
Click the Insert button.
Note: Each parameter can be inserted only into the condition for which it was defined. To re-use the same parameter for more than one condition, you must redefine the parameter.
20.Creating Conditions: Example
Create a new condition.
Choose studies using the toolbox. In this example, we inserted SSK, then used the Special menu to add XABOVE. Finally, we added SSD.
The formula is added to the list:
Create new parameters for the condition (click Parms button).
Change parameter values. Highlight the entire condition in the formula editor window:
Select new values.
Add the custom condition to a chart. Right-click on a bar or candlestick chart, and click Select conditions for marking Bar/Candl. Choose a color and/or symbol to add to chart.
21.Specify Conditions Window
The Specify Conditions window is used with several applications:
Portfolio Monitor and Instrument Monitor
Charts and Studies
DOMTrader (Show on Trading Interface button)
To create a new condition
Click the Define Condition button to open Formula Builder.
To add a condition
Click a condition on the list.
Click the Include button.
Optionally, modify the display. Click the symbol to open a symbol; click the colored square to open a color palette:
Optionally, modify the parameters by typing new values in the field. The parameters field is displayed only when a condition is selected for marking and that condition has parameters.
Click the Exclude button below the display parameters to remove the condition.
Click the Move Up and Move Down buttons to move the conditions up and down the list.