Conditions
Description |
Conditions are used for marking an event or state on a bar. They are binary. That is, they are either true or false for each bar. |
Situational examples |
Reversal days Price crossing a moving average Stochastic %K crossing %D |
Formula components |
Conditions are composed of bar, function, parameter, and study values. Note: To enable you to quickly identify inserted conditions in your formulas, CQG inserts the letter “B” in front of the condition name. |
Formula example |
High(@) > High(@)[-1] AND Low(@) < Low(@)[-1] Marks the outside bar on a chart. The outside bar is one with a higher high and lower low than the previous bar. (cqg.BarOutside) |
Location |
Formula Builder Conditions window Toolbox |
Used with |
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. |
Pre-defined formulas |
CQG offers these formulas (parameters in parentheses): B.BeginOfDay(@,6,55) B.cqg.ADXHigh(@,10,20) B.cqg.ADXLow(@,10,20) B.cqg.BarInside B.cqg.BarOutside B.cqg.CAboveUBB B.cqg.CBelowLBB B.cqg.DDIF_XABOVE B.cqg.DDIF_XBELOW B.cqg.HVolLow(@,20,260,500,0.100) B.cqg.ImpVolLow(@,250) B.cqg.MA1XAboveMA2(@,21,55) B.cqg.MACDCross B.cqg.NewHigh(@,252) B.cqg.ReversalDown(@,1) B.cqg.ReversalUp B.cqg.RSIHigh(@,9,20.000) B.cqg.RSILow(@,9,20.000) B.cqg.StochFalling B.cqg.StochRising B.cqg.StochXAbove(@,20.000,10) B.cqg.StochXBelow(@,80.000,10) B.cqg.VolumeLow(@,50) B.cqg.YCurveSlopeC(@,0) B.cqg.YCurveSlopeT(@,0) B.OBV_PLUS1(@,7,55,15,0,7,55) |
User Values
Definition |
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. |
Formula components |
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. |
Formula example |
MA_DIFF_15_60: MA (@Exp15) – MA (@Exp60) |
Location |
Formula Builder User Values window Toolbox |
Used with |
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. |
Pre-defined formulas |
V.Bars_Close V.Close V.cqg.RelRange V.Next_Bars_Open V.Previous_High V.Previous_Low |