mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-24 13:38:05 +00:00
feat(validation): add input validation for Bilateral and Blma constructors; enhance Butter and Mgdi calculations with NaN handling
This commit is contained in:
@@ -118,15 +118,25 @@ public sealed class Ema : AbstractBase
|
||||
int i = 0;
|
||||
|
||||
// Find first valid value to seed lastValid
|
||||
bool foundValid = false;
|
||||
for (int k = 0; k < len; k++)
|
||||
{
|
||||
if (double.IsFinite(source[k]))
|
||||
{
|
||||
_lastValidValue = source[k];
|
||||
foundValid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundValid)
|
||||
{
|
||||
Last = new TValue(DateTime.MinValue, double.NaN);
|
||||
_p_state = _state;
|
||||
_p_lastValidValue = _lastValidValue;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!_state.IsCompensated)
|
||||
{
|
||||
for (; i < len && _state.E > COMPENSATOR_THRESHOLD; i++)
|
||||
|
||||
Reference in New Issue
Block a user