Exemple #1
0
 /// ////////////////////////////////////////////////////////////////////////////////////////////////
 ///
 ///                             Send Shares to Chart Trader
 ///
 /// ////////////////////////////////////////////////////////////////////////////////////////////////
 protected void sendSharesToCT(double stops, double targets)
 {
     //find chart trader from myChart's Chart Control by its Automation ID: "ChartWindowChartTrader"
     chartTrader = Window.GetWindow(myChart.ActiveChartControl.Parent).FindFirst("ChartWindowChartTraderControl") as Gui.Chart.ChartTrader;
     //chartTrader.SetCurrentValue(order
     if (chartTrader == null)
     {
         return;
     }
     /// Here is an example of changing a stop:
     ///AtmStrategyChangeStopTarget(0, stops, "Stop1", atmStrategyId);
     /// Here is an example of changing a profit target:
     ///AtmStrategyChangeStopTarget(targets, 0, "Target1", atmStrategyId);
 }
Exemple #2
0
        protected void CreateWPFControls()
        {
            chartWindow = System.Windows.Window.GetWindow(ChartControl.Parent) as Chart;
            chartGrid   = chartWindow.MainTabControl.Parent as System.Windows.Controls.Grid;
            chartTrader = chartWindow.FindFirst("ChartWindowChartTraderControl") as Gui.Chart.ChartTrader;

            buttonGrid = new System.Windows.Controls.Grid();

            buttonGrid.RowDefinitions.Add(new System.Windows.Controls.RowDefinition()
            {
                Height = new GridLength(50)
            });
            buttonGrid.RowDefinitions.Add(new System.Windows.Controls.RowDefinition()
            {
                Height = new GridLength(50)
            });
            buttonGrid.RowDefinitions.Add(new System.Windows.Controls.RowDefinition()
            {
                Height = new GridLength(50)
            });

            System.Windows.Controls.TextBlock label = new System.Windows.Controls.TextBlock()
            {
                FontFamily          = ChartControl.Properties.LabelFont.Family,
                FontSize            = 13,
                Foreground          = ChartControl.Properties.ChartText,
                HorizontalAlignment = HorizontalAlignment.Center,
                Margin = new Thickness(5, 5, 5, 5),
                Text   = string.Format("{0} {1} {2}", Instrument.FullName, BarsPeriod.Value, BarsPeriod.BarsPeriodType)
            };

            System.Windows.Controls.Grid.SetRow(label, 0);
            buttonGrid.Children.Add(label);

            button1 = new System.Windows.Controls.Button()
            {
                Content             = "Button 1",
                HorizontalAlignment = HorizontalAlignment.Center
            };
            button1.Click += Button1_Click;

            System.Windows.Controls.Grid.SetRow(button1, 1);
            buttonGrid.Children.Add(button1);

            button2 = new System.Windows.Controls.Button()
            {
                Content             = "Button 2",
                HorizontalAlignment = HorizontalAlignment.Center
            };
            button2.Click += Button2_Click;

            System.Windows.Controls.Grid.SetRow(button2, 2);
            buttonGrid.Children.Add(button2);

            if (TabSelected())
            {
                InsertWPFControls();
            }

            chartWindow.MainTabControl.SelectionChanged += TabChangedHandler;
        }