Exemplo n.º 1
0
        private List <decimal> FillDataPerMethod()
        {
            var ARIMA          = CreateIndicator();
            var realValues     = new List <decimal>();
            var testValues     = new List <decimal[]>();
            var betweenMethods = new List <decimal>();
            var data           = TestHelper.GetCsvFileStream(TestFileName);

            foreach (var val in data)
            {
                if (val["Close"] != string.Empty)
                {
                    var close = val["Close"];
                    realValues.Add(decimal.Parse(val["Close"], new NumberFormatInfo()));
                    ARIMA.Update(new IndicatorDataPoint(Convert.ToDateTime(val["Date"], new DateTimeFormatInfo()),
                                                        Convert.ToDecimal(close, new NumberFormatInfo())));
                }

                if (val[TestColumnName] != string.Empty)
                {
                    var fromTest = decimal.Parse(val[TestColumnName], new NumberFormatInfo());
                    testValues.Add(new[] { ARIMA.Current.Value, fromTest });
                }
            }

            _ssIndicator = 0d;
            _ssTest      = 0d;
            for (var i = 51; i < realValues.Count; i++)
            {
                var test   = realValues[i];
                var arimas = testValues[i - 50];
                _ssIndicator += Math.Pow((double)(arimas[0] - test), 2);
                _ssTest      += Math.Pow((double)(arimas[1] - test), 2);
                betweenMethods.Add(Math.Abs(arimas[0] - arimas[1]));
            }

            return(betweenMethods);
        }