Esempio n. 1
0
        public SignalAndValue Process(Candle candle)
        {
            if (candle.IsComplete == 1)
            {
                HighBuffer.Add(candle.HighBid);
                LowBuffer.Add(candle.LowBid);

                if (HighBuffer.Count > _length)
                {
                    HighBuffer.RemoveAt(0);
                    LowBuffer.RemoveAt(0);
                }

                return(new SignalAndValue((float)(HighBuffer.Max() - LowBuffer.Min()), IsFormed));
            }

            var highBuffer = HighBuffer.ToList();
            var lowBuffer  = LowBuffer.ToList();

            highBuffer.Add(candle.HighBid);
            lowBuffer.Add(candle.LowBid);

            if (highBuffer.Count > _length)
            {
                highBuffer.RemoveAt(0);
                lowBuffer.RemoveAt(0);
            }

            return(new SignalAndValue((float)(highBuffer.Max() - lowBuffer.Min()), IsFormed));
        }
Esempio n. 2
0
 public void Reset()
 {
     HighBuffer.Clear();
     LowBuffer.Clear();
 }