style patterns

This commit is contained in:
Miha Kralj
2026-01-25 16:01:45 -08:00
parent 2836f253c4
commit e59665c8f0
399 changed files with 6892 additions and 1323 deletions
+1 -1
View File
@@ -181,4 +181,4 @@ public class AtrnIndicatorTests
Assert.Contains("github.com", indicator.SourceCodeLink, StringComparison.Ordinal);
Assert.Contains("Atrn.Quantower.cs", indicator.SourceCodeLink, StringComparison.Ordinal);
}
}
}
+1 -1
View File
@@ -48,4 +48,4 @@ public sealed class AtrnIndicator : Indicator, IWatchlistIndicator
_series.SetValue(result.Value, _atrn.IsHot, ShowColdValues);
}
}
}
+10 -3
View File
@@ -123,8 +123,15 @@ public sealed class AtrnValidationTests : IDisposable
for (int j = startIdx; j < atrValues.Count; j++)
{
if (atrValues[j] < minAtr) minAtr = atrValues[j];
if (atrValues[j] > maxAtr) maxAtr = atrValues[j];
if (atrValues[j] < minAtr)
{
minAtr = atrValues[j];
}
if (atrValues[j] > maxAtr)
{
maxAtr = atrValues[j];
}
}
double currentAtr = atrValues[^1];
@@ -336,4 +343,4 @@ public sealed class AtrnValidationTests : IDisposable
}
#endregion
}
}
+26 -6
View File
@@ -43,7 +43,9 @@ public sealed class Atrn : AbstractBase
public Atrn(int period)
{
if (period <= 0)
{
throw new ArgumentException("Period must be greater than 0", nameof(period));
}
_lookbackWindow = 10 * period;
_rma = new Rma(period);
@@ -239,7 +241,10 @@ public sealed class Atrn : AbstractBase
/// </summary>
public TSeries Update(TBarSeries source)
{
if (source.Count == 0) return [];
if (source.Count == 0)
{
return [];
}
var t = new List<long>(source.Count);
var v = new List<double>(source.Count);
@@ -259,7 +264,10 @@ public sealed class Atrn : AbstractBase
/// </summary>
public override TSeries Update(TSeries source)
{
if (source.Count == 0) return [];
if (source.Count == 0)
{
return [];
}
var t = new List<long>(source.Count);
var v = new List<double>(source.Count);
@@ -287,12 +295,18 @@ public sealed class Atrn : AbstractBase
private double GetMax()
{
ReadOnlySpan<double> span = _atrBuffer.GetSpan();
if (span.IsEmpty) return 0;
if (span.IsEmpty)
{
return 0;
}
double max = double.MinValue;
for (int i = 0; i < span.Length; i++)
{
if (span[i] > max) max = span[i];
if (span[i] > max)
{
max = span[i];
}
}
return max;
}
@@ -301,12 +315,18 @@ public sealed class Atrn : AbstractBase
private double GetMin()
{
ReadOnlySpan<double> span = _atrBuffer.GetSpan();
if (span.IsEmpty) return 0;
if (span.IsEmpty)
{
return 0;
}
double min = double.MaxValue;
for (int i = 0; i < span.Length; i++)
{
if (span[i] < min) min = span[i];
if (span[i] < min)
{
min = span[i];
}
}
return min;
}