Esempio n. 1
0
        public override void OnProcess(List <Candle> candles, int index)
        {
            if (index == 0 && _values
                != null &&
                MasTrend != null)
            {
                _values.Clear();

                MasTrend.Clear();

                if (MasHp != null)
                {
                    MasHp.Clear();
                }

                if (MasLp != null)
                {
                    MasLp.Clear();
                }

                if (MasAf != null)
                {
                    MasAf.Clear();
                }

                if (psar != null)
                {
                    psar.Clear();
                }
            }

            Process(candles);

            _series.Values[index] = _values[index];
        }
Esempio n. 2
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]);
        }
Esempio n. 3
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]);
        }