mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-16 01:28:05 +00:00
Add Savitzky-Golay Moving Average (SGMA) Indicator Implementation
- Implemented SgmaIndicator class in C# with properties for Period, Degree, and Source. - Added unit tests for SgmaIndicator covering constructor defaults, initialization, and various update scenarios. - Created a new Quantower adapter for the SGMA indicator, including input parameters and line series setup. - Removed legacy SGMA implementation and tests to streamline the codebase. - Updated project files to include new indicator and tests in the build process. - Generated a missing indicators report and outlined a plan for oscillator documentation rewrite.
This commit is contained in:
@@ -0,0 +1,218 @@
|
||||
# Missing Indicators Report
|
||||
|
||||
> Generated: 2026-02-13 (refreshed) | Source: Cross-reference of `_index.md` files vs actual filesystem
|
||||
|
||||
## Summary
|
||||
|
||||
| Status | Count | Description |
|
||||
|--------|------:|-------------|
|
||||
| **Fully Implemented** | 258 | `.cs` + tests + docs |
|
||||
| **Pine-Only** (has spec, no C#) | 25 | Directory exists with `.pine` file only |
|
||||
| **No Directory** (listed in master index, no files) | 38 | Planned but nothing on disk |
|
||||
| **Doc-Only** | 1 | Only `.md` file exists |
|
||||
| **Index Discrepancies** | 4 | Count or category mismatches |
|
||||
|
||||
---
|
||||
|
||||
## Implemented Categories (fully in C#)
|
||||
|
||||
| Category | Subdirs | Implemented | Notes |
|
||||
|----------|--------:|------------:|-------|
|
||||
| Trends (FIR) | 17 | **17** | All complete |
|
||||
| Trends (IIR) | 23 | **23** | All complete (LTMA planned, no subdir) |
|
||||
| Filters | 18 | **18** | All complete |
|
||||
| Oscillators | 19 | **19** | All complete (16 more planned, no subdir) |
|
||||
| Dynamics | 17 | **17** | All complete (IMPULSE planned, no subdir) |
|
||||
| Momentum | 16 | **16** | All complete |
|
||||
| Volatility | 26 | **26** | All complete |
|
||||
| Volume | 26 | **26** | All complete |
|
||||
| Channels | 23 | **23** | All complete |
|
||||
| Cycles | 14 | **14** | All complete (PHASOR planned, broken link) |
|
||||
| Errors | 26 | **26** | All complete (no Quantower wrappers) |
|
||||
| Numerics | 15 | **15** | All complete (incl. ACCEL, JERK, SLOPE) |
|
||||
| Forecasts | 1 | **1** | AFIRMA only (MLP planned) |
|
||||
| Statistics | 30 | **14** | 16 pine-only — see below |
|
||||
| Reversals | 10 | **0** | 9 pine-only + 1 doc-only — see below |
|
||||
| Feeds | 3 | **3** | CSV, GBM, IFeed |
|
||||
|
||||
---
|
||||
|
||||
## 1. PINE-ONLY Indicators (spec exists, no C# implementation)
|
||||
|
||||
These have directories with `.pine` reference files but **zero `.cs` files**. They need full implementation.
|
||||
|
||||
### Statistics (16 indicators — pine-only)
|
||||
|
||||
| Indicator | Directory |
|
||||
|-----------|-----------|
|
||||
| ENTROPY | `lib/statistics/entropy/` |
|
||||
| GEOMEAN | `lib/statistics/geomean/` |
|
||||
| GRANGER | `lib/statistics/granger/` |
|
||||
| HARMEAN | `lib/statistics/harmean/` |
|
||||
| HURST | `lib/statistics/hurst/` |
|
||||
| IQR | `lib/statistics/iqr/` |
|
||||
| JB | `lib/statistics/jb/` |
|
||||
| KENDALL | `lib/statistics/kendall/` |
|
||||
| KURTOSIS | `lib/statistics/kurtosis/` |
|
||||
| MODE | `lib/statistics/mode/` |
|
||||
| PERCENTILE | `lib/statistics/percentile/` |
|
||||
| QUANTILE | `lib/statistics/quantile/` |
|
||||
| SPEARMAN | `lib/statistics/spearman/` |
|
||||
| THEIL | `lib/statistics/theil/` |
|
||||
| ZSCORE | `lib/statistics/zscore/` |
|
||||
| ZTEST | `lib/statistics/ztest/` |
|
||||
|
||||
### Reversals (9 indicators — pine-only)
|
||||
|
||||
| Indicator | Directory |
|
||||
|-----------|-----------|
|
||||
| FRACTALS | `lib/reversals/fractals/` |
|
||||
| PIVOT | `lib/reversals/pivot/` |
|
||||
| PIVOTCAM | `lib/reversals/pivotcam/` |
|
||||
| PIVOTDEM | `lib/reversals/pivotdem/` |
|
||||
| PIVOTEXT | `lib/reversals/pivotext/` |
|
||||
| PIVOTFIB | `lib/reversals/pivotfib/` |
|
||||
| PIVOTWOOD | `lib/reversals/pivotwood/` |
|
||||
| PSAR | `lib/reversals/psar/` |
|
||||
| SWINGS | `lib/reversals/swings/` |
|
||||
|
||||
---
|
||||
|
||||
## 2. NO DIRECTORY at All (listed in master index, no files on disk)
|
||||
|
||||
These indicators appear in `lib/_index.md` as plain text (no markdown link), meaning they are planned but have **no directory, no files**.
|
||||
|
||||
### Oscillators (16 planned)
|
||||
|
||||
| Indicator | Full Name |
|
||||
|-----------|-----------|
|
||||
| BBI | Bulls Bears Index |
|
||||
| BRAR | BRAR |
|
||||
| COPPOCK | Coppock Curve |
|
||||
| CRSI | Connors RSI |
|
||||
| CTI | Correlation Trend Indicator |
|
||||
| DOSC | Derivative Oscillator |
|
||||
| ER | Efficiency Ratio |
|
||||
| ERI | Elder Ray Index |
|
||||
| FOSC | Forecast Oscillator |
|
||||
| KRI | Kairi Relative Index |
|
||||
| KST | KST Oscillator |
|
||||
| PSL | Psychological Line |
|
||||
| QQE | Quantitative Qualitative Estimation |
|
||||
| RVGI | Relative Vigor Index |
|
||||
| SQUEEZE | Squeeze |
|
||||
| TD_SEQ | TD Sequential |
|
||||
|
||||
### Numerics (14 planned — distributions and transforms)
|
||||
|
||||
| Indicator | Full Name |
|
||||
|-----------|-----------|
|
||||
| BETADIST | Beta Distribution |
|
||||
| BINOMDIST | Binomial Distribution |
|
||||
| CWT | Continuous Wavelet Transform |
|
||||
| DWT | Discrete Wavelet Transform |
|
||||
| EXPDIST | Exponential Distribution |
|
||||
| FDIST | F-Distribution |
|
||||
| FFT | Fast Fourier Transform |
|
||||
| GAMMADIST | Gamma Distribution |
|
||||
| IFFT | Inverse Fast Fourier Transform |
|
||||
| LOGNORMDIST | Log-normal Distribution |
|
||||
| NORMDIST | Normal Distribution |
|
||||
| POISSONDIST | Poisson Distribution |
|
||||
| TDIST | Student's t-Distribution |
|
||||
| WEIBULLDIST | Weibull Distribution |
|
||||
|
||||
### Statistics (3 planned)
|
||||
|
||||
| Indicator | Full Name |
|
||||
|-----------|-----------|
|
||||
| POLYFIT | Polynomial Fitting |
|
||||
| TSF | Time Series Forecast |
|
||||
| WAVG | Weighted Average |
|
||||
|
||||
### Reversals (2 planned)
|
||||
|
||||
| Indicator | Full Name |
|
||||
|-----------|-----------|
|
||||
| CHANDELIER | Chandelier Exit |
|
||||
| CKSTOP | Chande Kroll Stop |
|
||||
|
||||
### Forecasts (1 planned)
|
||||
|
||||
| Indicator | Full Name |
|
||||
|-----------|-----------|
|
||||
| MLP | Multilayer Perceptron |
|
||||
|
||||
---
|
||||
|
||||
## 3. DOC-ONLY (has `.md` but no `.cs` or `.pine`)
|
||||
|
||||
| Indicator | Directory | Files Present |
|
||||
|-----------|-----------|---------------|
|
||||
| TTM_SCALPER | `lib/reversals/ttm_scalper/` | `TtmScalper.md` only |
|
||||
|
||||
---
|
||||
|
||||
## 4. Index Discrepancies
|
||||
|
||||
### Category Mismatches
|
||||
|
||||
| Issue | Details |
|
||||
|-------|---------|
|
||||
| **APO** | Listed under Momentum in `_index.md` (`momentum/apo/Apo.md`) but actually lives at `lib/oscillators/apo/`. Broken link. |
|
||||
| **PHASOR** | Listed under Cycles with link `cycles/phasor/Phasor.md` but `lib/cycles/phasor/` does not exist. Broken link. |
|
||||
|
||||
### Count Mismatches in Master `_index.md` Header
|
||||
|
||||
| Category | Claimed | Actual Subdirs | Notes |
|
||||
|----------|--------:|-----------:|-------|
|
||||
| Oscillators | 18 | 19 | APO counted here, not in Momentum |
|
||||
| Dynamics | 16 | 17 | Actual has 17 implemented subdirs |
|
||||
| Momentum | 17 | 16 | APO missing (lives in oscillators) |
|
||||
| Channels | 22 | 23 | Actual has 23 implemented subdirs |
|
||||
| Cycles | 15 | 14 | PHASOR counted but subdir doesn't exist |
|
||||
| Statistics | 31 | 30 | 30 subdirs (14 implemented + 16 pine-only); 3 more planned with no subdir |
|
||||
|
||||
---
|
||||
|
||||
## 5. Priority Implementation Order
|
||||
|
||||
### Tier 1 — High Value (pine-only, well-specified)
|
||||
|
||||
1. **Reversals** (9 pine-only) — Entire category unimplemented in C#
|
||||
- PSAR, FRACTALS, PIVOT, PIVOTCAM, PIVOTDEM, PIVOTEXT, PIVOTFIB, PIVOTWOOD, SWINGS
|
||||
|
||||
2. **Statistics** (16 pine-only) — Large gap in core functionality
|
||||
- ENTROPY, GEOMEAN, HARMEAN, KURTOSIS, PERCENTILE, QUANTILE, ZSCORE
|
||||
- HURST, KENDALL, SPEARMAN, IQR, JB, ZTEST, THEIL, MODE, GRANGER
|
||||
|
||||
### Tier 2 — Medium Value (planned oscillators/dynamics)
|
||||
|
||||
1. **Oscillators** (16 planned, no files) — Many well-known indicators
|
||||
- QQE, RVGI, COPPOCK, KST, CRSI, TD_SEQ, ERI, SQUEEZE
|
||||
- BBI, BRAR, CTI, DOSC, ER, FOSC, KRI, PSL
|
||||
|
||||
2. **Dynamics** — IMPULSE (Elder Impulse System)
|
||||
3. **Reversals** — CHANDELIER, CKSTOP (no pine spec)
|
||||
4. **TTM_SCALPER** — doc exists, needs C# implementation
|
||||
|
||||
### Tier 3 — Lower Priority (math/distributions/misc)
|
||||
|
||||
1. **Numerics distributions** (14 planned) — Statistical distributions + transforms
|
||||
2. **Statistics** — POLYFIT, TSF, WAVG
|
||||
3. **Trends IIR** — LTMA
|
||||
4. **Forecasts** — MLP
|
||||
5. **Cycles** — PHASOR
|
||||
|
||||
---
|
||||
|
||||
## 6. Totals
|
||||
|
||||
| Type | Count |
|
||||
|------|------:|
|
||||
| Pine-only (spec ready, no C#) | **25** |
|
||||
| No directory (planned only) | **38** |
|
||||
| Doc-only | **1** |
|
||||
| **Total missing indicators** | **64** |
|
||||
| **Total implemented (C#)** | **258** |
|
||||
| **Total listed in master index** | **278** |
|
||||
@@ -0,0 +1,106 @@
|
||||
# Plan: Rewrite All Oscillator .md Files to Gold Standard Template
|
||||
|
||||
## Context
|
||||
|
||||
The gold standard documentation template lives at `temp/doc_template.md`. It was derived from comparative analysis of 8 existing indicator docs across tiers (Jma.md, Rsi.md, Willr.md, Obv.md, Ssf.md, Adx.md, Imi.md, Mom.md) and is stored in qdrant.
|
||||
|
||||
The first application was `lib/oscillators/trix/Trix.md` (completed, verified against source with 22 verification points). This serves as the reference exemplar for oscillator-category docs.
|
||||
|
||||
## Inventory (19 indicators, 1 done)
|
||||
|
||||
| # | Indicator | Current Lines | File | Status |
|
||||
|---|-----------|:------------:|------|--------|
|
||||
| 1 | TRIX | 157 | `lib/oscillators/trix/Trix.md` | **Done** |
|
||||
| 2 | WillR | 110 | `lib/oscillators/willr/Willr.md` | Pending |
|
||||
| 3 | Stoch | 91 | `lib/oscillators/stoch/Stoch.md` | Pending |
|
||||
| 4 | Stochf | 94 | `lib/oscillators/stochf/Stochf.md` | Pending |
|
||||
| 5 | StochRSI | 157 | `lib/oscillators/stochrsi/Stochrsi.md` | Pending |
|
||||
| 6 | SMI | 106 | `lib/oscillators/smi/Smi.md` | Pending |
|
||||
| 7 | KDJ | 81 | `lib/oscillators/kdj/Kdj.md` | Pending |
|
||||
| 8 | Fisher | 43 | `lib/oscillators/fisher/Fisher.md` | Pending |
|
||||
| 9 | AC | 84 | `lib/oscillators/ac/Ac.md` | Pending |
|
||||
| 10 | AO | 45 | `lib/oscillators/ao/Ao.md` | Pending |
|
||||
| 11 | APO | 47 | `lib/oscillators/apo/Apo.md` | Pending |
|
||||
| 12 | BBB | 71 | `lib/oscillators/bbb/Bbb.md` | Pending |
|
||||
| 13 | BBS | 89 | `lib/oscillators/bbs/Bbs.md` | Pending |
|
||||
| 14 | CFO | 102 | `lib/oscillators/cfo/Cfo.md` | Pending |
|
||||
| 15 | DPO | 73 | `lib/oscillators/dpo/Dpo.md` | Pending |
|
||||
| 16 | Inertia | 52 | `lib/oscillators/inertia/Inertia.md` | Pending |
|
||||
| 17 | PGO | 82 | `lib/oscillators/pgo/Pgo.md` | Pending |
|
||||
| 18 | TTM Wave | 106 | `lib/oscillators/ttm_wave/TtmWave.md` | Pending |
|
||||
| 19 | Ultosc | 88 | `lib/oscillators/ultosc/Ultosc.md` | Pending |
|
||||
|
||||
## Execution Workflow (per indicator)
|
||||
|
||||
Each rewrite follows the same proven workflow used for TRIX:
|
||||
|
||||
### Step 1: Gather Implementation Details
|
||||
- Use `understand` (dotnet-semantic-mcp) scoped to the indicator class to get full source, hierarchy, references
|
||||
- Read the `.Validation.Tests.cs` file to extract validation library coverage and tolerances
|
||||
- Check for `.pine` file in the indicator directory (source material reference)
|
||||
|
||||
### Step 2: Write the Document
|
||||
Follow the gold standard template sections in order:
|
||||
1. **Title + Quote** - `# ABBREV: Full Name` + witty one-liner
|
||||
2. **Quick-ref card** - Category, Inputs, Parameters, Outputs, Output range, Warmup
|
||||
3. **Key takeaways** - 5 bullets
|
||||
4. **Historical Context** - 2-3 paragraphs
|
||||
5. **What It Measures and Why It Matters** - 2-3 opinionated paragraphs
|
||||
6. **Mathematical Foundation** - LaTeX formulas, parameter mapping, warmup period
|
||||
7. **Architecture & Physics** - Pipeline description, state management, FMA usage, edge cases
|
||||
8. **Interpretation and Signals** - Signal zones table, patterns, practical notes
|
||||
9. **Related Indicators** - 2-4 with relative links
|
||||
10. **Validation** - Simplified table (Status/Notes columns only)
|
||||
11. **Performance Profile** - Key optimizations, operation count, SIMD analysis
|
||||
12. **Common Pitfalls** - 5-7 numbered items
|
||||
13. **FAQ** - Optional, for complex indicators
|
||||
14. **References** - Academic and web sources
|
||||
|
||||
### Step 3: Verify Against Source
|
||||
Cross-check all technical claims against the `.cs` source:
|
||||
- Default period, parameter constraints
|
||||
- State struct fields and initialization
|
||||
- Alpha/decay formulas
|
||||
- Warmup period formula and IsHot condition
|
||||
- FMA patterns used
|
||||
- NaN/Infinity handling
|
||||
- Bar correction logic
|
||||
- Validation library coverage matches test file
|
||||
|
||||
### Step 4: Store in qdrant
|
||||
Record completion with tags for future reference.
|
||||
|
||||
## Batching Strategy
|
||||
|
||||
Process in groups of related indicators for cross-referencing efficiency:
|
||||
|
||||
### Batch 1: Stochastic Family (share architecture patterns)
|
||||
- Stoch, Stochf, StochRSI, KDJ, SMI
|
||||
|
||||
### Batch 2: Bill Williams / Momentum Oscillators
|
||||
- AC, AO, APO, CFO, DPO
|
||||
|
||||
### Batch 3: Bollinger/Statistical Oscillators
|
||||
- BBB, BBS, PGO, Inertia
|
||||
|
||||
### Batch 4: Remaining
|
||||
- Fisher, WillR, TtmWave, Ultosc
|
||||
|
||||
## Template Rules Reminder
|
||||
|
||||
- **Voice**: GRINGE blend. Skeptical-architect tone.
|
||||
- **Anti-slop forbidden words**: delve, leverage, pivotal, tapestry, landscape, furthermore, seamless, ecosystem, transformative, foster
|
||||
- **No em-dashes**
|
||||
- **Quality Metrics section**: OMIT (oscillators are not trends/filters)
|
||||
- **Validation table**: Simplified 2-column format (Status, Notes)
|
||||
- **LaTeX**: Only in Mathematical Foundation section
|
||||
- **Code blocks**: Only in Architecture & Physics section for pipeline diagrams
|
||||
- **Exemplar**: `lib/oscillators/trix/Trix.md` (completed reference)
|
||||
|
||||
## Dependencies
|
||||
|
||||
- Gold standard template: `temp/doc_template.md`
|
||||
- Reference exemplar: `lib/oscillators/trix/Trix.md`
|
||||
- C# analysis: requires `__unlock_csharp_analysis__` per session
|
||||
- All 19 indicators have validation tests (confirmed)
|
||||
- All 19 indicators have existing .md files to be replaced
|
||||
Reference in New Issue
Block a user