Пример #1
0
        /// <summary>
        /// constructor
        /// конструктор
        /// </summary>
        /// <param name="awesomeOscillator">configuration indicator/индикатор который будем настраивать</param>
        public AwesomeOscillatorUi(AwesomeOscillator awesomeOscillator)
        {
            InitializeComponent();
            _awesomeOscillatoro = awesomeOscillator;

            TextBoxLenghtLong.Text  = _awesomeOscillatoro.LenghtLong.ToString();
            TextBoxLenghtShort.Text = _awesomeOscillatoro.LenghtShort.ToString();

            HostColorUp.Child           = new TextBox();
            HostColorUp.Child.BackColor = _awesomeOscillatoro.ColorUp;

            HostColorDown.Child           = new TextBox();
            HostColorDown.Child.BackColor = _awesomeOscillatoro.ColorDown;

            CheckBoxPaintOnOff.IsChecked = _awesomeOscillatoro.PaintOn;

            ComboBoxMovingType.Items.Add(MovingAverageTypeCalculation.Exponential);
            ComboBoxMovingType.Items.Add(MovingAverageTypeCalculation.Simple);
            ComboBoxMovingType.Items.Add(MovingAverageTypeCalculation.Weighted);

            ComboBoxMovingType.SelectedItem = _awesomeOscillatoro.TypeCalculationAverage;

            ButtonColorUp.Content             = OsLocalization.Charts.LabelButtonIndicatorColorUp;
            ButtonColorDown.Content           = OsLocalization.Charts.LabelButtonIndicatorColorDown;
            CheckBoxPaintOnOff.Content        = OsLocalization.Charts.LabelPaintIntdicatorIsVisible;
            ButtonAccept.Content              = OsLocalization.Charts.LabelButtonIndicatorAccept;
            LabelIndicatorLongPeriod.Content  = OsLocalization.Charts.LabelIndicatorLongPeriod;
            LabelIndicatorShortPeriod.Content = OsLocalization.Charts.LabelIndicatorShortPeriod;
            LabelIndicatorMethod.Content      = OsLocalization.Charts.LabelIndicatorMethod;
        }
Пример #2
0
        /// <summary>
        /// рассчитать индикатор
        /// </summary>
        /// <param name="candles">свечи</param>
        public void Process(List <Candle> candles)
        {
            _myCandles = candles;

            if (_ao == null)
            {
                _ao             = new AwesomeOscillator(false);
                _ao.LenghtLong  = LenghtLong;
                _ao.LenghtShort = LenghtShort;

                _movingAverage        = new MovingAverage(false);
                _movingAverage.Lenght = LenghtShort;
            }

            _ao.Process(candles);
            _movingAverage.Process(_ao.Values);

            if (Values != null &&
                Values.Count + 1 == candles.Count)
            {
                ProcessOne(candles);
            }
            else if (Values != null &&
                     Values.Count == candles.Count)
            {
                ProcessLast(candles);
            }
            else
            {
                ProcessAll(candles);
            }
        }
Пример #3
0
        /// <summary>
        /// конструктор
        /// </summary>
        /// <param name="awesomeOscillator">индикатор который будем настраивать</param>
        public AwesomeOscillatorUi(AwesomeOscillator awesomeOscillator)
        {
            InitializeComponent();
            _awesomeOscillatoro = awesomeOscillator;

            TextBoxLenghtLong.Text  = _awesomeOscillatoro.LenghtLong.ToString();
            TextBoxLenghtShort.Text = _awesomeOscillatoro.LenghtShort.ToString();

            HostColorUp.Child           = new TextBox();
            HostColorUp.Child.BackColor = _awesomeOscillatoro.ColorUp;

            HostColorDown.Child           = new TextBox();
            HostColorDown.Child.BackColor = _awesomeOscillatoro.ColorDown;

            CheckBoxPaintOnOff.IsChecked = _awesomeOscillatoro.PaintOn;

            ComboBoxMovingType.Items.Add(MovingAverageTypeCalculation.Exponential);
            ComboBoxMovingType.Items.Add(MovingAverageTypeCalculation.Simple);
            ComboBoxMovingType.Items.Add(MovingAverageTypeCalculation.Weighted);

            ComboBoxMovingType.SelectedItem = _awesomeOscillatoro.TypeCalculationAverage;
        }
Пример #4
0
        /// <summary>
        /// прогрузить с самого начала
        /// </summary>
        private void ProcessAll(List <Candle> candles)
        {
            if (candles == null)
            {
                return;
            }
            Values = new List <decimal>();

            _ao             = new AwesomeOscillator(false);
            _ao.LenghtLong  = LenghtLong;
            _ao.LenghtShort = LenghtShort;

            _ao.Process(candles);

            _movingAverage        = new MovingAverage(false);
            _movingAverage.Lenght = LenghtShort;
            _movingAverage.Process(_ao.Values);

            for (int i = 0; i < candles.Count; i++)
            {
                Values.Add(GetValue(i));
            }
        }