Overall, no attention is paid to letter case. AnyThing is equivalent to aNYthinG. Valid for keywords as well as variable names.

Do not be too creative with variable names. Use alphanumeric characters without space. Do not use any character that can be confused with an operator, like + or -.

You can embed functions within operations but you cannot embed operations as a function parameter RSI(12 + 3) will trigger an alert. You can, however, define a variable dummy = 12 + 3 and use it as a parameter RSI(dummy).

It is not absolutely mandatory, but highly recommended, to leave a space between significant words and operators. It can be sometimes difficult to resolve ambiguous cases. The number or spaces, beyond one, or tabs, does not matter and is interpreted as one space character.

First, available keywords include classical indicators like RSI(14) or MACD(12,26,9) or bollUp(20,2) and so on... These instructions return a table of values over the historical range. If you want the value for a specific day, use the instruction Var. Var returns one value. For instance Dummy=RSI(14), yesterdayRSI = Var(Dummy,1). 0 is today, 1 yesterday, 2 the day before and so on...

Then, keywords list includes classical operators like +, -, /, * or comparison operators like ==, !=, &, |, <, >. Note the assign operator “=“ is different from the equality operator “==“. Careful, it is easy to confuse.

Finally, there are a number of special keywords that deserve further explanation:

- Flow Control:

- If(...test...) then xxx else xxxx endif: Defines a branch where operations following “then” are executed if test is true, or operations following “else” are executed if test is false.

- Wwhile(...test...) xxxx endWhile: Operations, between the “while” keyword and the “endWhile” keyword, are executed while test is true. Careful about infinite loops.

- For(offset, length) xxxx endFor: Execute operations a number of times defined by “length”. Note “HistoRange” used in lieu of length, implies the loop execute on the entire historical range (or, more exactly, what’s necessary to handle display). “offset” defines a starting point for scalar keywords like singleRSI(param,offset). Each time the for loop is executed, the offset is incremented by 1.

- Scalar Operations:

- Decrement(variable,x): Decrement a variable by x

- Increment(variable,x): Increment a variable by x

- stdDev(table): Return the standard deviation of float values in a table

- Var(table,offset): return the value at index “offset” in the table. Zero offset means the most recent value.

- Maximum(x,y), minimum(x,y): Returns a value if both x and y are scalar. Returns a table comparing all values one to one, if either x or y are tables of values.

- Accumulate(table, value): Add value at the end of the table and store it. If table has not yet been defined, it defines it as a new variable for storage.

- Array Operations:

- CrossAbove(curve1,curve2), CrossBelow(curve1,curve2): returns a table of index indicating when the two curves cross. If one of the parameter is a scalar, it’s considered as a level and transformed into a horizontal threshold “curve”.

- ShiftedLeft(curve, offset), shiftedRight(curve, offset): As name indicates, just shift a curve forward or backward. If shifted right, it means the last few data are ignored. If shifted left, the last few days are assumed to be the same as the last known day. shiftedRight(..,1) gives on array of the previous day value. See the sample code for Force Index to see how it can be used.

- Reverse(table): return a new table where the last day becomes the first one.

- Avg(table, param), Avg(param): If one parameter, return a mobile average of quotes data. If two parameters, returns a mobile average of the table defined as the first parameter.

- Scalar Functions:

- Day: In a For loop, return the current index

- Date(day): return a date corresponding to the index.

- HistoRange: Return a number representing the right amount of data, adapted to the current display density. Useful in « For » loops.

- Utilities:

- FetchData(code): Return data for a stock different of the current one.

- LogResult(indent1, ident2, ...) send results to the computer console. Parameters can be values, text or tables

- NotifyResult, notifyResult(param1,param2,param3) can have from zero to three parameters. Defines what will be displayed. In the case of On Screen or classical indicators, it’s curves. In the case of triggers, we should have two tables containing indexes. The first one is interpreted as “buy” days and the second one as “sell” days.