Overlap studies
Simple Moving Average
Average closing price over a fixed number of bars.
- Engine
- TA-Lib
- Function
SMA- Input series
- close
- Outputs
- 1
How it works
SMA sums the selected price series over the configured time period and divides by that period. In DataCat's TA-Lib-backed registry entry, the price input is the close series.
Use case
Use SMA as a simple smoothed baseline for trend context, feature engineering, and comparisons against faster price movement.
Parameters
| Parameter | Type | Default | Bounds or options | Description |
|---|---|---|---|---|
| Time Period | integer | 30 | 1…100000 | Number of bars included in each moving average window. |
Outputs
| Output | Type | Description |
|---|---|---|
| SMA | number | Simple moving average value for the bar. |
Reading the result
Treat the line as a deliberately slow reference level rather than a prediction. Price above or below the average describes its position relative to the selected history window; the distance and slope add context that a simple crossover discards.
Longer windows remove more short-term variation but react later. Comparing several instances can show whether short-, medium-, and long-horizon baselines agree, although closely spaced windows often add highly correlated features.
Common mistakes
- Interpreting every price crossing as a standalone trading signal.
- Comparing values across assets without accounting for different price scales.
- Forgetting that missing periods and provider differences change the rolling sample.
- Treating warmup
NULLvalues as zeros.
DataCat workflow notes
For feature engineering, consider pairing the raw output with normalized distance from price or with its change over time in downstream SQL. Keep the persisted output state so provisional or derived source history does not silently enter a final-only dataset.