mirror of
https://github.com/mihakralj/QuanTAlib.git
synced 2026-08-09 06:27:45 +00:00
refactor: Update list initialization in DEMA, EMA, SMA, T3, TEMA, TRIMA, and WMA classes for improved readability
This commit is contained in:
@@ -123,8 +123,8 @@ public sealed class Dema : ITValuePublisher
|
||||
if (source.Count == 0) return new TSeries();
|
||||
|
||||
int len = source.Count;
|
||||
var t = new List<long>(len);
|
||||
var v = new List<double>(len);
|
||||
List<long> t = new(len);
|
||||
List<double> v = new(len);
|
||||
CollectionsMarshal.SetCount(t, len);
|
||||
CollectionsMarshal.SetCount(v, len);
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ public sealed class Ema : ITValuePublisher
|
||||
|
||||
public TSeries Update(TSeries source)
|
||||
{
|
||||
if (source.Count == 0) return new TSeries();
|
||||
if (source.Count == 0) return [];
|
||||
|
||||
int len = source.Count;
|
||||
var t = new List<long>(len);
|
||||
|
||||
@@ -137,7 +137,7 @@ public sealed class Sma : ITValuePublisher
|
||||
|
||||
public TSeries Update(TSeries source)
|
||||
{
|
||||
if (source.Count == 0) return new TSeries();
|
||||
if (source.Count == 0) return [];
|
||||
|
||||
int len = source.Count;
|
||||
var t = new List<long>(len);
|
||||
|
||||
+1
-1
@@ -172,7 +172,7 @@ public sealed class T3 : ITValuePublisher
|
||||
|
||||
public TSeries Update(TSeries source)
|
||||
{
|
||||
if (source.Count == 0) return new TSeries();
|
||||
if (source.Count == 0) return [];
|
||||
|
||||
int len = source.Count;
|
||||
var t = new List<long>(len);
|
||||
|
||||
@@ -132,8 +132,8 @@ public sealed class Tema : ITValuePublisher
|
||||
if (source.Count == 0) return new TSeries();
|
||||
|
||||
int len = source.Count;
|
||||
var t = new List<long>(len);
|
||||
var v = new List<double>(len);
|
||||
List<long> t = new(len);
|
||||
List<double> v = new(len);
|
||||
CollectionsMarshal.SetCount(t, len);
|
||||
CollectionsMarshal.SetCount(v, len);
|
||||
|
||||
|
||||
@@ -144,8 +144,8 @@ public sealed class Trima : ITValuePublisher
|
||||
if (source.Count == 0) return new TSeries();
|
||||
|
||||
int len = source.Count;
|
||||
var t = new List<long>(len);
|
||||
var v = new List<double>(len);
|
||||
List<long> t = new(len);
|
||||
List<double> v = new(len);
|
||||
CollectionsMarshal.SetCount(t, len);
|
||||
CollectionsMarshal.SetCount(v, len);
|
||||
|
||||
|
||||
@@ -144,8 +144,8 @@ public sealed class Wma : ITValuePublisher
|
||||
if (source.Count == 0) return new TSeries();
|
||||
|
||||
int len = source.Count;
|
||||
var t = new List<long>(len);
|
||||
var v = new List<double>(len);
|
||||
List<long> t = new(len);
|
||||
List<double> v = new(len);
|
||||
CollectionsMarshal.SetCount(t, len);
|
||||
CollectionsMarshal.SetCount(v, len);
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using QuanTAlib;
|
||||
|
||||
public class Test
|
||||
{
|
||||
public TSeries Create()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user