Exemplo n.º 1
0
		public LRS(ISeries input, int length, BarData barData = BarData.Close, RegressionDistanceMode distanceMode = RegressionDistanceMode.Time) : base(input)
		{
			this.length = length;
			this.barData = barData;
			this.distanceMode = distanceMode;
			this.Init();
		}
Exemplo n.º 2
0
 // TODO: rewrite
 public static double Value(ISeries input, int index, int length, BarData barData = BarData.Close, RegressionDistanceMode distanceMode = RegressionDistanceMode.Time)
 {
     if (index >= length - 1)
     {
         double num = 0.0;
         double num2 = 0.0;
         double num3 = 0.0;
         double num4 = 0.0;
         if (distanceMode == RegressionDistanceMode.Time)
         {
             double num5 = input.GetDateTime(index).Subtract(input.GetDateTime(index - 1)).Ticks;
             for (int i = index; i > index - length; i--)
             {
                 num += input.GetDateTime(i).Subtract(input.GetDateTime(index - length + 1)).Ticks / num5;
                 num2 += input.GetDateTime(i).Subtract(input.GetDateTime(index - length + 1)).Ticks / num5 * input[i, barData];
                 num3 += input[i, barData];
                 num4 += input.GetDateTime(i).Subtract(input.GetDateTime(index - length + 1)).Ticks / num5 * input.GetDateTime(i).Subtract(input.GetDateTime(index - length + 1)).Ticks / num5;
             }
         }
         else
         {
             for (int j = index; j > index - length; j--)
             {
                 num += j - index + length - 1;
                 num2 += (j - index + length - 1) * input[j, barData];
                 num3 += input[j, barData];
                 num4 += ((j - index + length - 1) * (j - index + length - 1));
             }
         }
         return (length * num2 - num * num3) / (length * num4 - Math.Pow(num, 2.0));
     }
     return double.NaN;
 }
Exemplo n.º 3
0
 public FO(ISeries input, int length, BarData barData = BarData.Close, RegressionDistanceMode distanceMode = RegressionDistanceMode.Time) : base(input)
 {
     this.length       = length;
     this.barData      = barData;
     this.distanceMode = distanceMode;
     this.Init();
 }
Exemplo n.º 4
0
 public static double Value(ISeries input, int index, int length, BarData barData = BarData.Close, RegressionDistanceMode distanceMode = RegressionDistanceMode.Time)
 {
     if (index >= length - 1)
     {
         var lri = LRI.Value(input, index, length, barData, distanceMode);
         return 100.0 * (input[index, barData] - lri) / lri;
     }
     return double.NaN;
 }
Exemplo n.º 5
0
        internal static FreeQuant.Indicators.RegressionDistanceMode Convert(RegressionDistanceMode mode)
        {
            switch (mode)
            {
            case RegressionDistanceMode.Time:
                return(FreeQuant.Indicators.RegressionDistanceMode.Time);

            case RegressionDistanceMode.Index:
                return(FreeQuant.Indicators.RegressionDistanceMode.Index);

            default:
                throw new NotImplementedException("RegressionDistanceMode is not supported : " + (object)mode);
            }
        }
Exemplo n.º 6
0
		public LRS(BarSeries series, int length, RegressionDistanceMode distanceMode, BarData option, Color color)
		{
			this.indicator = new SmartQuant.Indicators.LRS(series.series, length, global::OpenQuant.API.EnumConverter.Convert(option), color);
			(this.indicator as SmartQuant.Indicators.LRS).DistanceMode = global::OpenQuant.API.EnumConverter.Convert(distanceMode);
		}
Exemplo n.º 7
0
		public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode, BarData option)
		{
			this.indicator = new SmartQuant.Indicators.LRI(series.series, length, global::OpenQuant.API.EnumConverter.Convert(option));
		}
Exemplo n.º 8
0
		public static double Value(ISeries input, int index, int length, BarData barData = BarData.Close, RegressionDistanceMode distanceMode = RegressionDistanceMode.Time)
		{
			if (index >= length - 1)
			{
				double num = input[index, barData];
				double num2 = LRI.Value(input, index, length, barData, distanceMode);
				return 100.0 * (num - num2) / num2;
			}
			return double.NaN;
		}
Exemplo n.º 9
0
Arquivo: LRS.cs Projeto: heber/FreeOQ
 public static double Value(TimeSeries input, int index, int length, BarData option, RegressionDistanceMode distanceMode)
 {
   if (index < length - 1)
     return double.NaN;
   double x = 0.0;
   double num1 = 0.0;
   double num2 = 0.0;
   double num3 = 0.0;
   if (distanceMode == RegressionDistanceMode.Time)
   {
     double num4 = (double) input.GetDateTime(index).Subtract(input.GetDateTime(index - 1)).Ticks;
     for (int index1 = index; index1 > index - length; --index1)
     {
       x += (double) input.GetDateTime(index1).Subtract(input.GetDateTime(index - length + 1)).Ticks / num4;
       num1 += (double) input.GetDateTime(index1).Subtract(input.GetDateTime(index - length + 1)).Ticks / num4 * input[index1, option];
       num2 += input[index1, option];
       num3 += (double) input.GetDateTime(index1).Subtract(input.GetDateTime(index - length + 1)).Ticks / num4 * (double) input.GetDateTime(index1).Subtract(input.GetDateTime(index - length + 1)).Ticks / num4;
     }
   }
   else
   {
     for (int index1 = index; index1 > index - length; --index1)
     {
       x += (double) (index1 - index + length - 1);
       num1 += (double) (index1 - index + length - 1) * input[index1, option];
       num2 += input[index1, option];
       num3 += (double) ((index1 - index + length - 1) * (index1 - index + length - 1));
     }
   }
   return ((double) length * num1 - x * num2) / ((double) length * num3 - Math.Pow(x, 2.0));
 }
Exemplo n.º 10
0
Arquivo: LRS.cs Projeto: heber/FreeOQ
    public LRS(Indicator indicator, int length, RegressionDistanceMode distanceMode)
    {
			this.indicator = new FreeQuant.Indicators.LRS(indicator.indicator, length);
			(this.indicator as FreeQuant.Indicators.LRS).DistanceMode = EnumConverter.Convert(distanceMode);
    }
Exemplo n.º 11
0
 public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode, Color color)
 {
     this.indicator = new SmartQuant.Indicators.LRI(series.series, length, color);
 }
Exemplo n.º 12
0
 public LRI(global::OpenQuant.API.Indicator indicator, int length, RegressionDistanceMode distanceMode)
 {
     this.indicator = new SmartQuant.Indicators.LRI(indicator.indicator, length);
 }
Exemplo n.º 13
0
 public LRS(global::OpenQuant.API.Indicator indicator, int length, RegressionDistanceMode distanceMode)
 {
     this.indicator = new SmartQuant.Indicators.LRS(indicator.indicator, length);
     (this.indicator as SmartQuant.Indicators.LRS).DistanceMode = global::OpenQuant.API.EnumConverter.Convert(distanceMode);
 }
Exemplo n.º 14
0
 public LRS(global::OpenQuant.API.Indicator indicator, int length, RegressionDistanceMode distanceMode, BarData option, Color color)
 {
     this.indicator = new SmartQuant.Indicators.LRS(indicator.indicator, length, global::OpenQuant.API.EnumConverter.Convert(option), color);
     (this.indicator as SmartQuant.Indicators.LRS).DistanceMode = global::OpenQuant.API.EnumConverter.Convert(distanceMode);
 }
Exemplo n.º 15
0
Arquivo: LRI.cs Projeto: heber/FreeOQ
		public LRI(Indicator indicator, int length, RegressionDistanceMode distanceMode, BarData option)
		{
			this.indicator = new FreeQuant.Indicators.LRI(indicator.indicator, length, EnumConverter.Convert(option));
		}
Exemplo n.º 16
0
Arquivo: LRI.cs Projeto: heber/FreeOQ
		public LRI(Indicator indicator, int length, RegressionDistanceMode distanceMode)
		{
			this.indicator = new FreeQuant.Indicators.LRI(indicator.indicator, length);
		}
Exemplo n.º 17
0
Arquivo: LRI.cs Projeto: heber/FreeOQ
		public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode)
		{
			this.indicator = new FreeQuant.Indicators.LRI(series.series, length);
		}
Exemplo n.º 18
0
Arquivo: LRI.cs Projeto: heber/FreeOQ
		public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode, BarData option, Color color)
		{
			this.indicator = new FreeQuant.Indicators.LRI(series.series, length, EnumConverter.Convert(option), color);
		}
Exemplo n.º 19
0
		public LRI(global::OpenQuant.API.Indicator indicator, int length, RegressionDistanceMode distanceMode, BarData option, Color color)
		{
			this.indicator = new SmartQuant.Indicators.LRI(indicator.indicator, length, global::OpenQuant.API.EnumConverter.Convert(option), color);
		}
Exemplo n.º 20
0
 public LRS(BarSeries series, int length, RegressionDistanceMode distanceMode, BarData option)
 {
     this.indicator = new SmartQuant.Indicators.LRS(series.series, length, global::OpenQuant.API.EnumConverter.Convert(option));
     (this.indicator as SmartQuant.Indicators.LRS).DistanceMode = global::OpenQuant.API.EnumConverter.Convert(distanceMode);
 }
Exemplo n.º 21
0
		public LRI(global::OpenQuant.API.Indicator indicator, int length, RegressionDistanceMode distanceMode, Color color)
		{
			this.indicator = new SmartQuant.Indicators.LRI(indicator.indicator, length, color);
		}
Exemplo n.º 22
0
 public LRS(Indicator indicator, int length, RegressionDistanceMode distanceMode, BarData option, Color color)
 {
     this.indicator = new FreeQuant.Indicators.LRS(indicator.indicator, length, EnumConverter.Convert(option), color);
     (this.indicator as FreeQuant.Indicators.LRS).DistanceMode = EnumConverter.Convert(distanceMode);
 }
Exemplo n.º 23
0
 public LRI(global::OpenQuant.API.Indicator indicator, int length, RegressionDistanceMode distanceMode, BarData option)
 {
     this.indicator = new SmartQuant.Indicators.LRI(indicator.indicator, length, global::OpenQuant.API.EnumConverter.Convert(option));
 }
Exemplo n.º 24
0
 public LRS(BarSeries series, int length, RegressionDistanceMode distanceMode)
 {
     this.indicator = new FreeQuant.Indicators.LRS(series.series, length);
     (this.indicator as FreeQuant.Indicators.LRS).DistanceMode = EnumConverter.Convert(distanceMode);
 }
Exemplo n.º 25
0
Arquivo: LRS.cs Projeto: heber/FreeOQ
    public LRS(Indicator indicator, int length, RegressionDistanceMode distanceMode, BarData option, Color color)
    {
			this.indicator = new FreeQuant.Indicators.LRS(indicator.indicator, length, EnumConverter.Convert(option), color);
			(this.indicator as FreeQuant.Indicators.LRS).DistanceMode = EnumConverter.Convert(distanceMode);
    }
Exemplo n.º 26
0
 public LRS(Indicator indicator, int length, RegressionDistanceMode distanceMode)
 {
     this.indicator = new FreeQuant.Indicators.LRS(indicator.indicator, length);
     (this.indicator as FreeQuant.Indicators.LRS).DistanceMode = EnumConverter.Convert(distanceMode);
 }
Exemplo n.º 27
0
Arquivo: LRS.cs Projeto: heber/FreeOQ
    public LRS(BarSeries series, int length, RegressionDistanceMode distanceMode, BarData option)
    {
			this.indicator = new FreeQuant.Indicators.LRS(series.series, length, EnumConverter.Convert(option));
			(this.indicator as FreeQuant.Indicators.LRS).DistanceMode = EnumConverter.Convert(distanceMode);
    }
Exemplo n.º 28
0
 public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode)
 {
     this.indicator = new FreeQuant.Indicators.LRI(series.series, length);
 }
Exemplo n.º 29
0
Arquivo: LRS.cs Projeto: heber/FreeOQ
 public static double Value(DoubleSeries input, int index, int length, RegressionDistanceMode distanceMode)
 {
   return LRS.Value((TimeSeries) input, index, length, BarData.Close, distanceMode);
 }
Exemplo n.º 30
0
 public LRI(Indicator indicator, int length, RegressionDistanceMode distanceMode)
 {
     this.indicator = new FreeQuant.Indicators.LRI(indicator.indicator, length);
 }
Exemplo n.º 31
0
        public static double Value(TimeSeries input, int index, int length, BarData option, RegressionDistanceMode distanceMode)
        {
            if (index < length - 1)
            {
                return(double.NaN);
            }
            double x    = 0.0;
            double num1 = 0.0;
            double num2 = 0.0;
            double num3 = 0.0;

            if (distanceMode == RegressionDistanceMode.Time)
            {
                double num4 = (double)input.GetDateTime(index).Subtract(input.GetDateTime(index - 1)).Ticks;
                for (int index1 = index; index1 > index - length; --index1)
                {
                    x    += (double)input.GetDateTime(index1).Subtract(input.GetDateTime(index - length + 1)).Ticks / num4;
                    num1 += (double)input.GetDateTime(index1).Subtract(input.GetDateTime(index - length + 1)).Ticks / num4 * input[index1, option];
                    num2 += input[index1, option];
                    num3 += (double)input.GetDateTime(index1).Subtract(input.GetDateTime(index - length + 1)).Ticks / num4 * (double)input.GetDateTime(index1).Subtract(input.GetDateTime(index - length + 1)).Ticks / num4;
                }
            }
            else
            {
                for (int index1 = index; index1 > index - length; --index1)
                {
                    x    += (double)(index1 - index + length - 1);
                    num1 += (double)(index1 - index + length - 1) * input[index1, option];
                    num2 += input[index1, option];
                    num3 += (double)((index1 - index + length - 1) * (index1 - index + length - 1));
                }
            }
            return(((double)length * num1 - x * num2) / ((double)length * num3 - Math.Pow(x, 2.0)));
        }
Exemplo n.º 32
0
 public static double Value(ISeries input, int index, int length, BarData barData = BarData.Close, RegressionDistanceMode distanceMode = RegressionDistanceMode.Time)
 {
     if (index >= length - 1)
     {
         double num  = input[index, barData];
         double num2 = LRI.Value(input, index, length, barData, distanceMode);
         return(100.0 * (num - num2) / num2);
     }
     return(double.NaN);
 }
Exemplo n.º 33
0
 public static double Value(ISeries input, int index, int length, BarData barData = BarData.Close, RegressionDistanceMode distanceMode = RegressionDistanceMode.Time)
 {
     if (index >= length - 1)
     {
         double num  = 0.0;
         double num2 = 0.0;
         double num3 = 0.0;
         double num4 = 0.0;
         double num6;
         if (distanceMode == RegressionDistanceMode.Time)
         {
             double num5 = (double)input.GetDateTime(index).Subtract(input.GetDateTime(index - 1)).Ticks;
             for (int i = index; i > index - length; i--)
             {
                 num  += (double)input.GetDateTime(i).Subtract(input.GetDateTime(index - length + 1)).Ticks / num5;
                 num2 += (double)input.GetDateTime(i).Subtract(input.GetDateTime(index - length + 1)).Ticks / num5 * input[i, barData];
                 num3 += input[i, barData];
                 num4 += (double)input.GetDateTime(i).Subtract(input.GetDateTime(index - length + 1)).Ticks / num5 * (double)input.GetDateTime(i).Subtract(input.GetDateTime(index - length + 1)).Ticks / num5;
             }
             num6 = (double)input.GetDateTime(index).Subtract(input.GetDateTime(index - length + 1)).Ticks / num5;
         }
         else
         {
             for (int j = index; j > index - length; j--)
             {
                 num  += (double)(j - index + length - 1);
                 num2 += (double)(j - index + length - 1) * input[j, barData];
                 num3 += input[j, barData];
                 num4 += (double)((j - index + length - 1) * (j - index + length - 1));
             }
             num6 = (double)(length - 1);
         }
         double num7 = ((double)length * num2 - num * num3) / ((double)length * num4 - Math.Pow(num, 2.0));
         double num8 = (num3 - num7 * num) / (double)length;
         return(num7 * num6 + num8);
     }
     return(double.NaN);
 }
Exemplo n.º 34
0
 public static double Value(DoubleSeries input, int index, int length, RegressionDistanceMode distanceMode)
 {
     return(FO.Value((TimeSeries)input, index, length, BarData.Close, distanceMode));
 }
Exemplo n.º 35
0
		internal static FreeQuant.Indicators.RegressionDistanceMode Convert(RegressionDistanceMode mode)
		{
			switch (mode)
			{
				case RegressionDistanceMode.Time:
					return FreeQuant.Indicators.RegressionDistanceMode.Time;
				case RegressionDistanceMode.Index:
					return FreeQuant.Indicators.RegressionDistanceMode.Index;
				default:
					throw new NotImplementedException("RegressionDistanceMode is not supported : " + (object)mode);
			}
		}
Exemplo n.º 36
0
		public LRS(global::OpenQuant.API.Indicator indicator, int length, RegressionDistanceMode distanceMode, Color color)
		{
			this.indicator = new SmartQuant.Indicators.LRS(indicator.indicator, length, color);
			(this.indicator as SmartQuant.Indicators.LRS).DistanceMode = global::OpenQuant.API.EnumConverter.Convert(distanceMode);
		}
Exemplo n.º 37
0
 public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode, BarData option)
 {
     this.indicator = new FreeQuant.Indicators.LRI(series.series, length, EnumConverter.Convert(option));
 }
Exemplo n.º 38
0
		public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode, Color color)
		{
			this.indicator = new SmartQuant.Indicators.LRI(series.series, length, color);
		}
Exemplo n.º 39
0
        public static double Value(TimeSeries input, int index, int length, BarData option, RegressionDistanceMode distanceMode)
        {
            if (index < length - 1 + input.FirstIndex)
            {
                return(double.NaN);
            }
            double num1 = input[index, option];
            double num2 = LRI.Value(input, index, length, option, distanceMode);

            return(100.0 * (num1 - num2) / num2);
        }
Exemplo n.º 40
0
 public LRI(Indicator indicator, int length, RegressionDistanceMode distanceMode, BarData option)
 {
     this.indicator = new FreeQuant.Indicators.LRI(indicator.indicator, length, EnumConverter.Convert(option));
 }
Exemplo n.º 41
0
 public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode, BarData option, Color color)
 {
     this.indicator = new SmartQuant.Indicators.LRI(series.series, length, global::OpenQuant.API.EnumConverter.Convert(option), color);
 }
Exemplo n.º 42
0
Arquivo: FO.cs Projeto: heber/FreeOQ
 public static double Value(TimeSeries input, int index, int length, BarData option, RegressionDistanceMode distanceMode)
 {
   if (index < length - 1 + input.FirstIndex)
     return double.NaN;
   double num1 = input[index, option];
   double num2 = LRI.Value(input, index, length, option, distanceMode);
   return 100.0 * (num1 - num2) / num2;
 }