/// <summary> /// Инициализация панели с контроля сделки /// </summary> private void InitPanelControl() { numericUpDownMCPriceLastTrade.InitSecurity(Securities); numericUpDownMCStopTiks.InitWheelDecimal(0, 1000, 1, 0); numericUpDownMCTakeProfitTiks.InitWheelDecimal(0, 1000, 1, 0); //Получаем сохраненные данные numericUpDownMCStopTiks.Value = SettingsDepth.Get("TiksControlStop"); numericUpDownMCTakeProfitTiks.Value = SettingsDepth.Get("TiksControlTake"); numericUpDownMCStopTiks.ValueChanged += (s, e) => { SettingsDepth.Set("TiksControlStop", (int)numericUpDownMCStopTiks.Value); }; numericUpDownMCTakeProfitTiks.ValueChanged += (s, e) => { SettingsDepth.Set("TiksControlTake", (int)numericUpDownMCTakeProfitTiks.Value); }; //ВЫставляем флажок на сохраненном проценте foreach (var percent in PERCENT) { var objRadio = GetRadioButtonByPercent(percent); if (objRadio.NotIsNull()) { if (percent == SettingsDepth.Get("PercentTakeOut")) { objRadio.Checked = true; } objRadio.CheckedChanged += (s, e) => { SettingsDepth.Set("PercentTakeOut", percent); }; } } buttonMCClose.Click += (s, e) => { var sOrders = GetStopOrdersForControl(); foreach (var sOrd in sOrders) { Trader.CancelStopOrder(sOrd); } }; buttonMCReset.Click += (s, e) => { LoopControl(true); }; buttonACPriceUp.Click += (s, e) => { numericUpDownMCStopTiks.Value++; numericUpDownMCTakeProfitTiks.Value = numericUpDownMCTakeProfitTiks.Value > 0 ? numericUpDownMCTakeProfitTiks.Value - 1 : 0; }; buttonACPriceDown.Click += (s, e) => { numericUpDownMCStopTiks.Value = numericUpDownMCStopTiks.Value > 0 ? numericUpDownMCStopTiks.Value - 1 : 0; numericUpDownMCTakeProfitTiks.Value++; }; }
private void numericUpDownMAPeriod_ValueChanged(object sender, EventArgs e) { var value = Convert.ToInt32(numericUpDownMAPeriod.Value); SettingsDepth.SetTF(CurrentTimeFrame.Period, "MovingAverage", value); GraphicStock.Indicators.ForEach((ind) => { if (ind is MovingAverage) { ((MovingAverage)ind).SetPeriod(value); } }); UpdateGraphic(); }
private void buttonDec_Click(object sender, EventArgs e) { var obj = (Control)sender; var ConstMin = 10; var val = 1; if (obj.Tag.NotIsNull()) { val = (int)obj.Tag; } this.CountCandleInGraphic += (int)(this.CountCandleInGraphic / ConstMin) + val; if (this.CountCandleInGraphic > 1500) { this.CountCandleInGraphic = 1500; } SettingsDepth.SetTF(TimeFrameUse.Value, "CountVisibleCandle", CountCandleInGraphic); UpdateGraphic(); }
/// <summary> Инициализация нового инструмента в текущем окне. Сброс на новый инструмент.</summary> private void InitReset() { this.SetHead(Securities); //Загружаем настройки по инструменту //SettingsDepth.ReloadSecurity(Securities.ToString()); SettingsDepth.InitTimeFrame(StorageTimeFrames.TIME_FRAMES); //Инициализация всех панелей InitAllPanels(); //Регистрация стакана Trader.RegisterDepth(Securities); //цена для заявки numericUpDownPrice.InitSecurity(Securities); numericUpDownPrice.Value = 0; //Стоп цена numericUpDownStopPrice.InitSecurity(Securities); numericUpDownStopPrice.Value = 0; //Дата эксписрациия стоп заявки dateTimePickerStopOrder.Value = DateTime.Now.AddDays(SettingsDepth.Get("CountDaysForStopOrder")); //Получаем значение последней стоп-заявки if (LastStopOrder.NotIsNull()) { numericUpDownStopPrice.Value = LastStopOrder.ConditionPrice; dateTimePickerStopOrder.Value = DateTime.Now.AddDays(SettingsDepth.Get("CountDaysForStopOrder")); } //Настройки графика this.GraphicStock = new Graphic(); this.GraphicStock.InitEvents(); this.GraphicStock.SetObjectPaint(this.pictureBoxGraphic); this.GraphicStock.Init(Securities); this.GraphicStock.TimeFrame = CurrentTimeFrame; this.GraphicStock.DataSourceLevels = this.Levels.ObjectCollection; this.GraphicStock.ResetActiveCandles(); GraphicStock.OnNotFullGraphic += (curValue, all) => { if (all - curValue > 5) { CurrentTimeFrame.Candles.Load(); } }; UpdateGraphic(); InitGraphicSignals(); this.GraphicStock.Levels.OnNewLevel += (newLevel) => { this.Levels.Add(newLevel); this.UpdatePanelLevels(); }; this.GraphicStock.OnCandleLeftMouseUp += (point, candle) => { ResetButtonLevels(); }; //Скрол для графика hScrollGraphic.Value = hScrollGraphic.Maximum; //Clear depth dataGridViewDepth.Rows.Clear(); this.ArraySell = null; this.ArrayBuy = null; EventAnyOrder(null, true); pictureBoxGraphic.Refresh(); }