# Trend reference

> All 8 trend in AlgoBarsX, each with its parameters, defaults, ranges and an example: supertrend, psar, adx, dmi, ichimoku, aroon, vortex, linreg.

Source: https://algobarsx.com/docs/ref-fn-trend/

### `supertrend(length = 10, multiplier = 3.0, on = bars())` → Supertrend

Supertrend line and direction.

#### Parameters

| Name | Type | Default | Range | What it is |
| --- | --- | --- | --- | --- |
| `length` | int | `10` | 1 to 5000 | ATR length. |
| `multiplier` | number | `3.0` | 0.1 to 50 | ATR multiplier. |
| `on` | BarSet | `bars()` |  | Bars to calculate on; defaults to the script's own bars. |

#### Outputs, read with a dot

| Name | Type | What it is |
| --- | --- | --- |
| `line` | series<price> | Supertrend line. |
| `direction` | series<int> | 1 when up, -1 when down. |

```algobarsx
st = supertrend(10, multiplier: 3.0)
```

Works in: strategy, indicator, alert, library. Since 1.0.

### `psar(start = 0.02, increment = 0.02, maximum = 0.2, on = bars())` → series<price>

Parabolic SAR.

#### Parameters

| Name | Type | Default | Range | What it is |
| --- | --- | --- | --- | --- |
| `start` | number | `0.02` | 0.001 to 1 | Starting acceleration. |
| `increment` | number | `0.02` | 0.001 to 1 | Acceleration step. |
| `maximum` | number | `0.2` | 0.001 to 1 | Maximum acceleration. |
| `on` | BarSet | `bars()` |  | Bars to calculate on; defaults to the script's own bars. |

```algobarsx
sar = psar(start: 0.02, increment: 0.02, maximum: 0.2)
```

Works in: strategy, indicator, alert, library. Since 1.0.

### `adx(length = 14, on = bars())` → series<number>

Average directional index.

#### Parameters

| Name | Type | Default | Range | What it is |
| --- | --- | --- | --- | --- |
| `length` | int | `14` | 1 to 5000 | Number of bars in the calculation. |
| `on` | BarSet | `bars()` |  | Bars to calculate on; defaults to the script's own bars. |

```algobarsx
strength = adx(14)
```

Works in: strategy, indicator, alert, library. Since 1.0.

### `dmi(length = 14, on = bars())` → Dmi

Directional movement index.

#### Parameters

| Name | Type | Default | Range | What it is |
| --- | --- | --- | --- | --- |
| `length` | int | `14` | 1 to 5000 | Number of bars in the calculation. |
| `on` | BarSet | `bars()` |  | Bars to calculate on; defaults to the script's own bars. |

#### Outputs, read with a dot

| Name | Type | What it is |
| --- | --- | --- |
| `plus` | series<number> | +DI. |
| `minus` | series<number> | -DI. |
| `adx` | series<number> | ADX. |

```algobarsx
movement = dmi(14)
```

Works in: strategy, indicator, alert, library. Since 1.0.

### `ichimoku(conversion = 9, base = 26, span_b = 52, displacement = 26, on = bars())` → Ichimoku

Ichimoku cloud.

#### Parameters

| Name | Type | Default | Range | What it is |
| --- | --- | --- | --- | --- |
| `conversion` | int | `9` | 1 to 500 | Conversion line length. |
| `base` | int | `26` | 1 to 500 | Base line length. |
| `span_b` | int | `52` | 1 to 1000 | Leading span B length. |
| `displacement` | int | `26` | 1 to 500 | Cloud displacement. |
| `on` | BarSet | `bars()` |  | Bars to calculate on; defaults to the script's own bars. |

#### Outputs, read with a dot

| Name | Type | What it is |
| --- | --- | --- |
| `conversion` | series<price> | Conversion line. |
| `base` | series<price> | Base line. |
| `span_a` | series<price> | Leading span A. |
| `span_b` | series<price> | Leading span B. |
| `lagging` | series<price> | Lagging span. |

```algobarsx
cloud = ichimoku(conversion: 9, base: 26, span_b: 52, displacement: 26)
```

Works in: strategy, indicator, alert, library. Since 1.0.

### `aroon(length = 25, on = bars())` → Aroon

Aroon up and down.

#### Parameters

| Name | Type | Default | Range | What it is |
| --- | --- | --- | --- | --- |
| `length` | int | `25` | 1 to 5000 | Number of bars in the calculation. |
| `on` | BarSet | `bars()` |  | Bars to calculate on; defaults to the script's own bars. |

#### Outputs, read with a dot

| Name | Type | What it is |
| --- | --- | --- |
| `up` | series<number> | Aroon up. |
| `down` | series<number> | Aroon down. |

```algobarsx
ar = aroon(25)
```

Works in: strategy, indicator, alert, library. Since 1.0.

### `vortex(length = 14, on = bars())` → Vortex

Vortex indicator.

#### Parameters

| Name | Type | Default | Range | What it is |
| --- | --- | --- | --- | --- |
| `length` | int | `14` | 1 to 5000 | Number of bars in the calculation. |
| `on` | BarSet | `bars()` |  | Bars to calculate on; defaults to the script's own bars. |

#### Outputs, read with a dot

| Name | Type | What it is |
| --- | --- | --- |
| `plus` | series<number> | VI+. |
| `minus` | series<number> | VI-. |

```algobarsx
vx = vortex(14)
```

Works in: strategy, indicator, alert, library. Since 1.0.

### `linreg(source = close, length = 20, offset = 0)` → like source

Linear regression value.

#### Parameters

| Name | Type | Default | Range | What it is |
| --- | --- | --- | --- | --- |
| `source` | series<number> | `close` |  | Series to calculate from. |
| `length` | int | `20` | 1 to 5000 | Number of bars in the calculation. |
| `offset` | int | `0` | 0 to 500 | Bars back from the current bar. |

```algobarsx
fit = linreg(close, 20)
```

Works in: strategy, indicator, alert, library. Since 1.0.
