| name | add-indicator |
| description | Add a new technical analysis indicator to the project. Use when you need to implement a new indicator (e.g., SMA, EMA, RSI) following the project's streaming data patterns, Go generics, and channel-based API. |
Add Indicator
This skill provides the workflow and standards for adding new technical analysis indicators to the indicator project.
Workflow
1. Identify Category and Location
Indicators are organized by their technical analysis category. Determine where the new indicator belongs:
trend/: Trend-following indicators (SMA, EMA, MACD, etc.)
momentum/: Momentum indicators (RSI, Stochastic, etc.)
volatility/: Volatility indicators (Bollinger Bands, ATR, etc.)
volume/: Volume-based indicators (OBV, Chaikin Money Flow, etc.)
valuation/: Asset valuation (FV, NPV, etc.)
2. Implementation Standards
Streaming Data Patterns
- Indicators MUST operate on unlimited data streams using Go routines and channels.
- Use
<-chan T for inputs and <-chan T (or multiple channels) for outputs.
- Indicators may have an "idle" or "warm-up" period where they don't produce output until their internal window is filled.
Generics and Types
- All indicators must use Go generics with the
helper.Number constraint.
- Define a struct for the indicator and a
New<Indicator> factory function.
- Implement a
Compute method: func (i *Indicator[T]) Compute(c <-chan T) <-chan T.
- Implement an
IdlePeriod method: func (i *Indicator[T]) IdlePeriod() int to return the number of elements it skips.