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(); }
// 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; }
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(); }
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; }
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); } }
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); }
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)); }
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; }
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)); }
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); }
public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode, Color color) { this.indicator = new SmartQuant.Indicators.LRI(series.series, length, color); }
public LRI(global::OpenQuant.API.Indicator indicator, int length, RegressionDistanceMode distanceMode) { this.indicator = new SmartQuant.Indicators.LRI(indicator.indicator, length); }
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); }
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); }
public LRI(Indicator indicator, int length, RegressionDistanceMode distanceMode, BarData option) { this.indicator = new FreeQuant.Indicators.LRI(indicator.indicator, length, EnumConverter.Convert(option)); }
public LRI(Indicator indicator, int length, RegressionDistanceMode distanceMode) { this.indicator = new FreeQuant.Indicators.LRI(indicator.indicator, length); }
public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode) { this.indicator = new FreeQuant.Indicators.LRI(series.series, length); }
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); }
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); }
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); }
public LRI(global::OpenQuant.API.Indicator indicator, int length, RegressionDistanceMode distanceMode, Color color) { this.indicator = new SmartQuant.Indicators.LRI(indicator.indicator, length, color); }
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); }
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)); }
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); }
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); }
public static double Value(DoubleSeries input, int index, int length, RegressionDistanceMode distanceMode) { return LRS.Value((TimeSeries) input, index, length, BarData.Close, distanceMode); }
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))); }
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); }
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); }
public static double Value(DoubleSeries input, int index, int length, RegressionDistanceMode distanceMode) { return(FO.Value((TimeSeries)input, index, length, BarData.Close, distanceMode)); }
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); } }
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); }
public LRI(BarSeries series, int length, RegressionDistanceMode distanceMode, BarData option) { this.indicator = new FreeQuant.Indicators.LRI(series.series, length, EnumConverter.Convert(option)); }
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); }
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); }
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; }