Skip to content

Commit 9c63fd9

Browse files
spec: add indicator-sma specification (#3657)
## New Specification: `indicator-sma` Related to #3651 --- ### specification.md # indicator-sma: Simple Moving Average (SMA) Indicator Chart ## Description A Simple Moving Average (SMA) chart displays price or value data with one or more SMA overlays, typically showing short, medium, and long-term periods (e.g., 20, 50, 200-day). Each SMA line smooths out price fluctuations by averaging the last N data points, revealing underlying trends at different time scales. This multi-period overlay is fundamental to technical analysis, helping traders identify trend direction, support/resistance levels, and potential crossover signals. ## Applications - Identifying trend direction by comparing price position relative to 50-day and 200-day SMAs in stock analysis - Detecting golden cross (50-day crosses above 200-day) and death cross signals in cryptocurrency trading - Analyzing short-term momentum versus long-term trend using 20/50/200-day SMA combinations - Smoothing noisy time series data to reveal underlying patterns in sensor or metrics monitoring ## Data - `date` (datetime) - Trading date or timestamp for each period - `close` (numeric) - Closing price or value for each period - `sma_short` (numeric) - Short-term SMA (e.g., 20-period) - `sma_medium` (numeric) - Medium-term SMA (e.g., 50-period) - `sma_long` (numeric) - Long-term SMA (e.g., 200-period) - Size: 250-500 periods to show meaningful long-term SMA behavior - Example: Daily stock closing prices with 20, 50, and 200-day SMAs over one year of trading ## Notes - Display the price/close line prominently, typically as a solid line or with subtle markers - Each SMA should use a distinct color with consistent styling across all implementations - Include a legend showing the period for each SMA (e.g., "SMA 20", "SMA 50", "SMA 200") - Longer SMAs will have more initial null values due to the calculation window - Standard periods are 20/50/200 for daily data, but other combinations like 10/20/50 are also common - Grid lines on the y-axis improve price level readability --- **Next:** Add `approved` label to the issue to merge this PR. --- :robot: *[spec-create workflow](https://github.com/MarkusNeusinger/pyplots/actions/runs/20886473767)* Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent c49f4ab commit 9c63fd9

2 files changed

Lines changed: 59 additions & 0 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# indicator-sma: Simple Moving Average (SMA) Indicator Chart
2+
3+
## Description
4+
5+
A Simple Moving Average (SMA) chart displays price or value data with one or more SMA overlays, typically showing short, medium, and long-term periods (e.g., 20, 50, 200-day). Each SMA line smooths out price fluctuations by averaging the last N data points, revealing underlying trends at different time scales. This multi-period overlay is fundamental to technical analysis, helping traders identify trend direction, support/resistance levels, and potential crossover signals.
6+
7+
## Applications
8+
9+
- Identifying trend direction by comparing price position relative to 50-day and 200-day SMAs in stock analysis
10+
- Detecting golden cross (50-day crosses above 200-day) and death cross signals in cryptocurrency trading
11+
- Analyzing short-term momentum versus long-term trend using 20/50/200-day SMA combinations
12+
- Smoothing noisy time series data to reveal underlying patterns in sensor or metrics monitoring
13+
14+
## Data
15+
16+
- `date` (datetime) - Trading date or timestamp for each period
17+
- `close` (numeric) - Closing price or value for each period
18+
- `sma_short` (numeric) - Short-term SMA (e.g., 20-period)
19+
- `sma_medium` (numeric) - Medium-term SMA (e.g., 50-period)
20+
- `sma_long` (numeric) - Long-term SMA (e.g., 200-period)
21+
- Size: 250-500 periods to show meaningful long-term SMA behavior
22+
- Example: Daily stock closing prices with 20, 50, and 200-day SMAs over one year of trading
23+
24+
## Notes
25+
26+
- Display the price/close line prominently, typically as a solid line or with subtle markers
27+
- Each SMA should use a distinct color with consistent styling across all implementations
28+
- Include a legend showing the period for each SMA (e.g., "SMA 20", "SMA 50", "SMA 200")
29+
- Longer SMAs will have more initial null values due to the calculation window
30+
- Standard periods are 20/50/200 for daily data, but other combinations like 10/20/50 are also common
31+
- Grid lines on the y-axis improve price level readability
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Specification-level metadata for indicator-sma
2+
# Auto-synced to PostgreSQL on push to main
3+
4+
spec_id: indicator-sma
5+
title: Simple Moving Average (SMA) Indicator Chart
6+
7+
# Specification tracking
8+
created: 2026-01-11T00:09:18Z
9+
updated: null
10+
issue: 3651
11+
suggested: MarkusNeusinger
12+
13+
# Classification tags (applies to all library implementations)
14+
# See docs/reference/tagging-system.md for detailed guidelines
15+
tags:
16+
plot_type:
17+
- line
18+
- indicator
19+
data_type:
20+
- timeseries
21+
- numeric
22+
domain:
23+
- finance
24+
- general
25+
features:
26+
- multi
27+
- overlay
28+
- trend

0 commit comments

Comments
 (0)