style: format code with dotnet-format

This commit fixes the style issues introduced in 931bbdb according to the output
from dotnet-format.

Details: https://github.com/mihakralj/QuanTAlib/pull/30
This commit is contained in:
deepsource-autofix[bot]
2024-10-08 17:31:29 +00:00
committed by GitHub
parent 931bbdb6a0
commit 85b9d9217a
8 changed files with 142 additions and 127 deletions
+5 -2
View File
@@ -40,7 +40,9 @@ public class Mgdi : AbstractBase
{
_p_prevMd = _prevMd;
_index++;
} else {
}
else
{
_prevMd = _p_prevMd;
}
}
@@ -50,7 +52,8 @@ public class Mgdi : AbstractBase
ManageState(Input.IsNew);
double value = Input.Value;
if (_index < 2){
if (_index < 2)
{
_prevMd = value;
}
else
+3 -3
View File
@@ -6,9 +6,9 @@ public class Qema : AbstractBase
private readonly Ema _ema1, _ema2, _ema3, _ema4;
private double _lastQema, _p_lastQema;
public Qema(double k1=0.2, double k2=0.2, double k3=0.2, double k4=0.2)
public Qema(double k1 = 0.2, double k2 = 0.2, double k3 = 0.2, double k4 = 0.2)
{
if (k1 <= 0 || k2 <= 0 || k3 <= 0 || k4 <= 0 )
if (k1 <= 0 || k2 <= 0 || k3 <= 0 || k4 <= 0)
{
throw new ArgumentOutOfRangeException("All k values must be in the range (0, 1].");
}
@@ -26,7 +26,7 @@ public class Qema : AbstractBase
Name = $"QEMA ({k1:F2},{k2:F2},{k3:F2},{k4:F2})";
double smK = Math.Min(Math.Min(_k1, _k2), Math.Min(_k3, _k4));
WarmupPeriod = (int) ((2 - smK) / smK);
WarmupPeriod = (int)((2 - smK) / smK);
Init();
}
+14 -14
View File
@@ -22,23 +22,23 @@ public class Rma : AbstractBase
_alpha = 1.0 / _period; // Wilder's smoothing factor
Name = $"Rma({_period})";
Init();
}
}
public Rma(object source, int period) : this(period)
{
public Rma(object source, int period) : this(period)
{
var pubEvent = source.GetType().GetEvent("Pub");
pubEvent?.AddEventHandler(source, new ValueSignal(Sub));
}
}
public override void Init()
{
public override void Init()
{
base.Init();
_lastRMA = 0;
_savedLastRMA = 0;
}
}
protected override void ManageState(bool isNew)
{
protected override void ManageState(bool isNew)
{
if (!isNew)
{
_lastRMA = _savedLastRMA;
@@ -48,10 +48,10 @@ public class Rma : AbstractBase
_savedLastRMA = _lastRMA;
_lastValidValue = Input.Value;
_index++;
}
}
protected override double Calculation()
{
protected override double Calculation()
{
ManageState(Input.IsNew);
double rma;
@@ -69,9 +69,9 @@ public class Rma : AbstractBase
// Wilder's smoothing method
return _alpha * (Input.Value - _lastRMA) + _lastRMA;
}
}
_lastRMA = rma;
_lastRMA = rma;
IsHot = _index >= WarmupPeriod;
return rma;