protected override void OnCalculate() { EMA ema = EMA(this.Period); double bull_power = High[0] - ema[0]; double bear_power = Low[0] - ema[0]; ds_bull_power.Set(bull_power); ds_bear_power.Set(bear_power); int resultsignal = 0; if (ema[0] > ema[1] && bear_power < 0 && bear_power > ds_bear_power.Get(1)) { resultsignal = 1; } if (ema[0] < ema[1] && bull_power > 0 && bull_power < ds_bull_power.Get(1)) { resultsignal = -1; } Occurred.Set(resultsignal); PlotColors[0][0] = this.Plot0Color; OutputDescriptors[0].PenStyle = this.Dash0Style; OutputDescriptors[0].Pen.Width = this.Plot0Width; PlotColors[1][0] = this.Plot1Color; OutputDescriptors[1].PenStyle = this.Dash1Style; OutputDescriptors[1].Pen.Width = this.Plot1Width; }
protected override void OnCalculate() { EMA ema = EMA(this.Period); double bull_power = High[0] - ema[0]; double bear_power = Low[0] - ema[0]; ds_bull_power.Set(bull_power); ds_bear_power.Set(bear_power); if (_ElderRayTyp == ElderRayTyp.BullPower) { MyPlot1.Set(bull_power); } else { MyPlot2.Set(bear_power); } //Set the color if (ema[0] > ema[1]) { PlotColors[0][0] = Color.Green; OutputDescriptors[0].Pen.Width = 2; } else { PlotColors[0][0] = Color.Red; OutputDescriptors[0].Pen.Width = 1; } OutputDescriptors[0].PenStyle = DashStyle.Solid; OutputDescriptors[0].OutputSerieDrawStyle = OutputSerieDrawStyle.Bar; if (ema[0] < ema[1]) { PlotColors[1][0] = Color.Red; OutputDescriptors[1].Pen.Width = 2; } else { PlotColors[1][0] = Color.Green; OutputDescriptors[1].Pen.Width = 1; } OutputDescriptors[1].PenStyle = DashStyle.Solid; OutputDescriptors[1].OutputSerieDrawStyle = OutputSerieDrawStyle.Bar; if (ema[0] > ema[1] && bear_power <0 && bear_power> ds_bear_power.Get(1)) { AddChartArrowUp("ArrowLong" + Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].Low, Color.LightGreen); } if (ema[0] < ema[1] && bull_power > 0 && bull_power < ds_bull_power.Get(1)) { AddChartArrowDown("ArrowShort" + Bars[0].Time.Ticks, this.IsAutoAdjustableScale, 0, Bars[0].High, Color.Red); } }