## Utilities - UTIL

#### Description

The Utilities are a collection of functions (methods) for use in creating custom indicators with the CUS indicator. With use of these, it is possible to manipulate or test values.

#### Syntax

DataArray := UTIL(Method, Parameter 1, ..., Parameter n)

#### Example

DayChange:= UTIL(SUB, Close, PrvClose)

Below follows a complete list of all supported utilities methods with syntax and a simple (often useless, sorry) example.

In this list used definitions are:

DataArray | can be either an array of bars or a formula variable array of data
Double | is a number
DataValue | can be a DataArray or a Double
BoolArray | is an formula variable array of TRUE/FALSE values

See also the list of reseverd words

### UTIL-Method Reference

ACCUM | DataArray := UTIL(ACCUM, DataArray)
Function | Accumulation method
Example | UTIL(ACCUM, Close)
ADD | DataArray := UTIL(ADD, DataArray, DataValue)
Function | Adds the values of the DataArray and DataValue.
Example | UTIL(ADD,Close, Open) UTIL(ADD, Close, 45.5
COLOR | UTIL(COLOR,DataArray, COLOR ARRAY, VALUE, COLOR)
Function | An input array of values is used as a guide to test a value for a TRUE value and then apply a color to the color array. COLOR ARRAY is the array the color will be applied to. VALUE is the number used to compare in the DataArray. COLOR is the color to use
Example | UTIL(COLOR,bool_array, bars, 1, red)
COMP | BoolArray := UTIL(COMP, DataArray, DataValue, Operator) BoolArray := UTIL(COMP, BoolArray, BoolArray, Operator)
Function | Used for comparing two sets of data arrays by a relational operator. The comparison is made by comparing the first array with the second array. If the comparison between the 2 data arrays is true, a TRUE value is returned. If false, FALSE is returned. Operator is a relational operator from one of the following: EQ - Equals LT - Less than LTEQ - Less than or equal to GT - Greater than GTEQ - Greater than or equal to AND - And comparison, to compare BoolArrays OR - Or comparison, to compare BoolArrays
Example | lostday := UTIL(COMP,Close, Open, LTEQ)
COUNTER | ArrayData := UTIL(COUNTER, BoolArray, BoolArray2)
Function | Counts the number of TRUE signals that appear in the first array input. The count will continue until a TRUE signal is received in the reset array (BoolArray2). Once a reset is received, the counter value is plotted and the counter is reset back to zero and counting resumes
Example | UTIL(COUNTER, Close, reset_array)
DIV | DataArray := UTIL(DIV, DataArray, DataValue)
Function | Divides the value of DataArray by the value of DataValue
Example | UTIL(DIV, Close, Open) UTIL(DIV, Close, 4.5)
Higher | DataArray := UTIL(Higher, DataArray, DataValue)
Function | Returns the higher value of two compared sets of data arrays
Example | DayMax := UTIL(Higher, Close, Open)
INRANGE | BooleanArray := UTIL(INRANGE,DataArray,DataValue1,DataValue2)
Function | Returns TRUE if the DataArray is GTEQ DataValue1 and LTEQ DataArray2
Example | yes := UTIL(INRANGE,Close,WeekHigh,WeekLow)
Lower | BoolArray := UTIL(Lower, DataArray, DataValue)
Function | Returns the lower value of two compared sets of data arrays
Example | DayLow := UTIL(Lower, Close, Open)
MUL | DataArray := UTIL(MUL, DataArray, DataValue)
Function | Multiplies the value of DataArray by the value of DataValue
Example | UTIL(MUL, Close, Open) UTIL(MUL, Close, 5.5)
Normal | DataArray := UTIL(Normal, DataArray)
Function | Used to normalize an array input
Example | UTIL(Normal,Close)
REF | DataArray := UTIL(REF,DataArray, PERIOD) UTIL(REF, Double)
Function | Used for returning a data array of bar values. An optional period parm can displace the data back a number of bars
Example | UTIL(REF,Close, 0) for no offset UTIL(REF, Close, 10) to offset 10 bars backwards UTIL(REF, 5.5) to create a plot of a single value.
PER | DataArray := UTIL(PER, DataArray)
Function | Plots the performance of the array input from the first bar as the zero reference
Example | Change := UTIL(PER, Close)
SUB | DataArray := UTIL(SUB, DataArray, DataValue)
Function | Subtracts the value of DataValue from the value of DataArray
Example | UTIL(SUB, Close, Open) UTIL(SUB, Close, 45.5)