Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problems with the detection ChartTrader

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Problems with the detection ChartTrader

    Code:
    System.Windows.Controls.Grid chartGrid2 = (Window.GetWindow(ChartControl.Parent).FindFirst("ChartWindowChartTraderControl") as ChartTrader).Parent as System.Windows.Controls.Grid;
    This code works fine when you first start.

    Then if you remove ChartTrader from the chart, this code still shows the presence of ChartTrader on the chart

    #2
    Hello,

    Thank you for the question.

    I wanted to check, are you trying to determine when the chart trader is open and enabled vs closed and enabled vs closed and disabled?

    The visibility of the control is being toggled rather than the control being actually removed so there should still be an instance on the actual parent control.

    If you can tell me what the end result you are expecting is, I could see if there is a better way to accomplish that.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      open and enabled vs closed and disabled

      chartGrid2 should be null if ChartTrader is disabled

      I want to know is whether cartrader now on the chart

      Ideally, of course know all 3 states: off, on, hidden
      Last edited by vladko; 08-09-2016, 04:42 PM.

      Comment


        #4
        Hello,

        To know if the ChartTrader is Enabled vs Hidden vs Disabled you could check the ChartTraderVisibility of the ChartTrader object rather than checking for null.

        Here is a sample with the output:

        Code:
        ChartControl.Dispatcher.InvokeAsync((Action)(() => {  
        		ChartTrader trader = Window.GetWindow(ChartControl.Parent).FindFirst("ChartWindowChartTraderControl") as ChartTrader;
        		if(trader!= null)
        		{
        			Print(trader.ChartTraderVisibility.ToString());	
        			//Open    = Visible
        			//Hidden  = VisibleCollapsed
        			//Closed  = Collapsed
        		}
        	}));
        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          OK, Thank You

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by chbruno, 04-24-2024, 04:10 PM
          3 responses
          47 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by samish18, Today, 01:01 PM
          1 response
          6 views
          0 likes
          Last Post NinjaTrader_LuisH  
          Started by WHICKED, Today, 12:56 PM
          1 response
          8 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by cre8able, Today, 01:16 PM
          1 response
          3 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by WHICKED, Today, 12:45 PM
          1 response
          11 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X