validation and profiles

This commit is contained in:
Miha Kralj
2026-02-26 22:02:52 -08:00
parent 9ab37c1200
commit 8a1ba95173
317 changed files with 18704 additions and 622 deletions
@@ -1,5 +1,7 @@
using System;
using System.Collections.Generic;
using OoplesFinance.StockIndicators;
using OoplesFinance.StockIndicators.Models;
using Skender.Stock.Indicators;
using Xunit;
using Xunit.Abstractions;
@@ -657,4 +659,24 @@ public sealed class IchimokuValidationTests : IDisposable
}
#endregion
#region Ooples Cross-Validation
[Fact]
public void Ichimoku_MatchesOoples_Structural()
{
// CalculateIchimokuCloud — structural test; outputs stored in OutputValues (Tenkan/Kijun/etc.)
var ooplesData = _testData.SkenderQuotes
.Select(q => new TickerData { Date = q.Date, Open = (double)q.Open, High = (double)q.High, Low = (double)q.Low, Close = (double)q.Close, Volume = (double)q.Volume })
.ToList();
var result = new StockData(ooplesData).CalculateIchimokuCloud();
// Ooples multi-output indicators store results in OutputValues, not CustomValuesList
var allValues = result.OutputValues.Values.SelectMany(v => v).ToList();
int finiteCount = allValues.Count(v => double.IsFinite(v));
Assert.True(finiteCount > 100, $"Expected >100 finite Ooples Ichimoku values, got {finiteCount}");
}
#endregion
}
+40 -1
View File
@@ -1,4 +1,4 @@
# ICHIMOKU: Ichimoku Kinko Hyo
# ICHIMOKU: Ichimoku Kinko Hyo
Ichimoku Kinko Hyo ("One Glance Equilibrium Chart") is a comprehensive trend-following system that provides five distinct components revealing trend direction, momentum, support/resistance levels, and potential future price zones simultaneously. The Tenkan-sen and Kijun-sen are midpoints of high-low ranges at different timescales (not moving averages of closes). Senkou Span A and B form the "cloud" (Kumo) — a projected equilibrium zone displaced forward in time. Chikou Span is simply the current close displaced backward. All components use sliding window min/max arithmetic, producing step-function behavior on breakouts rather than the smooth curves of EMA-based systems. The system requires OHLC bar input.
@@ -124,6 +124,45 @@ Senkou Span A and B are computed at the current bar but displayed shifted forwar
The indicator produces five simultaneous values per bar. The primary output (`Last`) returns Kijun-sen as the default reference line.
## Performance Profile
### Operation Count (Streaming Mode)
Ichimoku draws five lines from three sliding window min/max operations and two EMA values for the Cloud. Three RingBuffers track highs/lows for Tenkan (9), Kijun (26), and Senkou B (52).
**Post-warmup steady state (per bar):**
| Operation | Count | Cost (cycles) | Subtotal |
| :--- | :---: | :---: | :---: |
| RingBuffer updates × 3 (T/K/S highs+lows) | 6 | 1 | 6 |
| Window max/min scans × 3 pairs (amortized O(1) with deques) | 6 | 1 | 6 |
| ADD + MUL×0.5 × 3 (midpoints for T, K, SB) | 6 | 3 | 18 |
| ADD + MUL×0.5 (Senkou A = (T+K)/2) | 2 | 3 | 6 |
| ADD + MUL×0.5 (Chikou = close[26]) | 2 | 1 | 2 |
| Buffer shift reads × 2 (Senkou A/B lag 26) | 2 | 1 | 2 |
| **Total** | **24** | — | **~40 cycles** |
Five output lines, three window scans, two lag buffers. For default periods (9/26/52): ~40 cycles per bar at steady state.
### Batch Mode (SIMD Analysis)
| Operation | Vectorizable? | Notes |
| :--- | :---: | :--- |
| Sliding max/min (3 windows) | Partial | Lemire deque O(n) total; scan phase SIMD-friendly |
| Midpoint arithmetic | Yes | VADDPD + VMULPD (×0.5) |
| Lag buffer reads | Yes | Array offset memory access |
Three independent window extremum computations can be parallelized. The midpoint and lag arithmetic is trivially vectorizable.
### Quality Metrics
| Metric | Score | Notes |
| :--- | :---: | :--- |
| **Accuracy** | 10/10 | Exact integer-position midpoints; no floating-point drift |
| **Timeliness** | 3/10 | Senkou B requires 52-bar window + 26-bar projection = 78 bars to stability |
| **Smoothness** | 7/10 | Midpoint lines are inherently smooth; Cloud edges can gap |
| **Noise Rejection** | 7/10 | Window midpoints average out bar-to-bar noise by construction |
## Resources
- Hosoda, G. — *Ichimoku Kinko Hyo* (7-volume series, Tokyo, 1969)