private void QuotingClick(object sender, RoutedEventArgs e)
        {
            var wnd = new QuotingWindow
            {
                //Security = SecurityPicker.SelectedSecurity,
            };

            if (!wnd.ShowModal(this))
            {
                return;
            }

            var quoting = new MarketQuotingStrategy(wnd.Side, wnd.Volume)
            {
                Security  = wnd.Security,
                Portfolio = wnd.Portfolio,
                Connector = MainWindow.Instance.Connector
            };

            if ((decimal?)TakeProfit.EditValue > 0 || (decimal?)StopLoss.EditValue > 0)
            {
                var tp = (decimal?)TakeProfit.EditValue;
                var sl = (decimal?)StopLoss.EditValue;

                quoting
                .WhenNewMyTrade()
                .Do(trade =>
                {
                    var tpStrategy = tp == null ? null : new TakeProfitStrategy(trade, tp.Value);
                    var slStrategy = sl == null ? null : new StopLossStrategy(trade, sl.Value);

                    if (tpStrategy != null && slStrategy != null)
                    {
                        var strategy = new TakeProfitStopLossStrategy(tpStrategy, slStrategy);
                        AddStrategy($"TPSL {trade.Trade.Price} Vol={trade.Trade.Volume}", strategy);
                    }
                    else if (tpStrategy != null)
                    {
                        AddStrategy($"TP {trade.Trade.Price} Vol={trade.Trade.Volume}", tpStrategy);
                    }
                    else if (slStrategy != null)
                    {
                        AddStrategy($"SL {trade.Trade.Price} Vol={trade.Trade.Volume}", slStrategy);
                    }
                })
                .Apply(quoting);
            }

            AddStrategy($"Quoting {quoting.Security} {wnd.Side} Vol={wnd.Volume}", quoting);
        }
        private void QuotingClick(object sender, RoutedEventArgs e)
        {
            var wnd = new StrategyAddWindow
            {
                //Security = SecurityPicker.SelectedSecurity,
            };

            if (!wnd.ShowModal(this))
            {
                return;
            }

            var security  = wnd.Security;
            var portfolio = wnd.Portfolio;

            var quoting = new MarketQuotingStrategy(wnd.Side, wnd.Volume);

            if (wnd.TakeProfit > 0 || wnd.StopLoss > 0)
            {
                var tp = wnd.TakeProfit;
                var sl = wnd.StopLoss;

                quoting
                .WhenNewMyTrade()
                .Do(trade =>
                {
                    var tpStrategy = tp == 0 ? null : new TakeProfitStrategy(trade, tp);
                    var slStrategy = sl == 0 ? null : new StopLossStrategy(trade, sl);

                    if (tpStrategy != null && slStrategy != null)
                    {
                        var strategy = new TakeProfitStopLossStrategy(tpStrategy, slStrategy);
                        AddStrategy($"TPSL {trade.Trade.Price} Vol={trade.Trade.Volume}", strategy, security, portfolio);
                    }
                    else if (tpStrategy != null)
                    {
                        AddStrategy($"TP {trade.Trade.Price} Vol={trade.Trade.Volume}", tpStrategy, security, portfolio);
                    }
                    else if (slStrategy != null)
                    {
                        AddStrategy($"SL {trade.Trade.Price} Vol={trade.Trade.Volume}", slStrategy, security, portfolio);
                    }
                })
                .Apply(quoting);
            }

            AddStrategy($"Quoting {quoting.Security} {wnd.Side} Vol={wnd.Volume}", quoting, security, portfolio);
        }