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

ParameterTypeDefaultBounds or optionsDescription
Time Periodinteger301…100000Number of bars included in each moving average window.

Outputs

OutputTypeDescription
SMAnumberSimple 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

  1. Interpreting every price crossing as a standalone trading signal.
  2. Comparing values across assets without accounting for different price scales.
  3. Forgetting that missing periods and provider differences change the rolling sample.
  4. Treating warmup NULL values 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.

Resources

Search documentation

Search across 46 documentation pages.