# Formula Help

The algorithm generated by AIAnalyst for each Order is made available on the report in three different ways:

Formula

C Code

Excel Formula

## Formula

This format aims to be easily readable by non-programmers.

Market data is numbered starting from 1 for the first and most recent candle. As an example, if your most recent market data is 04/16/2013, *open2* is the Open value from 04/15/2013.

The correct way to read the Formula is to start by solving the innermost parentheses, and then solving the ones enclosing them, successively, until the outermost parenthesis is solved.

**Example Formula:** `((high2 - close4) + 0.1120)`

Using the same example dates (last candle is 04/16/2013) this formula can be solve by:

Subtract the close value from 04/13/2013 from the open value from 04/15/2013.

Add 0.1120 to this value.

final value > 0: buy; final value < 0: sell; final value = 0: hold.

## C Code

This format can be pasted directly to your C code.

The `candles`

array is zero-based, with the first element (position 0) having the most recent candle

## Excel Formula

Just like the C Code, the Excel Formula can be pasted directly to your spreadsheet

Market data used by the Excel Formula should have the following arrangement:

Starts at the second line and second column (First column and row reserved for dates and header info)

Value columns are ordered as Open/High/Low/Close

Data is sorted descending by date (most recent candle at the top)

**Example Formula:** `=CHOOSE(SIGN((C3 - E5) + 0.112)+2,"DOWN","N\A","UP")`

This is how the example formula can be directly pasted in an Excel spreadsheet, revealing the result for this data set: