Exemple #1
0
        public override void ApplyFormula()
        {
            this.Series = new List <Serie>();

            Serie volumeData = Candel.GetDataSerie(base.Data_Source, DataSourceFieldUsed.Volume, false);

            volumeData.Data = volumeData.Data.Where(x => x.Visible).ToList();
            Serie shortVolAverage = MA.ApplyFormula(volumeData, this.ShortRounds, "", SerieType.dashed);
            Serie longVolAverage  = MA.ApplyFormula(volumeData, this.LongRounds, "", SerieType.dashed);

            Serie serie = new Serie()
            {
                Color = this.Serie_Color, Serie_Type = SerieType.line, Column_Serie_ID = "vosc"
            };

            serie.Column_Data_Label = string.Format("VO {0}-{1}", this.ShortRounds, this.LongRounds);

            for (int i = 0; i < volumeData.Data.Count; i++)
            {
                serie.Data.Add(new SerieValue()
                {
                    Date  = volumeData.Data[i].Date,
                    Value = longVolAverage.Data[i].Value - shortVolAverage.Data[i].Value
                });
            }

            this.Series.Add(serie);
        }
Exemple #2
0
        public override void ApplyFormula()
        {
            this.Series = new List <Serie>();

            Serie serie = Candel.GetDataSerie(base.Data_Source, DataSourceFieldUsed.Stochastic, false, this.Rounds);

            serie.Color             = this.Serie_Color;
            serie.Serie_Type        = SerieType.line;
            serie.Column_Data_Label = "SO Fast";
            serie.Column_Serie_ID   = "osse";

            Serie average = MA.ApplyFormula(serie, 3, this.Serie_Average_Color, SerieType.dashed);

            average.Column_Data_Label = "MA(" + this.Rounds + ")";
            average.Column_Serie_ID   = "osav";

            //DateTime min_date = base.Data_Source.Select(x => x.Date).Min();
            //DateTime max_date = base.Data_Source.Select(x => x.Date).Max();

            serie.Data = serie.Data.Where(x => x.Visible).ToList();

            Serie oversold = new Serie()
            {
                Color = this.Serie_Bounded_Lines_Color, Serie_Type = SerieType.line, Column_Data_Label = "Sobre Venta", Column_Serie_ID = "osos"
            };
            Serie overbought = new Serie()
            {
                Color = this.Serie_Bounded_Lines_Color, Serie_Type = SerieType.line, Column_Data_Label = "Sobre Compra", Column_Serie_ID = "osob"
            };

            foreach (SerieValue serie_item in serie.Data)
            {
                oversold.Data.Add(new SerieValue()
                {
                    Date = serie_item.Date, Value = this.Oversold
                });
                overbought.Data.Add(new SerieValue()
                {
                    Date = serie_item.Date, Value = this.Overbought
                });
            }

            this.Series.Add(serie);
            this.Series.Add(average);
            this.Series.Add(oversold);
            this.Series.Add(overbought);
        }
Exemple #3
0
        public override void ApplyFormula()
        {
            this.Series = new List <Serie>();

            EMA emax = new EMA(base.Data_Source, this.Short_Term, "", false);
            EMA emay = new EMA(base.Data_Source, this.Long_Term, "", false);

            Serie serie = new Serie()
            {
                Color = this.Serie_Color, Serie_Type = SerieType.line, Column_Data_Label = "MACD", Column_Serie_ID = "macs"
            };
            Serie originalDataSource = Candel.GetDataSerie(base.Data_Source, DataSourceFieldUsed.Close, false);

            for (int i = 0; i < originalDataSource.Data.Count; i++)
            {
                serie.Data.Add(new SerieValue()
                {
                    Date    = originalDataSource.Data[i].Date,
                    Value   = (emax.Series[0].Data[i].Value - emay.Series[0].Data[i].Value),
                    Visible = originalDataSource.Data[i].Visible
                });
            }

            Serie average = MA.ApplyFormula(serie, this.Average_Term, this.Average_Serie_Color, SerieType.dashed);

            average.Column_Data_Label = "MA(" + this.Average_Term + ")";
            average.Column_Serie_ID   = "maca";

            serie.Data = serie.Data.Where(x => x.Visible).ToList();

            Serie zero_serie = new Serie()
            {
                Color = this.Zero_Serie_Color, Serie_Type = SerieType.line, Column_Data_Label = "Zero", Column_Serie_ID = "macz"
            };

            foreach (var item in serie.Data)
            {
                zero_serie.Data.Add(new SerieValue()
                {
                    Date = item.Date, Value = 0
                });
            }

            this.Series.Add(serie);
            this.Series.Add(average);
            this.Series.Add(zero_serie);
        }
Exemple #4
0
        public override void ApplyFormula()
        {
            this.Series = new List <Serie>();

            Serie closeData = Candel.GetDataSerie(base.Data_Source, DataSourceFieldUsed.Close, false);

            Serie serieMA1 = MA.ApplyFormula(closeData, this.ShortRounds, this.Serie_Color1, SerieType.line);

            serieMA1.Column_Data_Label = string.Format("CM {0}", this.ShortRounds);
            serieMA1.Column_Serie_ID   = "cma1";

            Serie serieMA2 = MA.ApplyFormula(closeData, this.LongRounds, this.Serie_Color2, SerieType.line);

            serieMA2.Column_Data_Label = string.Format("CM {0}", this.LongRounds);
            serieMA2.Column_Serie_ID   = "cma2";

            this.Series.Add(serieMA1);
            this.Series.Add(serieMA2);
        }