Smoothed Moving Average, Wilder's smoother over a plain price source. Its alpha is 1 / length where an EMA of the same length uses 2 / (length + 1), so it lags further and turns only once a run of closes has genuinely shifted the level, which is the point: it is the noise filter, not the fast line.

The reference smma is the recursion rma already implements, seeded from the simple average of the first length values, so it first prints at length - 1 and needs no code of its own here.