Пример #1
0
        /// <summary>
        /// проверить, не редактируется ли сейчас Алерт
        /// </summary>
        private void CheckAlert()
        {
            try
            {
                if (_alertChartUi == null)
                {
                    return;
                }

                int     numberCandle = 0;
                decimal pricePoint;

                try // костыль не всегда помогает
                {
                    ChartArea candleArea = _chartMaster.GetChartArea("Prime");

                    numberCandle = Convert.ToInt32(candleArea.CursorX.Position);
                    pricePoint   = Convert.ToDecimal(candleArea.CursorY.Position);
                    candleArea.CursorY.Position = double.NaN;
                }
                catch (Exception)
                {
                    return;
                    // ignore
                }

                _alertChartUi.SetFormChart(_connector.Candles(false), numberCandle, pricePoint);
            }
            catch (Exception error)
            {
                SendNewMessage(error.ToString(), LogMessageType.Error);
            }
        }
Пример #2
0
        /// <summary>
        /// конструктор
        /// </summary>
        /// <param name="chartMaster">класс менеджер индикаторов</param>
        public IndicarotCreateUi(ChartMaster chartMaster)
        {
            InitializeComponent();
            _chartMaster = chartMaster;

            _gridViewIndicators = new DataGridView();

            HostNames.Child = _gridViewIndicators;

            _gridViewIndicators.AllowUserToOrderColumns = false;
            _gridViewIndicators.AllowUserToDeleteRows   = false;
            _gridViewIndicators.AllowUserToAddRows      = false;
            _gridViewIndicators.AllowUserToResizeRows   = false;
            _gridViewIndicators.RowHeadersVisible       = false;
            _gridViewIndicators.ReadOnly = true;
            _gridViewIndicators.AllowUserToResizeColumns = false;

            DataGridViewColumn column = new DataGridViewColumn();

            column.HeaderText   = @"Тип индикатора";
            column.CellTemplate = new DataGridViewTextBoxCell();
            column.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            _gridViewIndicators.Columns.Add(column);

            _gridViewIndicators.Rows.Add("Adaptive Look Back");
            _gridViewIndicators.Rows.Add("ADX");
            _gridViewIndicators.Rows.Add("ATR");
            _gridViewIndicators.Rows.Add("Alligator");
            _gridViewIndicators.Rows.Add("AO");
            _gridViewIndicators.Rows.Add("AC");
            _gridViewIndicators.Rows.Add("AccumulationDistribution");
            _gridViewIndicators.Rows.Add("Bollinger");
            _gridViewIndicators.Rows.Add("BFMFI");
            _gridViewIndicators.Rows.Add("BullsPower");
            _gridViewIndicators.Rows.Add("BearsPower");
            _gridViewIndicators.Rows.Add("CMO");
            _gridViewIndicators.Rows.Add("CCI");
            _gridViewIndicators.Rows.Add("Envelops");
            _gridViewIndicators.Rows.Add("Efficiency Ratio");
            _gridViewIndicators.Rows.Add("Fractal");
            _gridViewIndicators.Rows.Add("Force Index");
            _gridViewIndicators.Rows.Add("OnBalanceVolume");
            _gridViewIndicators.Rows.Add("Ichimoku");
            _gridViewIndicators.Rows.Add("IvashovRange");
            _gridViewIndicators.Rows.Add("KalmanFilter"); // сюда добавить новый индикатор чтоб он стал доступен для выбора
            _gridViewIndicators.Rows.Add("Moving Average");
            _gridViewIndicators.Rows.Add("MACD Histogram");
            _gridViewIndicators.Rows.Add("MACD Line");
            _gridViewIndicators.Rows.Add("Momentum");
            _gridViewIndicators.Rows.Add("MoneyFlowIndex");
            _gridViewIndicators.Rows.Add("Parabolic SAR");
            _gridViewIndicators.Rows.Add("Price Channel");
            _gridViewIndicators.Rows.Add("Price Oscillator");
            _gridViewIndicators.Rows.Add("Pivot");
            _gridViewIndicators.Rows.Add("Pivot Points");
            _gridViewIndicators.Rows.Add("StochasticOscillator");
            _gridViewIndicators.Rows.Add("RSI");
            _gridViewIndicators.Rows.Add("ROC");
            _gridViewIndicators.Rows.Add("RVI");
            _gridViewIndicators.Rows.Add("Standard Deviation");
            _gridViewIndicators.Rows.Add("Trix");
            _gridViewIndicators.Rows.Add("TradeThread");
            _gridViewIndicators.Rows.Add("Unk");
            _gridViewIndicators.Rows.Add("VerticalHorizontalFilter");
            _gridViewIndicators.Rows.Add("Volume Oscillator");
            _gridViewIndicators.Rows.Add("Volume");
            _gridViewIndicators.Rows.Add("WilliamsRange");

            if (_chartMaster.GetChartArea("TradeArea") == null)
            {
                _gridViewIndicators.Rows.Add("Trades");
            }

            _gridViewIndicators.SelectionChanged += gridViewIndicators_SelectionChanged;


            _gridViewAreas = new DataGridView();

            HostArea.Child = _gridViewAreas;

            _gridViewAreas.AllowUserToOrderColumns = false;
            _gridViewAreas.AllowUserToDeleteRows   = false;
            _gridViewAreas.AllowUserToAddRows      = false;
            _gridViewAreas.AllowUserToResizeRows   = false;
            _gridViewAreas.RowHeadersVisible       = false;
            _gridViewAreas.ReadOnly = true;
            _gridViewAreas.AllowUserToResizeColumns = false;

            DataGridViewColumn column1 = new DataGridViewColumn();

            column1.HeaderText   = @"Окна на графике";
            column1.CellTemplate = new DataGridViewTextBoxCell();
            column1.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            _gridViewAreas.Columns.Add(column1);

            string[] areas = chartMaster.GetChartAreas();

            for (int i = 0; i < areas.Length; i++)
            {
                if (areas[i] != "TradeArea")
                {
                    _gridViewAreas.Rows.Add(areas[i]);
                }
            }

            _gridViewAreas.Rows.Add("NewArea");
        }