예제 #1
0
        /// <summary>
        /// Adaptive Moving Average
        /// </summary>
        /// <param name="FastLimit">defualt = 0.5</param>
        /// <param name="SlowLimit">defualt=0.05</param>
        /// <param name="Var"></param>
        /// <returns></returns>
        public static List <MAMA> createAdaptiveMA_MAMA(double FastLimit, double SlowLimit, List <Price> Price)
        {
            List <MAMA> mama = new List <MAMA>();

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

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

            double[] _mama = new double[Price.Count];
            double[] _fama = new double[Price.Count];
            int      a, b;

            Core.Mama(0, Price.Count - 1, _price, FastLimit, SlowLimit, out a, out b, _mama, _fama);

            for (int x = 0; x < Price.Count - a; x++)
            {
                MAMA e = new MAMA
                {
                    TimeStamp   = Price[x + a].TimeStamp,
                    Price_Close = Price[x + a].Close,
                    Price_High  = Price[x + a].High,
                    Price_Low   = Price[x + a].Low,
                    Price_Open  = Price[x + a].Open,
                    Mama        = _mama[x],
                    Fama        = _fama[x],
                };
                mama.Add(e);
            }

            return(mama);
        }
예제 #2
0
        /// <summary>
        /// Adaptive Moving Average
        /// </summary>
        /// <param name="FastLimit">MAMA defualt = 0.05</param>
        /// <param name="SlowLimit">FAMA(Following Adaptive Moving Average) defualt=0.5</param>
        /// <param name="Var"></param>
        /// <returns></returns>
        public static List <MAMA> createAdaptiveMA_MAMA(double FastLimit, double SlowLimit, List <VariableIndicator> Var)
        {
            List <MAMA> mama = new List <MAMA>();

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

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

            double[] _mama = new double[Var.Count];
            double[] _fama = new double[Var.Count];
            int      a, b;

            Core.Mama(0, Var.Count - 1, _price, FastLimit, SlowLimit, out a, out b, _mama, _fama);

            for (int x = 0; x < Var.Count - a; x++)
            {
                MAMA e = new MAMA
                {
                    TimeStamp   = Var[x + a].TimeStamp,
                    Price_Close = Var[x + a].Price_Close,
                    Price_High  = Var[x + a].Price_High,
                    Price_Low   = Var[x + a].Price_Low,
                    Price_Open  = Var[x + a].Price_Open,
                    Mama        = _mama[x],
                    Fama        = _fama[x],
                };
                mama.Add(e);
            }

            return(mama);
        }
		/// <summary>
		/// Adaptive Moving Average
		/// </summary>
		/// <param name="FastLimit">defualt = 0.5</param>
		/// <param name="SlowLimit">defualt=0.05</param>
		/// <param name="Var"></param>
		/// <returns></returns>
		public static List<MAMA> createAdaptiveMA_MAMA(double FastLimit, double SlowLimit, List<Price> Price)
		{
			List<MAMA> mama = new List<MAMA>();

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

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

			double[] _mama = new double[Price.Count];
			double[] _fama = new double[Price.Count];
			int a, b;

			Core.Mama(0, Price.Count - 1, _price, FastLimit, SlowLimit, out a, out b, _mama, _fama);

			for (int x = 0; x < Price.Count - a; x++)
			{
				MAMA e = new MAMA
				{
					TimeStamp = Price[x + a].TimeStamp,
					Price_Close = Price[x + a].Close,
					Price_High = Price[x + a].High,
					Price_Low = Price[x + a].Low,
					Price_Open = Price[x + a].Open,
					Mama = _mama[x],
					Fama = _fama[x],

				};
				mama.Add(e);
			}

			return mama;
		}
		/// <summary>
		/// Adaptive Moving Average
		/// </summary>
		/// <param name="FastLimit">MAMA defualt = 0.05</param>
		/// <param name="SlowLimit">FAMA(Following Adaptive Moving Average) defualt=0.5</param>
		/// <param name="Var"></param>
		/// <returns></returns>
		public static List<MAMA> createAdaptiveMA_MAMA(double FastLimit, double SlowLimit, List<VariableIndicator> Var)
		{
			List<MAMA> mama = new List<MAMA>();

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

			for (int x = 0; x < Var.Count; x++) _price[x] = Var[x].Value;

			double[] _mama = new double[Var.Count];
			double[] _fama = new double[Var.Count];
			int a, b;

			Core.Mama(0, Var.Count - 1, _price, FastLimit, SlowLimit, out a, out b, _mama, _fama);

			for (int x = 0; x < Var.Count - a; x++)
			{
				MAMA e = new MAMA
				{
					TimeStamp = Var[x + a].TimeStamp,
					Price_Close = Var[x + a].Price_Close,
					Price_High = Var[x + a].Price_High,
					Price_Low = Var[x + a].Price_Low,
					Price_Open = Var[x + a].Price_Open,
					Mama = _mama[x],
					Fama = _fama[x],

				};
				mama.Add(e);
			}

			return mama;
		}