Exemplo n.º 1
0
        public static List <Trix> createTRIX(int N, int M, List <Price> Price)
        {
            List <Trix> TRIX = new List <Trix>();

            double[] _price = new double[Price.Count];

            for (int x = 0; x < Price.Count; x++)
            {
                _price[x] = Price[x].Close;
            }

            double[] _trix = new double[Price.Count];
            int      a, b;
            int      c, d;

            Core.Trix(0, Price.Count - 1, _price, N, out a, out b, _trix);

            double[] _trma   = new double[Price.Count];
            double[] _trix_2 = new double[Price.Count - a];



            for (int x = 0; x < Price.Count - a; x++)
            {
                //Debug.WriteLine(_trix[x]);
                _trix_2[x] = _trix[x];
            }


            //TRMA
            Core.Sma(0, Price.Count - a - 1, _trix_2, 11, out c, out d, _trma);

            for (int x = 0; x < Price.Count - c - a; x++)
            {
                Trix t = new Trix();
                t.TimeStamp   = Price[x + a + c].TimeStamp;
                t.Price_Close = Price[x + a + c].Close;
                t.TRIX        = _trix[x + c];
                t.TRMA        = _trma[x];
                TRIX.Add(t);
                //Debug.WriteLine(Price[x+a+c].TimeStamp + "  TRIX : "+  _trix[x+c] + "  TRMA : " + _trma[x]);
            }


            return(TRIX);
        }
		public static List<Trix> createTRIX(int N, int M, List<Price> Price)
		{
			List<Trix> TRIX = new List<Trix>();

			double[] _price = new double[Price.Count];

			for (int x = 0; x < Price.Count; x++)
			{
				_price[x] = Price[x].Close;

			}

			double[] _trix = new double[Price.Count];
			int a, b;
			int c, d;

			Core.Trix(0, Price.Count - 1, _price, N, out a, out b, _trix);

			double[] _trma = new double[Price.Count];
			double[] _trix_2 = new double[Price.Count - a];




			for (int x = 0; x < Price.Count - a; x++)
			{
				//Debug.WriteLine(_trix[x]);
				_trix_2[x] = _trix[x];
			}


			//TRMA
			Core.Sma(0, Price.Count - a - 1, _trix_2, 11, out c, out d, _trma);

			for (int x = 0; x < Price.Count - c - a; x++)
			{
				Trix t = new Trix();
				t.TimeStamp = Price[x + a + c].TimeStamp;
				t.Price_Close = Price[x + a + c].Close;
				t.TRIX = _trix[x + c];
				t.TRMA = _trma[x];
				TRIX.Add(t);
				//Debug.WriteLine(Price[x+a+c].TimeStamp + "  TRIX : "+  _trix[x+c] + "  TRMA : " + _trma[x]);
			}


			return TRIX;
		}