public ActionResult EnterDataEMA(EnterData enterData)
        {
            if (ModelState.IsValid)
            {
                if (enterData.StartDate >= enterData.EndDate)
                {
                    ViewBag.Message = "Start date should be younger than the end date!";
                    return(View());
                }
                this.EnterData(enterData);
                double          initSMA    = avgList.Last();
                double          multiplire = 2 / (enterData.Range + 1);
                double          EMA;
                List <double>   EMAList = new List <double>();
                List <DateTime> xaxis   = new List <DateTime>();

                for (int i = 0; i < avgList.Count; i++)
                {
                    EMA     = (closingList.Last() - initSMA) * multiplire + initSMA;
                    initSMA = initSMA + EMA;
                    EMAList.Add(EMA);
                    xaxis.Add(enterData.StartDate.AddDays(i));
                }

                ViewBag.B        = EMAList;
                ViewBag.DateList = xaxis;
                return(View());
            }

            return(View(enterData));
        }
示例#2
0
    public void StoreData(EnterData newData)
    {
        BinaryFormatter bf        = new BinaryFormatter();
        EnterData       enterData = newData;

        if (File.Exists(Application.persistentDataPath + "/SaveData.elohell"))
        {
            FileStream file = File.Create(Application.persistentDataPath + "/SaveData.elohell");

            bf.Serialize(file, enterData);

            file.Close();
        }
        else
        {
            FileStream file = File.Create(Application.persistentDataPath + "/SaveData.elohell");

            Nickname = nameInput.text;

            enterData.name            = nickname;
            enterData.firstTime       = false;
            enterData.spriteInt       = IconInt;
            enterData.leaguePoints    = LP;
            enterData.influencePoints = IP;
            bf.Serialize(file, enterData);
            file.Close();
        }
    }
            public _Enter(Enemy enemy, EnemyMoveDataBase data) : base(enemy, data)
            {
                _Data            = data as EnterData;
                _TargetDirection = Vector2.zero;
                var enemyPosition = (Vector2)Camera.main.WorldToViewportPoint(enemy.transform.position);

                if (enemyPosition.x < 0)
                {
                    _TargetDirection.x = 1;
                }
                if (enemyPosition.y > 1)
                {
                    _TargetDirection.y = -1;
                }
                if (enemyPosition.y < 0)
                {
                    _TargetDirection.y = 1;
                }
                if (enemyPosition.x > 1)
                {
                    _TargetDirection.x = -1;
                }

                if (_TargetDirection.x != 0 && _TargetDirection.y != 0)
                {
                    _TargetDirection = -enemy.transform.position.normalized;
                }
            }
示例#4
0
    public void GetData()
    {
        if (File.Exists(Application.persistentDataPath + "/SaveData.elohell"))
        {
            BinaryFormatter bf   = new BinaryFormatter();
            FileStream      file = File.Open(Application.persistentDataPath + "/SaveData.elohell", FileMode.Open);

            EnterData saveData = (EnterData)bf.Deserialize(file);
            Nickname  = saveData.name;
            showPanel = saveData.firstTime;
            LP        = saveData.leaguePoints;
            IP        = saveData.influencePoints;
            IconInt   = saveData.spriteInt;

            file.Close();
        }
    }
        public ActionResult EnterData(EnterData model)
        {
            if (ModelState.IsValid)
            {
                if (model.StartDate >= model.EndDate)
                {
                    ViewBag.Message = "Start date should be younger than the end date!";
                    return(View());
                }
                List <NewMarket> marketObject  = new List <NewMarket>();
                List <NewMarket> marketObject1 = new List <NewMarket>();
                List <DateTime>  dateslist     = new List <DateTime>();
                float[]          averages      = new float[4];
                List <DateTime>  dateList      = new List <DateTime>();
                DateTime         date1         = new DateTime(1899, 12, 30, 23, 59, 00);
                List <DateTime>  xaxis         = new List <DateTime>();

                marketObject = _context.NewMarkets.OrderBy(c => c.date).Where(c => c.type == model.Market && c.time == date1 && c.date >= model.StartDate && c.date <= model.EndDate).ToList();

                for (int i = 0; i < marketObject.Count; i++)
                {
                    closingList.Add(marketObject[i].closingPrice);
                }

                for (int j = 0; j <= closingList.Count - model.Range; j++)
                {
                    double sum = 0;
                    double avg = 0;
                    for (int i = j; i < j + model.Range; i++)
                    {
                        sum = sum + closingList[i];
                    }
                    avg = sum / model.Range;
                    avgList.Add(avg);
                    xaxis.Add(model.StartDate.AddDays(j));
                }

                ViewBag.A        = avgList;
                ViewBag.DateList = xaxis;
                return(View());
            }
            return(View(model));
        }
示例#6
0
 private void enterToolStripMenuItem_Click(object sender, EventArgs e)
 {
     var enterDataForm = new EnterData();
     var result        = enterDataForm.ShowForm();
 }