The Personal Criteria language contains the following functions and operators.
Functions (not case sensitive)
O = Open
H = High
L = Low
C = Close (or Last) - The latest close would be C. The close one bar ago would be C1.
V = Volume - Today's volume would be V. Volume one bar ago would be V1.
Avg = Simple moving average - Average close over the last 20 bars would be AvgC20.
XAvg = Exponential Moving Average
MaxCn = Max Close for the latest n bars
MaxOn = Max Open for the latest n bars
MaxHn = Max High for the latest n bars - Max high for the latest 100 bars would be MaxH100.
MaxLn = Max Low for the latest n bars
MinCn = Minimum Close for the latest n bars
MinOn = Minimum Open for the latest n bars
MinHn = Minimum High for the latest n bars
MinLn = Minimum Low for the latest n bars
STOC = Stochastics - For a 12 period stochastic with a %K of 5 you would use STOC12.5
BOP = Balance of Power
TSV = Time Segmented Volume
MS = MoneyStream
OBV = On Balance Volume
RSI = Relative Strength Index (not Wilder's)
Max( ) and Min( ) - Using Max( ) and Min( ), you can find the maximum or minimum value of a function over a period of time. Note the use of the comma in the function. You cannot group operators within the brackets. For example, Max(AVGC10 – AVGC200,30) would not be a valid argument.
Max(BOP,30) Maximum BOP value over the last 30 days.
Max(AVGC10,125) Highest value of the 10-day moving average over the last 6 months.
Min(TSV18,5) Minimum value of TSV period 18 over the last 5 days.
Min(STOC12.5,21) Lowest value of Stochastics 12 and 5 over the last 21 days.
* = Multiply
/ = Divide
+ = Add
- = Subtract
^ = Exponentation - If you wanted to raise something to the power of 2, you would use ^ 2. So for example 3 ^ 2 = 9. You could raise something to the power of 1/2 to get the square root or you could use the SQR() function. So for example both 9 ^ (1 / 2) = 3 and SQR(9) = 3.
ABS( ) = Absolute Value. When used with a Boolean expression, ABS( ) will return 1 for True and 0 for False. Example: If the current Close is greater than the previous Close, then ABS(C > C1) = 1
AVG(simple) or XAVG (exponential). Using AVG( ), you can find the average value of a function over a period of time. Note the use of the comma in the function. Use XAVG( ) to get an exponential average.
AVG(BOP,30) Average BOP value over the last 30 days.
AVG(AVGC10,125) Average value of the 10-day moving average over the last 6 months.
AVG(TSV18.1,5) 5-day average of TSV period 18 yesterday.
AVG(STOC12.5,21) Average value of Stochastics 12 and 5 over the last 21 days.
You cannot group operators within the brackets. For example, AVG(AVGC10 – AVGC200,30) would NOT be a valid argument, but AVG(AVGC10,30) – AVG(AVGC200,30) is valid.
LOG( ) = Natural Log
EXP( ) = Natural exponential function and is the inverse of the LOG() or natural logarithm function
SQR( ) = Square Root
Sign Function - SGN( ) returns +1, 0, or -1 depending on the result of the formula. SGN(C - C1) will return 1 if C is greater than C1, 0 if C = C1 and -1 if C is less than C1.
> Greater Than
>=Greater Than or Equal To
< Less Than
<= Less Than or Equal To
= Equal To
<> Not Equal To
Order of operations:
() - Parentheses will force an operation to perform earlier in the order.
Booleans in Value based Formulas (unsupported):
Placing a Boolean expression inside parentheses will return -1 for True or 0 for False when it is part of a larger value based formula.
Placing a Boolean expression inside an ABS() function will return 1 for True or 0 for False when it is part of a larger value based formula.