Ejemplo n.º 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();
		}
Ejemplo n.º 2
0
		protected override void Init()
		{
			if (this.input is BarSeries)
			{
				this.name = string.Concat(new object[]
				{
					"TRIX (",
					this.length,
					", ",
					this.barData,
					")"
				});
			}
			else
			{
				this.name = "TRIX (" + this.length + " )";
			}
			this.description = "TRIX Index";
			base.Clear();
			this.calculate = true;
			base.Detach();
			this.ema1 = new EMA(this.input, this.length, this.barData);
			base.Attach();
			this.ema2 = new EMA(this.ema1, this.length, this.barData);
			this.ema3 = new EMA(this.ema2, this.length, this.barData);
		}
Ejemplo n.º 3
0
 public static double Value(ISeries input, int index, int length, BarData barData = BarData.Close)
 {
     if (index >= 1)
     {
         TimeSeries timeSeries = new TimeSeries();
         for (int i = 0; i <= index; i++)
         {
             timeSeries.Add(input.GetDateTime(i), input[i, barData]);
         }
         EMA input2 = new EMA(timeSeries, length, barData);
         EMA input3 = new EMA(input2, length, barData);
         EMA eMA    = new EMA(input3, length, barData);
         return((eMA[index] - eMA[index - 1]) / eMA[index - 1] * 100.0);
     }
     return(double.NaN);
 }
Ejemplo n.º 4
0
 public static double Value(ISeries input, int index, int length, int order)
 {
     if (index >= length - 1)
     {
         TimeSeries timeSeries = new TimeSeries();
         for (int i = 0; i <= index; i++)
         {
             timeSeries.Add(input.GetDateTime(i), input[i, BarData.High] - input[i, BarData.Low]);
         }
         EMA    eMA  = new EMA(timeSeries, order, BarData.Close);
         EMA    eMA2 = new EMA(eMA, order, BarData.Close);
         double num  = 0.0;
         for (int j = index; j > index - length; j--)
         {
             num += eMA[j] / eMA2[j];
         }
         return(num);
     }
     return(double.NaN);
 }
Ejemplo n.º 5
0
 protected override void Init()
 {
     this.name = string.Concat(new object[]
     {
         "VCH (",
         this.length1,
         ", ",
         this.length2,
         ")"
     });
     this.description = "Chaikin Volatility";
     base.Clear();
     this.calculate = true;
     this.hlTS      = new TimeSeries();
     for (int i = 0; i < this.input.Count; i++)
     {
         this.hlTS.Add(this.input.GetDateTime(i), this.input[i, BarData.High] - this.input[i, BarData.Low]);
     }
     this.ema = new EMA(this.hlTS, this.length1, BarData.Close);
 }
Ejemplo n.º 6
0
		protected override void Init()
		{
			this.name = string.Concat(new object[]
			{
				"VCH (",
				this.length1,
				", ",
				this.length2,
				")"
			});
			this.description = "Chaikin Volatility";
			base.Clear();
			this.calculate = true;
			this.hlTS = new TimeSeries();
			for (int i = 0; i < this.input.Count; i++)
			{
				this.hlTS.Add(this.input.GetDateTime(i), this.input[i, BarData.High] - this.input[i, BarData.Low]);
			}
			this.ema = new EMA(this.hlTS, this.length1, BarData.Close);
		}
Ejemplo n.º 7
0
 protected override void Init()
 {
     this.name = string.Concat(new object[]
     {
         "MASS (",
         this.length,
         ", ",
         this.order,
         ")"
     });
     this.description = "Mass Index";
     base.Clear();
     this.calculate = true;
     this.hlTS      = new TimeSeries();
     for (int i = 0; i < this.input.Count; i++)
     {
         this.hlTS.Add(this.input.GetDateTime(i), this.input[i, BarData.High] - this.input[i, BarData.Low]);
     }
     base.Detach();
     this.ema     = new EMA(this.hlTS, this.order, BarData.Close);
     this.ema_ema = new EMA(this.ema, this.order, BarData.Close);
     base.Attach();
 }
Ejemplo n.º 8
0
		protected override void Init()
		{
			this.name = string.Concat(new object[]
			{
				"MASS (",
				this.length,
				", ",
				this.order,
				")"
			});
			this.description = "Mass Index";
			base.Clear();
			this.calculate = true;
			this.hlTS = new TimeSeries();
			for (int i = 0; i < this.input.Count; i++)
			{
				this.hlTS.Add(this.input.GetDateTime(i), this.input[i, BarData.High] - this.input[i, BarData.Low]);
			}
			base.Detach();
			this.ema = new EMA(this.hlTS, this.order, BarData.Close);
			this.ema_ema = new EMA(this.ema, this.order, BarData.Close);
			base.Attach();
		}
Ejemplo n.º 9
0
		public static double Value(ISeries input, int index, int length, BarData barData = BarData.Close)
		{
			if (index >= 1)
			{
				TimeSeries timeSeries = new TimeSeries();
				for (int i = 0; i <= index; i++)
				{
					timeSeries.Add(input.GetDateTime(i), input[i, barData]);
				}
				EMA input2 = new EMA(timeSeries, length, barData);
				EMA input3 = new EMA(input2, length, barData);
				EMA eMA = new EMA(input3, length, barData);
				return (eMA[index] - eMA[index - 1]) / eMA[index - 1] * 100.0;
			}
			return double.NaN;
		}
Ejemplo n.º 10
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;
		}
Ejemplo n.º 11
0
		protected override void Init()
		{
			if (this.input is BarSeries)
			{
				this.name = string.Concat(new object[]
				{
					"MACD (",
					this.length1,
					", ",
					this.length2,
					", ",
					this.barData,
					")"
				});
			}
			else
			{
				this.name = string.Concat(new object[]
				{
					"MACD (",
					this.length1,
					", ",
					this.length2,
					")"
				});
			}
			this.description = "Moving Average Convergence Divergence";
			base.Clear();
			this.calculate = true;
			base.Detach();
			this.ema1 = new EMA(this.input, this.length1, this.barData);
			this.ema2 = new EMA(this.input, this.length2, this.barData);
			base.Attach();
		}
Ejemplo n.º 12
0
		public static double Value(ISeries input, int index, int length1, int length2)
		{
			if (index >= length2 - 1)
			{
				TimeSeries timeSeries = new TimeSeries();
				for (int i = 0; i <= index; i++)
				{
					timeSeries.Add(input.GetDateTime(i), input[i, BarData.High] - input[i, BarData.Low]);
				}
				EMA eMA = new EMA(timeSeries, length1, BarData.Close);
				return (eMA[index] - eMA[index - length2 + 1]) / eMA[index - length2 + 1] * 100.0;
			}
			return double.NaN;
		}
Ejemplo n.º 13
0
		public static double Value(ISeries input, int index, int length, int order)
		{
			if (index >= length - 1)
			{
				TimeSeries timeSeries = new TimeSeries();
				for (int i = 0; i <= index; i++)
				{
					timeSeries.Add(input.GetDateTime(i), input[i, BarData.High] - input[i, BarData.Low]);
				}
				EMA eMA = new EMA(timeSeries, order, BarData.Close);
				EMA eMA2 = new EMA(eMA, order, BarData.Close);
				double num = 0.0;
				for (int j = index; j > index - length; j--)
				{
					num += eMA[j] / eMA2[j];
				}
				return num;
			}
			return double.NaN;
		}