// restriction: pPFastEMA < pPSlowEMA public iMACD(int pPFastEMA, int pPSlowEMA, int pPSignalEMA) { pFastEMA = pPFastEMA; pSlowEMA = pPSlowEMA; pSignalEMA = pPSignalEMA; slowEMA = new iEMA(pSlowEMA); fastEMA = new iEMA(pFastEMA); signalEMA = new iEMA(pSignalEMA); }
public static IndicatorResults <decimal> GetCandlesEMA(List <XCandle> candles, int periodEMA) { var results = new IndicatorResults <decimal>(); var ema = new iEMA(periodEMA); foreach (var c in candles) { //var timeString = c.Timestamp.ToString("yyyy-MM-dd HH:mm:ss"); //Console.WriteLine("{0} {1} {2} o:{3} h:{4} l:{5} c:{6} vol:{7} period:{8} wavg:{9}", timeString, c.ExchangeName, c.Name, c.OpenPrice, c.HighPrice, c.LowPrice, c.ClosePrice, c.BaseVolume, c.PeriodSeconds, c.WeightedAverage); ema.ReceiveTick(c.ClosePrice); if (ema.IsPrimed) { results.Add(c, ema.Value); } } return(results); }