# Indicator Series

> Implement Series-style batch indicators with mathematical precision. Use for new StaticSeries implementations or optimization. Series results are the canonical reference—all other styles must match exactly. Focus on cross-cutting requirements and performance optimization decisions.

- Skill: `daveskender/indicator-series` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add daveskender/indicator-series`
- Raw SKILL.md: https://api.skillmd.com/api/skills/daveskender/indicator-series/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: daveskender (https://skillmd.com/u/daveskender)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/daveskender/indicator-series

---


# Series indicator development

## File structure

All files live in `src/Indicators/{category}/{Indicator}/`:

| File | Purpose |
| ---- | ------- |
| `{Indicator}.Series.cs` | Static partial class — `To{Indicator}()` series entry point |
| `{Indicator}Hub.cs` | Hub class (internal ctor) + `To{Indicator}Hub()` extension |
| `{Indicator}List.cs` | List class + `To{Indicator}List()` extension |
| `{Indicator}.Catalog.cs` | `CommonListing`, `SeriesListing`, `StreamListing`, `BufferListing` |
| `{Indicator}Result.cs` | Result record |
| `{Indicator}.Utilities.cs` | `Validate()` (internal), `Increment()` (public), `RemoveWarmupPeriods()` |
| `I{Indicator}.cs` | Parameter interface (parameter properties only; NOT result properties) |

Test files mirror in `tests/Library/Indicators/{category}/{Indicator}/`:

- `{Indicator}SeriesTests.cs`
- `{Indicator}BufferListTests.cs`
- `{Indicator}HubTests.cs`
- `{Indicator}CatalogTests.cs`
- `{Indicator}RegressionTests.cs`

Category folders: `a-b`, `c-d`, `e-j`, `k-q`, `r-s`, `t-z` (alphabetical)

## Performance optimization

Array allocation pattern (use for predictable result counts; benchmark first):

```csharp
TResult[] results = new TResult[length];
// ... assign results[i] = new TResult(...);
return new List<TResult>(results);  // NOT results.ToList()
```

Some indicators (e.g., ADL) are faster with `List.Add()` — benchmark both.

## Required implementation

Beyond the main `{Indicator}.Series.cs` file, ensure:

- [ ] **Catalog registration**: Create `src/**/{Indicator}.Catalog.cs` and register in `Catalog.Listings.cs`
- [ ] **Interface file**: Create `src/**/{Indicator}/I{Indicator}.cs` with parameter properties (NOT result properties)
- [ ] **Unit tests**: Create `tests/Library/Indicators/**/{Indicator}SeriesTests.cs`
  - Inherit from `StaticSeriesTestBase`
  - Verify against manually calculated reference values; assert documented value ranges with `IsBetween` if applicable
- [ ] **Performance benchmark**: Add to `tools/performance/Perf.Series.cs`
- [ ] **Public documentation**: Update `docs/indicators/{Indicator}.md`
- [ ] **Regression baseline tests**: Add to `tests/Library/Indicators/**/{Indicator}RegressionTests.cs` inheriting from `RegressionTestBase<TResult>` with `[TestCategory("Regression")]` on the class — these compare the full result set to a frozen `*.standard.json` baseline so it can be filtered via `--filter TestCategory=Regression`
- [ ] **Migration guide**: Update `docs/migration/v3.md` for notable and breaking changes from v2

## Precision testing

- Store reference data in `{Indicator}.Data.cs` at maximum precision
- Regression: compare full dataset using Money10-Money12
- Spot checks: use Money4
- Document when precision must be lowered due to accumulated floating-point error

## Examples

- Simple: `src/Indicators/r-s/Sma/Sma.Series.cs`
- Exponential smoothing: `src/Indicators/e-j/Ema/Ema.Series.cs`
- Complex multi-stage: `src/Indicators/a-b/Adx/Adx.Series.cs`
- Multi-value results: `src/Indicators/a-b/Alligator/Alligator.Series.cs`

See [references/decision-tree.md](references/decision-tree.md) for result interface selection.

## Constraints

- Series is canonical truth — BufferList and StreamHub MUST match exactly
- Verify algorithms against authoritative reference publications only
- Never reject NaN inputs; guard against division by zero
- Fix formulas, not symptoms — see src/AGENTS.md

