mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-25 22:08:05 +00:00
feat(rsi, alma, bilateral, blma, butter, ema, htit, kama, lsma, pwma, rma, trima, vidya, wma): enhance calculations with NaN handling and edge case management; improve performance and stability across multiple classes
This commit is contained in:
+11
-2
@@ -104,6 +104,12 @@ public sealed class Alma : AbstractBase, IDisposable
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public override TValue Update(TValue input, bool isNew = true)
|
||||
{
|
||||
return Update(input, isNew, true);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private TValue Update(TValue input, bool isNew, bool publish)
|
||||
{
|
||||
if (isNew)
|
||||
{
|
||||
@@ -129,7 +135,10 @@ public sealed class Alma : AbstractBase, IDisposable
|
||||
}
|
||||
|
||||
Last = new TValue(input.Time, result);
|
||||
PubEvent(Last);
|
||||
if (publish)
|
||||
{
|
||||
PubEvent(Last);
|
||||
}
|
||||
return Last;
|
||||
}
|
||||
|
||||
@@ -157,7 +166,7 @@ public sealed class Alma : AbstractBase, IDisposable
|
||||
int startIndex = Math.Max(0, len - _period);
|
||||
for (int i = startIndex; i < len; i++)
|
||||
{
|
||||
Update(source[i]);
|
||||
Update(source[i], true, false);
|
||||
}
|
||||
|
||||
return new TSeries(t, v);
|
||||
|
||||
Reference in New Issue
Block a user