TREND, MOVING AVERAGES & STRUCTURE

SMA (Simple Moving Average)

The plain average closing price over the period — the market's baseline.

spec id: smalength (default 20)

What does SMA measure?

The plain trend line — the classic "is this stock healthy?" test. Price above it is the textbook definition of an uptrend.

How is SMA calculated?

Add up the last 20 closing prices and divide by 20. Nothing fancy — every candle counts equally, which is why it moves slowly and steadily.

Written by reading the engine’s real computation, not a textbook — where the two differ, the page describes what actually runs.

How do traders read SMA?

The 200-day is the classic regime line: above it, dips get bought; below it, rallies get sold. 20-day = short-term drift.

How do I use SMA in a bot?

Add indicator → SMA, set period. Note sma20 and sma200 also exist as built-in features — no setup needed.

See it inside a famous strategy

Related indicators

Or browse all 158 indicators in the full library.

Build a bot that trades on SMA — the first backtest is free.

Run a free backtest