• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Select window and then tab that indicator is running on

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

    Select window and then tab that indicator is running on

    Hi,

    In a situation where I have multiple windows with multiple tabs open on each window, I am trying to have code within an indicator that will find and focus on the tab with the indicator running then use the SendKey.Wait method.

    I am unable to get the tab to become focussed in the first instance.

    I am using .Focus() within a dispatcher then checking using .IsFocused however I cannot get IsFocused to become true.

    Can you please suggest the correct use of code to focus on the tab with the indicator running please.

    Thanks

    #2
    My current attempt is as follows, but it doesn't results in IsTabFocussed being false;

    __________________________________________________ _______________________________-



    private NinjaTrader.Gui.Chart.ChartTab chartTab;
    private Chart chartWindow;
    private System.Windows.Controls.TabItem tabItem;



    protected override void OnBarUpdate()
    {

    ChartControl.Dispatcher.InvokeAsync((Action)(() =>
    {

    chartWindow = Window.GetWindow(this.ChartControl.Parent) as Chart;
    if(chartWindow==null)
    {
    Print("chartWindow== null");
    return;
    }

    foreach (System.Windows.Controls.TabItem tab in chartWindow.MainTabControl.Items)
    if ((tab.Content as ChartTab).ChartControl == ChartControl && tab == chartWindow.MainTabControl.SelectedItem)
    tabItem=tab;

    if (tabItem == null)
    return;

    chartTab = tabItem.Content as NinjaTrader.Gui.Chart.ChartTab;
    if (chartTab == null)
    return;

    chartTab.Focus();

    Print(chartTab.IsFocused);


    }));

    }

    Comment


      #3
      Hello b16_aln,

      This would be far outside of what is documented or supported by NinjaTrader but may be possible.

      This thread will remain open for any community members that would like to assist.


      I have a few indicators that can recognize if the chartcontrol they are added to is the one in focus you may find helpful.
      https://ninjatrader.com/support/foru...ions#post96376
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Hi Chelsea,

        Yes, I used your rollover indictor as the basis for my attempt at the code, so thank you for that, however I was unable to get it to work as I intended. I think I know how I need to the code to differ but was unable to implement it hence reaching out for help, very glad it was you that responded!

        I don't think I am too far off what I want to achieve and hoped you could help.

        The first difference and confusion for me is transforming parts of the rollover code so that it doesn;t work based on a button and click event and is instead triggered by an IF statement. I'm not sure how to ammend the RolloverBtn_Click method so that I can use it based on and IF statement, I think the use of an object sender in the method initiator is the problem for me. Could you please suggest how to edit the method for use with an IF statement instead? I can then use that to send the keys I want to use.

        Secondly, i can use TabSelected to ensure I'm on the correct chart, however the TabChangedHandler works to check that the tab i've manually selected is the correct tab so this is no good for what i'm looking for however I believe it used a lot of the same concepts so I hoped to be able to modify and it get it to where I need it to be. In the simplest of explanations I am only looking to find, activate and focus on the tab with the indicator running so si can then use your version of send keys (RolloverBtn_Click). I thought it might be as easy as using ChartControl.OwnerChart.Focus() however that doesn;t appear to work so I thought I would need to do something similar to the TabChangedHandler but instead of reacting to a manual change in tab selection I wanted it to find the correct tab, possibly by looping through all open tabs and windows and until TabSelected ==true.

        I would really appreciate your help if you have the time.

        Thanks




        Comment


          #5
          Hello b16_aln,

          When do you want the code to be evaluated?
          Put the code in the action block for that event or action in an if statement.

          I do not have any suggestions for changing the selected tab on a chart which is not supported by NinjaTrader.

          This thread will remain open for any community members that would like to suggest unsupported code to achieve this.

          You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
          Chelsea B.NinjaTrader Customer Service

          Comment


            #6
            Rollover indicator isn't supported by NinjaTrader but you give plenty of advice on that. In fact, there are numerous examples of you giving advice on code not supported by ninjatrader.

            You've been of not help at all, your colleagues are much more helpful.

            I'll make your employers aware of your poor customer service as I'm sure they take the service received by their paying customers a lot more seriously than you appear to do.

            Comment


              #7
              Hello b16_aln,

              Specifically, changing the selected tab on a chart is not supported.

              The Rollover indications indicator does not do this, however the rollover indications does use unsupported code to send key presses to change the instrument which officially is not supported by NinjaTrader.

              See another forum post where a colleague of mine is also stating this is not supported.
              https://ninjatrader.com/support/foru...100#post772100

              Please note as you report my behavior, that you are specifically asking for code that is not supported or documented. Also, please include a link to this forum thread.
              Last edited by NinjaTrader_ChelseaB; 03-31-2020, 11:33 AM.
              Chelsea B.NinjaTrader Customer Service

              Comment


                #8
                So you pick and choose what unsupported questions you are willing to help with? I assume this is based on your general mood at the time and what you can be bothered doing?

                I notice others have questioned your attitude in the past so I'm sure this will not be the first time your employers will have received poor feedback on your customer service skills. You may be a good coder, but your customer service skills in supporting paying customers falls woefully short...which appears to be what your job is.

                Comment


                  #9
                  Hello b16_aln,

                  When it comes to unsupported code, if I know of something that may work that is undocumented but I can provide a resource or a link to a 3rd party site I will. In this case I don't know of a way to achieve what you are asking and I have nothing to suggest. As its unsupported, you will need to work out something on your own if there is a way, or you can submit a feature request for our development to put under consideration.

                  I apologize you feel that I am presenting a bad attitude. I am very happy to assist with any documented NinjaScript you have questions about and I am not intentionally attempting to be rude or use bad language. However, my job is to assist with developers in understanding supported tools in the help guide and due to resource constraints am I not allowed to fully support unsupported items.

                  Our standard spiel is below:

                  Unfortunately, in the support department at NinjaTrader it is against our policy to create, debug, or modify, code or logic for our clients. This is so that we can maintain a high level of service for all of our clients as well as our partners.

                  We do have a large ecosystem available to help you with unsupported code or programming logic questions. You can post on our forum and ask the other 40,000+ forum members.
                  https://ninjatrader.com/support/foru.../ninjatrader-8

                  You can also contact a professional NinjaScript Consultant who would be eager to create or modify this script at your request or assist you with your script. The NinjaTrader Ecosystem has affiliate contacts who provide educational as well as consulting services. Please let me know if you would like our business development follow up with you with a list of affiliate consultants who would be happy to create this script or any others at your request.
                  Chelsea B.NinjaTrader Customer Service

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by leodrz, Today, 09:45 PM
                  2 responses
                  13 views
                  0 likes
                  Last Post leodrz
                  by leodrz
                   
                  Started by habibalex, Today, 09:30 PM
                  0 responses
                  8 views
                  0 likes
                  Last Post habibalex  
                  Started by Herrwolf1, Today, 09:07 PM
                  0 responses
                  7 views
                  0 likes
                  Last Post Herrwolf1  
                  Started by nomadmilo, Today, 08:52 PM
                  1 response
                  8 views
                  0 likes
                  Last Post nomadmilo  
                  Started by jvanelli, Today, 08:48 PM
                  0 responses
                  6 views
                  0 likes
                  Last Post jvanelli  
                  Working...
                  X