Exemple #1
0
		protected override void Init()
		{
			this.name = string.Concat(new object[]
			{
				"CAD (",
				this.length1,
				", ",
				this.length2,
				")"
			});
			this.description = "Chaikin A/D Oscillator";
			base.Clear();
			this.calculate = true;
			base.Detach();
			if (this.ad != null)
			{
				this.ad.Detach();
			}
			if (this.ema1 != null)
			{
				this.ema1.Detach();
			}
			if (this.ema2 != null)
			{
				this.ema2.Detach();
			}
			this.ad = new AD(this.input);
			this.ema1 = new EMA(this.ad, this.length1, BarData.Close);
			this.ema2 = new EMA(this.ad, this.length2, BarData.Close);
			base.Attach();
		}
Exemple #2
0
		public static double Value(ISeries input, int index, int length1, int length2)
		{
			if (index >= Math.Max(length1, length2))
			{
				AD input2 = new AD(input);
				EMA eMA = new EMA(input2, length1, BarData.Close);
				EMA eMA2 = new EMA(input2, length2, BarData.Close);
				return eMA[index] - eMA2[index];
			}
			return double.NaN;
		}
Exemple #3
0
 public static double Value(ISeries input, int index)
 {
     if (index >= 0)
     {
         double num      = input[index, BarData.High];
         double num2     = input[index, BarData.Low];
         double num3     = input[index, BarData.Close];
         double arg_2A_0 = input[index, BarData.Open];
         double num4     = input[index, BarData.Volume];
         double result   = 0.0;
         if (index >= 1)
         {
             if (num != num2)
             {
                 result = num4 * (num3 - num2 - (num - num3)) / (num - num2) + AD.Value(input, index - 1);
             }
             else
             {
                 result = AD.Value(input, index - 1);
             }
         }
         else
         {
             if (index == 0 && num != num2)
             {
                 result = num4 * (num3 - num2 - (num - num3)) / (num - num2);
             }
         }
         return(result);
     }
     return(double.NaN);
 }