# Trend Detector

Based on the Hull Moving Average (HMA) by Alan Hull. HMA reduces lag while
maintaining smoothness, making it more responsive to trend changes than
standard WMA or EMA.

## Versions

| Version | File    | Notes                                            |
|---------|---------|--------------------------------------------------|
| v2      | v2.json | HMA(16) slope + price position entry/exit        |

## Logic

**HMA(16)** = `WMA(2 × WMA(close, 8) − WMA(close, 16), 4)` — `sqrt(16) = 4`

**Entry**: HMA rising (HMA > HMA[1]) AND close > HMA.
**Exit**: HMA declining (HMA < HMA[1]) OR close < HMA.

## Indicators

- `WMA(8)`, `WMA(16)` — weighted moving averages
- `apply_func(wma, period=4)` — outer WMA for HMA calculation

## Data requirements

- 1h candles recommended.
- Minimum warmup: ~20 candles for WMA components.

## Known limitations

- No regime filter (ADX or equivalent). HMA is reactive enough that false
  signals occur in ranging markets.
- Period 16 is relatively short; a HMA(20) or HMA(25) would trade less frequently
  but with more conviction.
