protected override void CalcBar() { var m_avg = m_averagefc1[0]; var m_sdev = bollingerprice.StandardDeviationCustom(length, 1); m_upperband.Value = (m_avg + (numdevsup * m_sdev)); m_lowerband.Value = (m_avg + (numdevsdn * m_sdev)); if (((displace >= 0) || Bars.CurrentBar > Math.Abs(displace))) { Plot1.Set(displace, m_upperband.Value); Plot2.Set(displace, m_lowerband.Value); Plot3.Set(displace, m_avg); m_IndicatorArea.SetValue("UpperBand", m_upperband.Value, Bars.TimeValue.ToBinary()); m_IndicatorArea.SetValue("LowerBand", m_lowerband.Value, Bars.TimeValue.ToBinary()); if ((displace <= 0)) { if (this.CrossesOver(testpricelband, m_lowerband)) { Alerts.Alert("Price crossing over lower price band"); } else { if (this.CrossesUnder(testpriceuband, m_upperband)) { Alerts.Alert("Price crossing under upper price band"); } } } } ChartCustomDraw.ReDraw(); }
protected override void CalcBar() { if (Bars.LastBarInSession) { m_upperband.Value = (Bars.Close[0] * (1 + (numdevs * volstddev[0] / Math.Sqrt(252)))); m_lowerband.Value = (Bars.Close[0] * (1 - (numdevs * volstddev[0] / Math.Sqrt(252)))); } else { m_upperband.Value = (Bars.Close[1] * (1 + (numdevs * volstddev[0] / Math.Sqrt(252)))); m_lowerband.Value = (Bars.Close[1] * (1 - (numdevs * volstddev[0] / Math.Sqrt(252)))); } Plot1.Set(0, m_upperband.Value); Plot2.Set(0, m_lowerband.Value); m_IndicatorArea.SetValue("UpperBand", m_upperband.Value, Bars.TimeValue.ToBinary()); m_IndicatorArea.SetValue("LowerBand", m_lowerband.Value, Bars.TimeValue.ToBinary()); ChartCustomDraw.ReDraw(); }
protected override void CalcBar() { if (delta) { m_upperband.Value = Bars.Close[1] + multiplier * mean_absolute_difference_delta_fn[1]; m_lowerband.Value = Bars.Close[1] - multiplier * mean_absolute_difference_delta_fn[1]; } else { m_upperband.Value = Bars.Close[1] + multiplier * mean_absolute_difference_fn[1]; m_lowerband.Value = Bars.Close[1] - multiplier * mean_absolute_difference_fn[1]; } Plot1.Set(0, m_upperband.Value); Plot2.Set(0, m_lowerband.Value); m_IndicatorArea.SetValue("UpperBand", m_upperband.Value, Bars.TimeValue.ToBinary()); m_IndicatorArea.SetValue("LowerBand", m_lowerband.Value, Bars.TimeValue.ToBinary()); ChartCustomDraw.ReDraw(); }