public static List<SMA> createSMA(int N, List<VariableIndicator> Value) { List<SMA> sma = new List<SMA>(); double[] _price = new double[Value.Count]; for (int x = 0; x < Value.Count; x++) _price[x] = Value[x].Value; double[] _sma = new double[Value.Count]; int a, b; Core.Sma(0, Value.Count - 1, _price, N, out a, out b, _sma); for (int x = 0; x < Value.Count - a; x++) { SMA e = new SMA { TimeStamp = Value[x + a].TimeStamp, CustomValue = Value[x + a].Value, Sma = _sma[x], }; sma.Add(e); } return sma; }
public static List<SMA> createSMA(int N, List<Price> Price) { List<SMA> sma = new List<SMA>(); double[] _price = new double[Price.Count]; for (int x = 0; x < Price.Count; x++) _price[x] = Price[x].Close; double[] _sma = new double[Price.Count]; int a, b; Core.Sma(0, Price.Count - 1, _price, N, out a, out b, _sma); for (int x = 0; x < Price.Count - a; x++) { SMA e = new SMA { TimeStamp = Price[x + a].TimeStamp, Price_Close = Price[x + a].Close, Price_High = Price[x + a].High, Price_Low = Price[x + a].Low, Price_Open = Price[x + a].Open, Sma = _sma[x], }; sma.Add(e); } return sma; }