예제 #1
0
파일: LRS.cs 프로젝트: ForTrade/CSharp
		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();
		}
예제 #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;
 }
예제 #3
0
파일: FO.cs 프로젝트: ForTrade/CSharp
 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();
 }
예제 #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;
 }
예제 #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);
            }
        }
예제 #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);
		}
예제 #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));
		}
예제 #8
0
파일: FO.cs 프로젝트: ForTrade/CSharp
		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;
		}
예제 #9
0
파일: LRS.cs 프로젝트: 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));
 }
예제 #10
0
파일: LRS.cs 프로젝트: 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);
    }
예제 #11
0
 public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode, Color color)
 {
     this.indicator = new SmartQuant.Indicators.LRI(series.series, length, color);
 }
예제 #12
0
 public LRI(global::OpenQuant.API.Indicator indicator, int length, RegressionDistanceMode distanceMode)
 {
     this.indicator = new SmartQuant.Indicators.LRI(indicator.indicator, length);
 }
예제 #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);
 }
예제 #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);
 }
예제 #15
0
파일: LRI.cs 프로젝트: heber/FreeOQ
		public LRI(Indicator indicator, int length, RegressionDistanceMode distanceMode, BarData option)
		{
			this.indicator = new FreeQuant.Indicators.LRI(indicator.indicator, length, EnumConverter.Convert(option));
		}
예제 #16
0
파일: LRI.cs 프로젝트: heber/FreeOQ
		public LRI(Indicator indicator, int length, RegressionDistanceMode distanceMode)
		{
			this.indicator = new FreeQuant.Indicators.LRI(indicator.indicator, length);
		}
예제 #17
0
파일: LRI.cs 프로젝트: heber/FreeOQ
		public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode)
		{
			this.indicator = new FreeQuant.Indicators.LRI(series.series, length);
		}
예제 #18
0
파일: LRI.cs 프로젝트: 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);
		}
예제 #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);
		}
예제 #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);
 }
예제 #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);
		}
예제 #22
0
파일: LRS.cs 프로젝트: zhuzhenping/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);
 }
예제 #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));
 }
예제 #24
0
파일: LRS.cs 프로젝트: zhuzhenping/FreeOQ
 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);
 }
예제 #25
0
파일: LRS.cs 프로젝트: 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);
    }
예제 #26
0
파일: LRS.cs 프로젝트: zhuzhenping/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);
 }
예제 #27
0
파일: LRS.cs 프로젝트: 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);
    }
예제 #28
0
파일: LRI.cs 프로젝트: zhuzhenping/FreeOQ
 public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode)
 {
     this.indicator = new FreeQuant.Indicators.LRI(series.series, length);
 }
예제 #29
0
파일: LRS.cs 프로젝트: heber/FreeOQ
 public static double Value(DoubleSeries input, int index, int length, RegressionDistanceMode distanceMode)
 {
   return LRS.Value((TimeSeries) input, index, length, BarData.Close, distanceMode);
 }
예제 #30
0
파일: LRI.cs 프로젝트: zhuzhenping/FreeOQ
 public LRI(Indicator indicator, int length, RegressionDistanceMode distanceMode)
 {
     this.indicator = new FreeQuant.Indicators.LRI(indicator.indicator, length);
 }
예제 #31
0
파일: LRS.cs 프로젝트: zhuzhenping/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)));
        }
예제 #32
0
파일: FO.cs 프로젝트: ForTrade/CSharp
 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);
 }
예제 #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);
 }
예제 #34
0
 public static double Value(DoubleSeries input, int index, int length, RegressionDistanceMode distanceMode)
 {
     return(FO.Value((TimeSeries)input, index, length, BarData.Close, distanceMode));
 }
예제 #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);
			}
		}
예제 #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);
		}
예제 #37
0
파일: LRI.cs 프로젝트: zhuzhenping/FreeOQ
 public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode, BarData option)
 {
     this.indicator = new FreeQuant.Indicators.LRI(series.series, length, EnumConverter.Convert(option));
 }
예제 #38
0
		public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode, Color color)
		{
			this.indicator = new SmartQuant.Indicators.LRI(series.series, length, color);
		}
예제 #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);
        }
예제 #40
0
파일: LRI.cs 프로젝트: zhuzhenping/FreeOQ
 public LRI(Indicator indicator, int length, RegressionDistanceMode distanceMode, BarData option)
 {
     this.indicator = new FreeQuant.Indicators.LRI(indicator.indicator, length, EnumConverter.Convert(option));
 }
예제 #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);
 }
예제 #42
0
파일: FO.cs 프로젝트: 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;
 }