Exemple #1
0
 protected override void OnStartUp()
 {
     Plots[0].Pen.Width     = plot0Width;
     Plots[0].PlotStyle     = plot0Style;
     Plots[0].Pen.DashStyle = dash0Style;
     Plots[1].Pen.Width     = plot1Width;
     Plots[1].PlotStyle     = plot1Style;
     Plots[1].Pen.DashStyle = dash1Style;
     candles = false;
     if (ChartControl != null && ChartControl.ChartStyleType == ChartStyleType.CandleStick)
     {
         candles = true;
     }
     gap = (plot1Style == PlotStyle.Line) || (plot1Style == PlotStyle.Square);
     if (ShowStopDots)
     {
         Plots[0].Pen.Color = Color.Gray;
     }
     else
     {
         Plots[0].Pen.Color = Color.Transparent;
     }
     if (ShowStopLine)
     {
         Plots[1].Pen.Color = Color.Gray;
     }
     else
     {
         Plots[1].Pen.Color = Color.Transparent;
     }
     MM  = anaMovingMedian(Medians[0], periodMedian);
     MAE = ATR(Closes[0], periodATR);
 }
Exemple #2
0
 protected override void OnStartUp()
 {
     Plots[0].Pen.Width     = plot0Width;
     Plots[0].PlotStyle     = plot0Style;
     Plots[0].Pen.DashStyle = dash0Style;
     Plots[1].Pen.Width     = plot1Width;
     Plots[1].PlotStyle     = plot1Style;
     Plots[1].Pen.DashStyle = dash1Style;
     gap = plot1Style == PlotStyle.Line || plot1Style == PlotStyle.Square;
     Plots[1].Pen.Color = ShowStopLine ? Color.Gray : Color.Transparent;
     mm  = anaMovingMedian(Medians[0], periodMedian);
     mae = ATR(Closes[0], periodAtr);
 }
        /// <summary>
        /// The anaMovingMedian (Simple Moving Average) is an indicator that shows the average value of a security's price over a period of time.
        /// </summary>
        /// <returns></returns>
        public anaMovingMedian anaMovingMedian(IDataSeries input, int period)
        {
            if (cacheanaMovingMedian != null)
            {
                for (int idx = 0; idx < cacheanaMovingMedian.Length; idx++)
                {
                    if (cacheanaMovingMedian[idx].Period == period && cacheanaMovingMedian[idx].EqualsInput(input))
                    {
                        return(cacheanaMovingMedian[idx]);
                    }
                }
            }

            lock (checkanaMovingMedian)
            {
                checkanaMovingMedian.Period = period;
                period = checkanaMovingMedian.Period;

                if (cacheanaMovingMedian != null)
                {
                    for (int idx = 0; idx < cacheanaMovingMedian.Length; idx++)
                    {
                        if (cacheanaMovingMedian[idx].Period == period && cacheanaMovingMedian[idx].EqualsInput(input))
                        {
                            return(cacheanaMovingMedian[idx]);
                        }
                    }
                }

                var indicator = new anaMovingMedian();
                indicator.BarsRequired        = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack         = MaximumBarsLookBack;
#endif
                indicator.Input  = input;
                indicator.Period = period;
                Indicators.Add(indicator);
                indicator.SetUp();

                var tmp = new anaMovingMedian[cacheanaMovingMedian == null ? 1 : cacheanaMovingMedian.Length + 1];
                if (cacheanaMovingMedian != null)
                {
                    cacheanaMovingMedian.CopyTo(tmp, 0);
                }
                tmp[tmp.Length - 1]  = indicator;
                cacheanaMovingMedian = tmp;
                return(indicator);
            }
        }
		protected override void OnStartUp()
		{
			Plots[0].Pen.Width		= plot0Width;
			Plots[0].PlotStyle		= plot0Style;
			Plots[0].Pen.DashStyle	= dash0Style;
			Plots[1].Pen.Width		= plot1Width;
			Plots[1].PlotStyle		= plot1Style;
			Plots[1].Pen.DashStyle	= dash1Style;
			gap						= (plot1Style == PlotStyle.Line) || (plot1Style == PlotStyle.Square);
			Plots[0].Pen.Color		= ShowStopDots ? Color.Gray : Color.Transparent;
			Plots[1].Pen.Color		= ShowStopLine ? Color.Gray : Color.Transparent;
			mm						= anaMovingMedian(Medians[0], periodMedian);
			mae						= ATR(Closes[0], periodAtr);
			candles					= ChartControl != null && ChartControl.ChartStyleType == ChartStyleType.CandleStick;
		}
Exemple #5
0
 protected override void OnStartUp()
 {
     Plots[0].Pen.Width     = plot0Width;
     Plots[0].PlotStyle     = plot0Style;
     Plots[0].Pen.DashStyle = dash0Style;
     Plots[1].Pen.Width     = plot1Width;
     Plots[1].PlotStyle     = plot1Style;
     Plots[1].Pen.DashStyle = dash1Style;
     gap = (plot1Style == PlotStyle.Line) || (plot1Style == PlotStyle.Square);
     Plots[0].Pen.Color = ShowStopDots ? Color.Gray : Color.Transparent;
     Plots[1].Pen.Color = ShowStopLine ? Color.Gray : Color.Transparent;
     mm      = anaMovingMedian(Medians[0], periodMedian);
     mae     = ATR(Closes[0], periodAtr);
     candles = ChartControl != null && ChartControl.ChartStyleType == ChartStyleType.CandleStick;
 }
Exemple #6
0
 protected override void OnStartUp()
 {
     Plots[0].Pen.Width     = plot0Width;
     Plots[0].PlotStyle     = plot0Style;
     Plots[0].Pen.DashStyle = dash0Style;
     gap = (plot0Style == PlotStyle.Line) || (plot0Style == PlotStyle.Square);
     if (ShowStopLine)
     {
         Plots[0].Pen.Color = Color.Gray;
     }
     else
     {
         Plots[0].Pen.Color = Color.Transparent;
     }
     MM  = anaMovingMedian(Medians[0], periodMedian);
     MAE = ATR(Closes[0], periodATR);
 }
Exemple #7
0
 protected override void OnStartUp()
 {
     Plots[0].Pen.Width		= plot0Width;
     Plots[0].PlotStyle		= plot0Style;
     Plots[0].Pen.DashStyle	= dash0Style;
     Plots[1].Pen.Width		= plot1Width;
     Plots[1].PlotStyle		= plot1Style;
     Plots[1].Pen.DashStyle	= dash1Style;
     gap						= plot1Style == PlotStyle.Line || plot1Style == PlotStyle.Square;
     Plots[1].Pen.Color		= ShowStopLine ? Color.Gray : Color.Transparent;
     mm						= anaMovingMedian(Medians[0], periodMedian);
     mae						= ATR(Closes[0], periodAtr);
 }
		/// <summary>
		/// The anaMovingMedian (Simple Moving Average) is an indicator that shows the average value of a security's price over a period of time.
		/// </summary>
		/// <returns></returns>
		public anaMovingMedian anaMovingMedian(IDataSeries input, int period)
		{
			if (cacheanaMovingMedian != null)
				for (int idx = 0; idx < cacheanaMovingMedian.Length; idx++)
					if (cacheanaMovingMedian[idx].Period == period && cacheanaMovingMedian[idx].EqualsInput(input))
						return cacheanaMovingMedian[idx];

			lock (checkanaMovingMedian)
			{
				checkanaMovingMedian.Period = period;
				period = checkanaMovingMedian.Period;

				if (cacheanaMovingMedian != null)
					for (int idx = 0; idx < cacheanaMovingMedian.Length; idx++)
						if (cacheanaMovingMedian[idx].Period == period && cacheanaMovingMedian[idx].EqualsInput(input))
							return cacheanaMovingMedian[idx];

				var indicator = new anaMovingMedian();
				indicator.BarsRequired = BarsRequired;
				indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
				indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
				indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
				indicator.Input = input;
				indicator.Period = period;
				Indicators.Add(indicator);
				indicator.SetUp();

				var tmp = new anaMovingMedian[cacheanaMovingMedian == null ? 1 : cacheanaMovingMedian.Length + 1];
				if (cacheanaMovingMedian != null)
					cacheanaMovingMedian.CopyTo(tmp, 0);
				tmp[tmp.Length - 1] = indicator;
				cacheanaMovingMedian = tmp;
				return indicator;
			}
		}