Enhance documentation and validation for various indicators

This commit is contained in:
Miha Kralj
2025-12-22 20:42:26 -08:00
parent 5bb8c122c0
commit 4efa0e773e
81 changed files with 4267 additions and 640 deletions
+4 -5
View File
@@ -39,7 +39,7 @@ public class TemaValidationTests
var sResult = _testData.SkenderQuotes.GetTema(period).ToList();
// Compare last 100 records
ValidationHelper.VerifyData(qResult, sResult, x => x.Tema);
ValidationHelper.VerifyData(qResult, sResult, x => x.Tema, tolerance: ValidationHelper.SkenderTolerance);
}
_output.WriteLine("TEMA Batch(TSeries) validated successfully against Skender.Stock.Indicators");
}
@@ -65,7 +65,7 @@ public class TemaValidationTests
int lookback = TALib.Functions.TemaLookback(period);
// Compare last 100 records
ValidationHelper.VerifyData(qResult, output, outRange, lookback);
ValidationHelper.VerifyData(qResult, output, outRange, lookback, tolerance: ValidationHelper.TalibTolerance);
}
_output.WriteLine("TEMA Batch(TSeries) validated successfully against TA-Lib");
}
@@ -94,12 +94,11 @@ public class TemaValidationTests
var tResult = outputs[0];
// Compare last 100 records
ValidationHelper.VerifyData(qResult, tResult, lookback);
ValidationHelper.VerifyData(qResult, tResult, lookback, tolerance: ValidationHelper.TulipTolerance);
}
_output.WriteLine("TEMA Batch(TSeries) validated successfully against Tulip");
}
[Fact]
public void Validate_Talib_Span()
{
@@ -121,7 +120,7 @@ public class TemaValidationTests
int lookback = TALib.Functions.TemaLookback(period);
// Compare last 100 records
ValidationHelper.VerifyData(qOutput, talibOutput, outRange, lookback);
ValidationHelper.VerifyData(qOutput, talibOutput, outRange, lookback, tolerance: ValidationHelper.TalibTolerance);
}
_output.WriteLine("TEMA Span validated successfully against TA-Lib");
}
+17 -1
View File
@@ -33,9 +33,25 @@ $$ TEMA = (3 \times EMA_1) - (3 \times EMA_2) + EMA_3 $$
## Performance Profile
| Metric | Score | Notes |
| :--- | :--- | :--- |
| **Throughput** | 9 | High; O(1) calculation with 3 EMA steps. |
| **Allocations** | 0 | Zero-allocation in hot paths. |
| **Complexity** | O(1) | Constant time regardless of period. |
| **Accuracy** | 10 | Matches TA-Lib exactly. |
| **Timeliness** | 10 | Extremely low lag; nearly zero-lag tracking. |
| **Overshoot** | 8 | Significant overshoot on sharp reversals. |
| **Smoothness** | 6 | Less smooth than SMA/EMA due to high responsiveness. |
## Validation
Validated against TA-Lib (`TA_TEMA`) and Skender.Stock.Indicators.
| Library | Status | Notes |
| :--- | :--- | :--- |
| **QuanTAlib** | ✅ | Validated. |
| **TA-Lib** | ✅ | Matches `TA_TEMA` exactly. |
| **Skender** | ✅ | Matches `GetTema` exactly. |
| **Tulip** | ✅ | Matches `tema` exactly. |
| **Ooples** | ❌ | Diverges significantly due to initialization logic. |
### Common Pitfalls