mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-18 02:28:05 +00:00
style patterns
This commit is contained in:
@@ -40,7 +40,10 @@ public class ExptransIndicator : Indicator, IWatchlistIndicator
|
||||
|
||||
protected override void OnUpdate(UpdateArgs args)
|
||||
{
|
||||
if (_exptrans == null || _selector == null) return;
|
||||
if (_exptrans == null || _selector == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var item = HistoricalData[0, SeekOriginHistory.End];
|
||||
double value = _selector(item);
|
||||
@@ -53,4 +56,4 @@ public class ExptransIndicator : Indicator, IWatchlistIndicator
|
||||
|
||||
LinesSeries[0].SetValue(_exptrans.Last.Value, isHot, ShowColdValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,4 +274,4 @@ public class ExptransTests
|
||||
Assert.True(indicator.Last.Value > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,4 +170,4 @@ public class ExptransValidationTests
|
||||
|
||||
Assert.Equal(Math.Pow(expA, n), expNA, 1e-12);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,9 +46,13 @@ public sealed class Exptrans : AbstractBase
|
||||
public override TValue Update(TValue input, bool isNew = true)
|
||||
{
|
||||
if (isNew)
|
||||
{
|
||||
_p_state = _state;
|
||||
}
|
||||
else
|
||||
{
|
||||
_state = _p_state;
|
||||
}
|
||||
|
||||
double value = input.Value;
|
||||
double result;
|
||||
@@ -114,9 +118,14 @@ public sealed class Exptrans : AbstractBase
|
||||
public static void Calculate(ReadOnlySpan<double> source, Span<double> output)
|
||||
{
|
||||
if (source.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("Source cannot be empty", nameof(source));
|
||||
}
|
||||
|
||||
if (output.Length < source.Length)
|
||||
{
|
||||
throw new ArgumentException("Output length must be >= source length", nameof(output));
|
||||
}
|
||||
|
||||
double lastValid = 1.0; // exp(0) = 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user