示例#1
0
        /// <summary>
        /// load only last candle
        /// прогрузить только последнюю свечку
        /// </summary>
        private void ProcessOne(List <Candle> candles)
        {
            if (candles == null)
            {
                return;
            }

            if (MasTrend == null)
            {
                MasTrend = new List <decimal>();
            }
            if (MasHp == null)
            {
                MasHp = new List <decimal>();
            }
            if (MasLp == null)
            {
                MasLp = new List <decimal>();
            }
            if (MasAf == null)
            {
                MasAf = new List <decimal>();
            }
            if (psar == null)
            {
                psar = new List <decimal>();
            }

            if (Values == null)
            {
                Values = new List <decimal>();
            }

            decimal[] dop = new decimal[6];
            if (Values.Count == 0)
            {
                dop = GetValueParabolicSar(candles, candles.Count - 1, 0, 0, 0, 0, 0, 0);
            }
            else
            {
                dop = GetValueParabolicSar(candles, candles.Count - 1, 0, Values[Values.Count - 1], MasTrend[MasTrend.Count - 1],
                                           MasHp[MasHp.Count - 1], MasLp[MasLp.Count - 1], MasAf[MasAf.Count - 1]);
            }

            Values.Add(dop[0]);
            MasTrend.Add(dop[1]);
            MasHp.Add(dop[2]);
            MasLp.Add(dop[3]);
            MasAf.Add(dop[4]);
        }
示例#2
0
        private void ProcessOne(List <Candle> candles)
        {
            if (candles == null)
            {
                return;
            }

            if (MasTrend == null)
            {
                MasTrend = new List <decimal>();
            }
            if (MasHp == null)
            {
                MasHp = new List <decimal>();
            }
            if (MasLp == null)
            {
                MasLp = new List <decimal>();
            }
            if (MasAf == null)
            {
                MasAf = new List <decimal>();
            }
            if (psar == null)
            {
                psar = new List <decimal>();
            }

            if (_values == null)
            {
                _values = new List <decimal>();
            }
            if (_valuesUp == null)
            {
                _valuesUp = new List <decimal>();
            }
            if (_valuesDown == null)
            {
                _valuesDown = new List <decimal>();
            }

            decimal[] dop = new decimal[6];
            if (_values.Count == 0)
            {
                dop = GetValueParabolicSar(candles, candles.Count - 1, 0, 0, 0, 0, 0, 0);
            }
            else
            {
                dop = GetValueParabolicSar(candles, candles.Count - 1, 0, _values[_values.Count - 1], MasTrend[MasTrend.Count - 1],
                                           MasHp[MasHp.Count - 1], MasLp[MasLp.Count - 1], MasAf[MasAf.Count - 1]);
            }

            if (dop[0] > candles[candles.Count - 1].High)
            {
                _valuesDown.Add(dop[0]);
                _valuesUp.Add(0);
            }
            else if (dop[0] < candles[candles.Count - 1].Low)
            {
                _valuesUp.Add(dop[0]);
                _valuesDown.Add(0);
            }
            else
            {
                _valuesUp.Add(0);
                _valuesDown.Add(0);
            }


            _values.Add(dop[0]);
            MasTrend.Add(dop[1]);
            MasHp.Add(dop[2]);
            MasLp.Add(dop[3]);
            MasAf.Add(dop[4]);
        }