Exemple #1
0
        private void button_Save_Click(object sender, System.EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox_EMAPeriods.Text))
            {
                label_EMAPeriods.ForeColor = Color.Red;
            }

            if (textBox_EMAColor.BackColor == Color.White)
            {
                label_EMAColor.ForeColor = Color.Red;
            }

            if (textBox_EMAColor.BackColor != Color.White && !string.IsNullOrEmpty(textBox_EMAPeriods.Text))
            {
                var period = int.Parse(textBox_EMAPeriods.Text);
                var points = EMA.CalculateEMA(_state.SelectedCurrencyInfo, period).Cast <SimpleDateValue>().ToList();
                _state.Curves.Add((Core.Interfaces.ICurve) new EMACurve
                {
                    Display      = true,
                    Period       = period,
                    Points       = points,
                    DisplayColor = textBox_EMAColor.BackColor
                });
            }
        }
Exemple #2
0
 public void RecalculateValues(List <SimpleDateValue> currentCurrencyValues)
 {
     if (Display)
     {
         var emaPoints = EMA.CalculateEMA(currentCurrencyValues, Period);
         Points.Clear();
         Points.AddRange(emaPoints);
     }
 }