public static List<EMA> createEMA(int N, List<VariableIndicator> Value) { List<EMA> ema = new List<EMA>(); double[] _price = new double[Value.Count]; for (int x = 0; x < Value.Count; x++) _price[x] = Value[x].Value; double[] _ema = new double[Value.Count]; int a, b; Core.Ema(0, Value.Count - 1, _price, N, out a, out b, _ema); for (int x = 0; x < Value.Count - a; x++) { EMA e = new EMA { TimeStamp = Value[x + a].TimeStamp, CustomValue = Value[x + a].Value, Ema = _ema[x], }; ema.Add(e); } return ema; }
public static List<EMA> createEMA(int N, List<double> Value) { List<EMA> ema = new List<EMA>(); double[] _price = new double[Value.Count]; for (int x = 0; x < Value.Count; x++) _price[x] = Value[x]; double[] _ema = new double[Value.Count]; int a, b; Core.Ema(0, Value.Count - 1, _price, N, out a, out b, _ema); for (int x = 0; x < Value.Count - a; x++) { EMA e = new EMA { CustomValue = Value[x + a], Ema = _ema[x], }; ema.Add(e); } return ema; }
public static List<EMA> createDEMA(int N, List<Price> Price) { List<EMA> dema = new List<EMA>(); double[] _price = new double[Price.Count]; for (int x = 0; x < Price.Count; x++) _price[x] = Price[x].Close; double[] _ema = new double[Price.Count]; int a, b; Core.Dema(0, Price.Count - 1, _price, N, out a, out b, _ema); for (int x = 0; x < Price.Count - a; x++) { EMA e = new EMA { 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, Ema = _ema[x], }; dema.Add(e); } return dema; }