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);
            }
        }
        protected override void OnCalculate()
        {
            if (this.MA_1 != 0 && this.MA_1 > this.RequiredBarsCount)
            {
                AddChartTextFixed("AlertText", "Required bars must be at least as high as the moving average period.", TextPosition.Center, Color.Red, new Font("Arial", 30), Color.Red, Color.Red, 20);
            }

            double resulti = (this.GetValue(this.MA_1_Selected, this.MA_1, 0) - this.GetValue(this.MA_1_Selected, this.MA_1, 1)) / StdDev(this.MA_1)[0] * 100;

            MyPlot1.Set(resulti);
            MyPlot2.Set(0);
        }
Esempio n. 3
0
 protected override void OnCalculate()
 {
     MyPlot1.Set(Normalize(Closes[i1].ToList(), Closes[i1][0]));
     MyPlot2.Set(Normalize(Closes[i2].ToList(), Closes[i2][0]));
 }