Ejemplo n.º 1
0
        /// <summary>Adds TechnicalData object to the indicator</summary>
        /// <param name="data">TechnicalData object to be added</param>
        public virtual void AddData(TechnicalData data)
        {
            _data.Add(data);

            if (_ready)
            {
                _data.RemoveAt(0);
            }

            if (_data.Count >= _longperiod)
            {
                double MACD = MovingAverage(_intperiod) - MovingAverage(_longperiod);
                _avgdata.Add((double)MACD);

                if (_avgdata.Count > _signalperiod + 1)
                {
                    _avgdata.RemoveAt(0);
                }
            }

            if (_data.Count > _longperiod + _signalperiod)
            {
                _ready = true;
                GenerateIndicator();
            }
        }
Ejemplo n.º 2
0
        /// <summary>Adds TechnicalData object to the indicator</summary>
        /// <param name="data">TechnicalData object to be added</param>
        public void AddData(TechnicalData data)
        {
            double current = data.AdjClose;

            if (_previous > 0)
            {
                if (!_ready)
                {
                    _data.Add(makeValue(current));

                    if (_data.Count >= _period)
                    {
                        _ready = true;
                        GenerateIndicator();
                    }
                }
                else
                {
                    _data.RemoveAt(0);
                    _data.Add(makeValue(current));
                    GenerateIndicator();
                }
            }

            _previous = current;
        }
Ejemplo n.º 3
0
        /// <summary>Adds TechnicalData object to the indicator</summary>

        /// <param name="data">TechnicalData object to be added</param>

        public virtual void AddData(TechnicalData data)
        {
            if (!_ready)
            {
                _data.Add(data);



                if (_data.Count > _period)
                {
                    _ready = true;

                    GenerateSignal();
                }
            }

            else
            {
                _data.RemoveAt(0);

                _data.Add(data);

                GenerateSignal();
            }
        }
Ejemplo n.º 4
0
 /// <summary>Adds TechnicalData object to the indicator</summary>
 /// <param name="data">TechnicalData object to be added</param>
 public virtual void AddData(TechnicalData data)
 {
     if (!_ready && data.Date >= DateTime.Now.Subtract(new TimeSpan(_period, 0, 0, 0)))
     {
         _signal = 1;
         _ready  = true;
     }
     else
     {
         _signal = 0;
     }
 }
Ejemplo n.º 5
0
        public static bool AddTechnicalData(TechnicalDataVM technicalDataVM)
        {
            var listte = new TechnicalData();

            listte.Id              = technicalDataVM.Id;
            listte.Numbersofdoors  = technicalDataVM.Numbersofdoors;
            listte.Numbersofplaces = technicalDataVM.Numbersofplaces;
            listte.EugineType      = technicalDataVM.EugineType;
            listte.EugineLocation  = technicalDataVM.EugineLocation;
            listte.EugineVolume    = technicalDataVM.EugineVolume;
            listte.BodyType        = technicalDataVM.BodyType;

            return(Repo.repo.AddTechnicalData(listte));
        }
Ejemplo n.º 6
0
 private bool topLower(int index)
 {
     if (index < _data.Count)
     {
         TechnicalData data2 = (TechnicalData)_data[index];
         for (int a = 1; a <= _cycle; a++)
         {
             TechnicalData data1 = (TechnicalData)_data[index - a];
             if (data2.AdjHigh < data1.AdjHigh)
             {
                 return(false);
             }
         }
         return(true);
     }
     return(false);
 }
Ejemplo n.º 7
0
        public bool AddTechnicalData(TechnicalData technicalData)
        {
            using (SqlConnection connectoin = new SqlConnection(connectionstring))
            {
                string     com1    = "INSERT INTO [dbo].[Technical_Data] (Id,Bodytype,Numbersofdoors,Numbersofplaces,Euginetype,Euginelocation,Euginevolume) VALUES (@Id,@Bodytype,@Numbersofdoors,@Numbersofplaces,@Euginetype,@Euginelocation,@Euginevolume)";
                SqlCommand comand1 = new SqlCommand(com1, connectoin);
                comand1.Parameters.AddWithValue("@Id", technicalData.Id);
                comand1.Parameters.AddWithValue("@Bodytype", technicalData.BodyType);
                comand1.Parameters.AddWithValue("@Numbersofdoors", technicalData.Numbersofdoors);
                comand1.Parameters.AddWithValue("@Numbersofplaces", technicalData.Numbersofplaces);
                comand1.Parameters.AddWithValue("@Euginetype", technicalData.EugineType);
                comand1.Parameters.AddWithValue("@Euginelocation", technicalData.EugineLocation);
                comand1.Parameters.AddWithValue("@Euginevolume", technicalData.EugineVolume);

                connectoin.Open();

                return(comand1.ExecuteNonQuery() == 1);
            }
        }
Ejemplo n.º 8
0
 private bool bottomHigher(int index)
 {
     if (index < _data.Count - _cycle)
     {
         TechnicalData data2 = (TechnicalData)_data[index];
         for (int a = 1; a <= _cycle; a++)
         {
             TechnicalData data1 = (TechnicalData)_data[index + a];
             if (data2.AdjLow > data1.AdjLow)
             {
                 return(false);
             }
         }
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 9
0
        /// <summary>Adds TechnicalData object to the indicator</summary>
        /// <param name="data">TechnicalData object to be added</param>
        public virtual void AddData(TechnicalData data)
        {
            double current = data.AdjClose;
            Value  v       = new Value(this, current);

            if (!_ready)
            {
                _data.Add(v);

                if (_data.Count >= _period)
                {
                    _ready = true;
                    GenerateIndicator(current);
                }
            }
            else
            {
                _data.RemoveAt(0);
                _data.Add(v);
                GenerateIndicator(current);
            }
        }
Ejemplo n.º 10
0
        /// <summary>Adds TechnicalData object to the indicator</summary>
        /// <param name="data">TechnicalData object to be added</param>
        public virtual void AddData(TechnicalData data)
        {
            double tp = data.AdjClose + data.AdjLow + data.AdjHigh;

            tp = tp / 3;
            double mf = tp * data.AdjVolume;

            if (!_ready)
            {
                _data.Add(new Value(this, mf, tp));
                if (_data.Count >= _period)
                {
                    _ready = true;
                    GenerateIndicator();
                }
            }
            else
            {
                _data.RemoveAt(0);
                _data.Add(new Value(this, mf, tp));
                GenerateIndicator();
            }
        }
Ejemplo n.º 11
0
        /// <summary>Adds TechnicalData object to the indicator</summary>
        /// <param name="data">TechnicalData object to be added</param>
        public void AddData(TechnicalData data)
        {
            double high = data.AdjHigh;
            double low  = data.AdjLow;

            if (!_ready)
            {
                _data.Add(MakeValue(high, low));
                if (_data.Count >= _period)
                {
                    _ready = true;
                    GenerateIndicator();
                }
            }
            else
            {
                _data.RemoveAt(0);
                _data.Add(MakeValue(high, low));
                GenerateIndicator();
            }

            _prevhigh = high;
            _prevlow  = low;
        }
Ejemplo n.º 12
0
 public bool AddTechnicalData(TechnicalData technicalData)
 {
     return(dal1.AddTechnicalData(technicalData));
 }
Ejemplo n.º 13
0
 /// <summary>Adds TechnicalData object to the indicator</summary>
 /// <param name="data">TechnicalData object to be added</param>
 public virtual void AddData(TechnicalData data)
 {
     _date = ((TechnicalData)data).Date;
     GenerateSignal();
 }