Exemplo n.º 1
0
        public static double Value(TimeSeries input, int index, int length, BarData option)
        {
            if (index < 1 + input.FirstIndex)
            {
                return(double.NaN);
            }
            DoubleSeries doubleSeries = new DoubleSeries();

            for (int firstIndex = input.FirstIndex; firstIndex <= index; ++firstIndex)
            {
                doubleSeries.Add(input.GetDateTime(firstIndex), input[firstIndex, option]);
            }
            EMA ema = new EMA((TimeSeries) new EMA((TimeSeries) new EMA((TimeSeries)doubleSeries, length, option), length, option), length, option);

            return((ema[index - input.FirstIndex] - ema[index - 1 - input.FirstIndex]) / ema[index - 1 - input.FirstIndex] * 100.0);
        }
Exemplo n.º 2
0
        public static double Value(TimeSeries input, int index, int length1, int length2)
        {
            if (index < length2 - 1 + input.FirstIndex)
            {
                return(double.NaN);
            }
            DoubleSeries doubleSeries = new DoubleSeries();

            for (int index1 = 0; index1 <= index; ++index1)
            {
                doubleSeries.Add(input.GetDateTime(index1), input[index1, BarData.High] - input[index1, BarData.Low]);
            }
            EMA ema = new EMA((TimeSeries)doubleSeries, length1, BarData.Close);

            return((ema[index] - ema[index - length2 + 1]) / ema[index - length2 + 1] * 100.0);
        }
Exemplo n.º 3
0
 public static double Value(TimeSeries input, int index, int length, BarData option)
 {
     if (index >= input.FirstIndex + 1)
     {
         double num1 = 2.0 / (double)(length + 1);
         double num2 = EMA.Value(input, index - 1, length, option);
         return(num2 + num1 * (input[index, option] - num2));
     }
     else if (index == input.FirstIndex)
     {
         return(input[input.FirstIndex, option]);
     }
     else
     {
         return(double.NaN);
     }
 }
Exemplo n.º 4
0
 protected override void Init()
 {
     this.Name  = this.fLength.ToString();
     this.Title = "TRIX";
     this.Clear();
     this.fCalculate = true;
     if (this.fInput == null)
     {
         return;
     }
     if (this.fInput is BarSeries)
     {
         this.Name = this.fLength + (string)(object)this.fOption;
     }
     if (TimeSeries.fNameOption == ENameOption.Long)
     {
         this.Name = this.fInput.Name + this.Name;
     }
     this.Disconnect();
     if (this.fEMA != null)
     {
         this.fEMA.Detach();
     }
     if (this.fEMA_2 != null)
     {
         this.fEMA_2.Detach();
     }
     if (this.fEMA_3 != null)
     {
         this.fEMA_3.Detach();
     }
     this.fEMA = new EMA(this.fInput, this.fLength, this.fOption);
     this.Connect();
     this.fEMA_2             = new EMA((TimeSeries)this.fEMA, this.fLength, this.fOption);
     this.fEMA_3             = new EMA((TimeSeries)this.fEMA_2, this.fLength, this.fOption);
     this.fEMA.DrawEnabled   = false;
     this.fEMA_2.DrawEnabled = false;
     this.fEMA_3.DrawEnabled = false;
 }
Exemplo n.º 5
0
        public static double Value(TimeSeries input, int index, int length, int order)
        {
            if (index < length - 1 + input.FirstIndex)
            {
                return(double.NaN);
            }
            DoubleSeries doubleSeries = new DoubleSeries();
            double       num          = 0.0;

            for (int index1 = 0; index1 <= index; ++index1)
            {
                doubleSeries.Add(input.GetDateTime(index1), input[index1, BarData.High] - input[index1, BarData.Low]);
            }
            EMA ema1 = new EMA((TimeSeries)doubleSeries, order, BarData.Close);
            EMA ema2 = new EMA((TimeSeries)ema1, order, BarData.Close);

            for (int index1 = index; index1 > index - length; --index1)
            {
                num += ema1[index1] / ema2[index1];
            }
            return(num);
        }
Exemplo n.º 6
0
 protected override void Init()
 {
     this.Name  = this.fLength1.ToString() + this.fLength2.ToString();
     this.Title = "VCH";
     this.Clear();
     this.fCalculate = true;
     if (this.fInput == null)
     {
         return;
     }
     if (TimeSeries.fNameOption == ENameOption.Long)
     {
         this.Name = this.fInput.Name + this.Name;
     }
     this.fHL_array = new DoubleSeries();
     for (int index = 0; index < this.fInput.Count; ++index)
     {
         this.fHL_array.Add(this.fInput.GetDateTime(index), this.fInput[index, BarData.High] - this.fInput[index, BarData.Low]);
     }
     this.fEMA             = new EMA((TimeSeries)this.fHL_array, this.fLength1);
     this.fEMA.DrawEnabled = false;
 }
Exemplo n.º 7
0
Arquivo: MACD.cs Projeto: heber/FreeOQ
    protected override void Init()
    {
			this.Name = "MACD"+ (object) this.fLength1 + (string) (object) this.fLength2;
			this.Title = "MACD";
      this.Clear();
      this.fCalculate = true;
      if (this.fInput == null)
        return;
      if (this.fInput is BarSeries)
				this.Name = "MACD" + (object) this.fLength1 + (string) (object) this.fLength2  + (string) (object) this.fOption;
			if (TimeSeries.fNameOption == ENameOption.Long)
        this.Name = this.fInput.Name +  this.Name;
      this.Disconnect();
      if (this.fEMA1 != null)
        this.fEMA1.Detach();
      if (this.fEMA2 != null)
        this.fEMA2.Detach();
      this.fEMA1 = new EMA(this.fInput, this.fLength1, this.fOption);
      this.fEMA2 = new EMA(this.fInput, this.fLength2, this.fOption);
      this.Connect();
      this.fEMA1.DrawEnabled = false;
      this.fEMA2.DrawEnabled = false;
    }
Exemplo n.º 8
0
Arquivo: VCH.cs Projeto: heber/FreeOQ
    protected override void Init()
    {
			this.Name =  this.fLength1.ToString()  + this.fLength2.ToString();
			this.Title = "VCH";
      this.Clear();
      this.fCalculate = true;
      if (this.fInput == null)
        return;
			if (TimeSeries.fNameOption == ENameOption.Long)
        this.Name = this.fInput.Name +  this.Name;
      this.fHL_array = new DoubleSeries();
      for (int index = 0; index < this.fInput.Count; ++index)
        this.fHL_array.Add(this.fInput.GetDateTime(index), this.fInput[index, BarData.High] - this.fInput[index, BarData.Low]);
      this.fEMA = new EMA((TimeSeries) this.fHL_array, this.fLength1);
      this.fEMA.DrawEnabled = false;
    }
Exemplo n.º 9
0
Arquivo: VCH.cs Projeto: heber/FreeOQ
 public static double Value(TimeSeries input, int index, int length1, int length2)
 {
   if (index < length2 - 1 + input.FirstIndex)
     return double.NaN;
   DoubleSeries doubleSeries = new DoubleSeries();
   for (int index1 = 0; index1 <= index; ++index1)
     doubleSeries.Add(input.GetDateTime(index1), input[index1, BarData.High] - input[index1, BarData.Low]);
   EMA ema = new EMA((TimeSeries) doubleSeries, length1, BarData.Close);
   return (ema[index] - ema[index - length2 + 1]) / ema[index - length2 + 1] * 100.0;
 }
Exemplo n.º 10
0
Arquivo: CAD.cs Projeto: heber/FreeOQ
 public static double Value(TimeSeries input, int index, int length1, int length2)
 {
   if (index < Math.Max(length1, length2) + input.FirstIndex)
     return double.NaN;
   AD ad = new AD(input);
   EMA ema1 = new EMA((TimeSeries) ad, length1);
   EMA ema2 = new EMA((TimeSeries) ad, length2);
   return ema1[index] - ema2[index];
 }
Exemplo n.º 11
0
Arquivo: TRIX.cs Projeto: heber/FreeOQ
 public static double Value(TimeSeries input, int index, int length, BarData option)
 {
   if (index < 1 + input.FirstIndex)
     return double.NaN;
   DoubleSeries doubleSeries = new DoubleSeries();
   for (int firstIndex = input.FirstIndex; firstIndex <= index; ++firstIndex)
     doubleSeries.Add(input.GetDateTime(firstIndex), input[firstIndex, option]);
   EMA ema = new EMA((TimeSeries) new EMA((TimeSeries) new EMA((TimeSeries) doubleSeries, length, option), length, option), length, option);
   return (ema[index - input.FirstIndex] - ema[index - 1 - input.FirstIndex]) / ema[index - 1 - input.FirstIndex] * 100.0;
 }
Exemplo n.º 12
0
Arquivo: TRIX.cs Projeto: heber/FreeOQ
    protected override void Init()
    {
			this.Name =  this.fLength.ToString();
			this.Title = "TRIX";
      this.Clear();
      this.fCalculate = true;
      if (this.fInput == null)
        return;
      if (this.fInput is BarSeries)
        this.Name = this.fLength + (string) (object) this.fOption;
			if (TimeSeries.fNameOption == ENameOption.Long)
        this.Name = this.fInput.Name + this.Name;
      this.Disconnect();
      if (this.fEMA != null)
        this.fEMA.Detach();
      if (this.fEMA_2 != null)
        this.fEMA_2.Detach();
      if (this.fEMA_3 != null)
        this.fEMA_3.Detach();
      this.fEMA = new EMA(this.fInput, this.fLength, this.fOption);
      this.Connect();
      this.fEMA_2 = new EMA((TimeSeries) this.fEMA, this.fLength, this.fOption);
      this.fEMA_3 = new EMA((TimeSeries) this.fEMA_2, this.fLength, this.fOption);
      this.fEMA.DrawEnabled = false;
      this.fEMA_2.DrawEnabled = false;
      this.fEMA_3.DrawEnabled = false;
    }
Exemplo n.º 13
0
Arquivo: MASS.cs Projeto: heber/FreeOQ
 public static double Value(TimeSeries input, int index, int length, int order)
 {
   if (index < length - 1 + input.FirstIndex)
     return double.NaN;
   DoubleSeries doubleSeries = new DoubleSeries();
   double num = 0.0;
   for (int index1 = 0; index1 <= index; ++index1)
     doubleSeries.Add(input.GetDateTime(index1), input[index1, BarData.High] - input[index1, BarData.Low]);
   EMA ema1 = new EMA((TimeSeries) doubleSeries, order, BarData.Close);
   EMA ema2 = new EMA((TimeSeries) ema1, order, BarData.Close);
   for (int index1 = index; index1 > index - length; --index1)
     num += ema1[index1] / ema2[index1];
   return num;
 }
Exemplo n.º 14
0
 public static double Value(DoubleSeries input, int index, int length)
 {
     return(EMA.Value((TimeSeries)input, index, length, BarData.Close));
 }