Example #1
0
        public void ReceiveTick(decimal Val)
        {
            slowEMA.ReceiveTick(Val);
            fastEMA.ReceiveTick(Val);

            if (slowEMA.IsPrimed && fastEMA.IsPrimed)
            {
                signalEMA.ReceiveTick(fastEMA.Value - slowEMA.Value);
            }
        }
Example #2
0
        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);
        }