private void BuildHekinAshiCandle() { if (Candles.Count == 0) { return; } var candle = Candles.Last(); var heikinAshi = new Candle(); if (HeikinAshi.Count == 0) { heikinAshi.Open = (candle.Open + candle.Close) / 2; heikinAshi.Close = (candle.Open + candle.Close + candle.High + candle.Low) / 4.0m; heikinAshi.High = candle.High; heikinAshi.Low = candle.Low; } else { var lastHeikinAshi = HeikinAshi.Last(); heikinAshi.Open = (lastHeikinAshi.Open + lastHeikinAshi.Close) / 2; heikinAshi.Close = (candle.Open + candle.Close + candle.High + candle.Low) / 4.0m; heikinAshi.High = Math.Max(Math.Max(heikinAshi.Open, heikinAshi.Close), candle.High); heikinAshi.Low = Math.Min(Math.Min(heikinAshi.Open, heikinAshi.Close), candle.Low); } ulong netVolume = candle.Volume; if (HeikinAshi.Count > 2) { netVolume = candle.Volume - HeikinAshi.ElementAt(HeikinAshi.Count - 2).Volume; } heikinAshi.CandleVolume = netVolume; heikinAshi.Volume = candle.Volume; heikinAshi.TimeStamp = candle.TimeStamp; heikinAshi.Index = (uint)HeikinAshi.Count; this.heikinAshi.Add(heikinAshi); }