mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-21 20:18:05 +00:00
Merge branch 'dev'
This commit is contained in:
@@ -16,7 +16,7 @@ public class Entropy : AbstractBase
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown when the period is less than 2.
|
||||
/// </exception>
|
||||
public Entropy(int period) : base()
|
||||
public Entropy(int period)
|
||||
{
|
||||
if (period < 2)
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ public class Kurtosis : AbstractBase
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown when the period is less than 4.
|
||||
/// </exception>
|
||||
public Kurtosis(int period) : base()
|
||||
public Kurtosis(int period)
|
||||
{
|
||||
if (period < 4)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ public class Max : AbstractBase
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown when the period is less than 1 or decay is negative.
|
||||
/// </exception>
|
||||
public Max(int period, double decay = 0) : base()
|
||||
public Max(int period, double decay = 0)
|
||||
{
|
||||
if (period < 1)
|
||||
{
|
||||
@@ -105,7 +105,7 @@ public class Max : AbstractBase
|
||||
}
|
||||
|
||||
double decayRate = 1 - Math.Exp(-_halfLife * _timeSinceNewMax / Period);
|
||||
_currentMax = _currentMax - decayRate * (_currentMax - _buffer.Average());
|
||||
_currentMax -= decayRate * (_currentMax - _buffer.Average());
|
||||
_currentMax = Math.Min(_currentMax, _buffer.Max());
|
||||
|
||||
IsHot = true;
|
||||
|
||||
@@ -16,7 +16,7 @@ public class Median : AbstractBase
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown when the period is less than 1.
|
||||
/// </exception>
|
||||
public Median(int period) : base()
|
||||
public Median(int period)
|
||||
{
|
||||
if (period < 1)
|
||||
{
|
||||
@@ -76,16 +76,7 @@ public class Median : AbstractBase
|
||||
Array.Sort(sortedValues);
|
||||
int middleIndex = sortedValues.Length / 2;
|
||||
|
||||
if (sortedValues.Length % 2 == 0)
|
||||
{
|
||||
// Even number of values: average of two middle values
|
||||
median = (sortedValues[middleIndex - 1] + sortedValues[middleIndex]) / 2.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Odd number of values: middle value
|
||||
median = sortedValues[middleIndex];
|
||||
}
|
||||
median = (sortedValues.Length % 2 == 0) ? (sortedValues[middleIndex - 1] + sortedValues[middleIndex]) / 2.0 : sortedValues[middleIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -26,7 +26,11 @@ public class Min : AbstractBase
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown when period is less than 1 or decay is negative.
|
||||
/// </exception>
|
||||
<<<<<<< HEAD
|
||||
public Min(int period, double decay = 0) : base()
|
||||
=======
|
||||
public Min(int period, double decay = 0)
|
||||
>>>>>>> dev
|
||||
{
|
||||
if (period < 1)
|
||||
{
|
||||
@@ -109,7 +113,7 @@ public class Min : AbstractBase
|
||||
}
|
||||
|
||||
double decayRate = 1 - Math.Exp(-_halfLife * _timeSinceNewMin / Period);
|
||||
_currentMin = _currentMin + decayRate * (_buffer.Average() - _currentMin);
|
||||
_currentMin += decayRate * (_buffer.Average() - _currentMin);
|
||||
_currentMin = Math.Max(_currentMin, _buffer.Min());
|
||||
|
||||
IsHot = true;
|
||||
|
||||
@@ -21,7 +21,11 @@ public class Mode : AbstractBase
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown when period is less than 1.
|
||||
/// </exception>
|
||||
<<<<<<< HEAD
|
||||
public Mode(int period) : base()
|
||||
=======
|
||||
public Mode(int period)
|
||||
>>>>>>> dev
|
||||
{
|
||||
if (period < 1)
|
||||
{
|
||||
|
||||
@@ -24,7 +24,11 @@ public class Percentile : AbstractBase
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown when period is less than 2 or percent is not between 0 and 100.
|
||||
/// </exception>
|
||||
<<<<<<< HEAD
|
||||
public Percentile(int period, double percent) : base()
|
||||
=======
|
||||
public Percentile(int period, double percent)
|
||||
>>>>>>> dev
|
||||
{
|
||||
if (period < 2)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,11 @@ public class Skew : AbstractBase
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown when period is less than 3.
|
||||
/// </exception>
|
||||
<<<<<<< HEAD
|
||||
public Skew(int period) : base()
|
||||
=======
|
||||
public Skew(int period)
|
||||
>>>>>>> dev
|
||||
{
|
||||
if (period < 3)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,11 @@ public class Stddev : AbstractBase
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown when period is less than 2.
|
||||
/// </exception>
|
||||
<<<<<<< HEAD
|
||||
public Stddev(int period, bool isPopulation = false) : base()
|
||||
=======
|
||||
public Stddev(int period, bool isPopulation = false)
|
||||
>>>>>>> dev
|
||||
{
|
||||
if (period < 2)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,11 @@ public class Variance : AbstractBase
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown when period is less than 2.
|
||||
/// </exception>
|
||||
<<<<<<< HEAD
|
||||
public Variance(int period, bool isPopulation = false) : base()
|
||||
=======
|
||||
public Variance(int period, bool isPopulation = false)
|
||||
>>>>>>> dev
|
||||
{
|
||||
if (period < 2)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,11 @@ public class Zscore : AbstractBase
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown when period is less than 2.
|
||||
/// </exception>
|
||||
<<<<<<< HEAD
|
||||
public Zscore(int period) : base()
|
||||
=======
|
||||
public Zscore(int period)
|
||||
>>>>>>> dev
|
||||
{
|
||||
if (period < 2)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user