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
+2
View File
@@ -51,7 +51,9 @@ public sealed class TrimaIndicator : Indicator, IWatchlistIndicator
protected override void OnUpdate(UpdateArgs args)
{
if (args.Reason != UpdateReason.NewBar && args.Reason != UpdateReason.HistoricalBar && args.Reason != UpdateReason.NewTick)
{
return;
}
var item = HistoricalData[Count - 1, SeekOriginHistory.Begin];
TValue result = _ma.Update(new TValue(item.TimeLeft.Ticks, _priceSelector(item)), args.IsNewBar());
+14 -3
View File
@@ -34,7 +34,10 @@ public sealed class Trima : AbstractBase
public Trima(int period)
{
if (period <= 0) throw new ArgumentException("Period must be greater than 0", nameof(period));
if (period <= 0)
{
throw new ArgumentException("Period must be greater than 0", nameof(period));
}
_period = period;
int p1 = (period + 1) / 2;
@@ -81,7 +84,10 @@ public sealed class Trima : AbstractBase
public override TSeries Update(TSeries source)
{
if (source.Count == 0) return [];
if (source.Count == 0)
{
return [];
}
int len = source.Count;
var t = new List<long>(len);
@@ -143,9 +149,14 @@ public sealed class Trima : AbstractBase
public static void Batch(ReadOnlySpan<double> source, Span<double> output, int period)
{
if (source.Length != output.Length)
{
throw new ArgumentException("Source and output must have the same length", nameof(output));
}
if (period <= 0)
{
throw new ArgumentException("Period must be greater than 0", nameof(period));
}
int p1 = (period + 1) / 2;
int p2 = period / 2 + 1;
@@ -163,4 +174,4 @@ public sealed class Trima : AbstractBase
ArrayPool<double>.Shared.Return(tempArray);
}
}
}
}