# Minimal indicator

One setting, one output and a `calculate` method: the smallest file that draws a line. Start here and change the formula.

> **Trap.** The output is empty for the first `period` bars. The `warmup` line says so, and leaving it out makes the chart trust values that are not ready.

## moving_average.py

```python
import forge as fg
from forge import param, ta

FORGE_API = 1


class MovingAverage(fg.Indicator):
    name = "Moving average"
    short_name = "MA"
    pane = "price"

    period = param.Int(20, min=2, max=200)

    average = fg.Output.line("Average")
    warmup = lambda self: self.period

    def calculate(self, bars, start) -> None:
        self.out.average[start:] = ta.sma(bars.close, self.period)[start:]
```
