Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Focus to ControlCenter

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

    Focus to ControlCenter

    Hi there,

    How would I give the focus back to Ninja ControlCenter, from within a strategy?

    I need this as my error handling code has to send keystrokes to the control center.

    Thanks in advance,
    Dominique

    #2
    Hello Dominique,
    If you try the below unsupported code then can you bring the Control Center to the front.

    Code:
    NinjaTrader.Gui.Globals.MainForm.BringToFront();
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Thank you Joydeep,

      I turns out I need to do things a little differently than I initially thought. Here is the situation:

      - I bring a chart forward and send CTRL+SHIFT+R to do a data (+ strat) reload
      - A warning box pops-up, saying that I have an active strat on the chart, and asking me to confirm

      This Warning box appears to be some sort of a child from the chart window, and usually I can send it "Y" to confirm.

      In some circumstances, an internet deconnection/reconnection takes place before I can send the "Y" ... at this point, it appears the control-center is now at the front, and I have no way that I know of to give the focus back to the Warning box (I tried giving it back to the chart, but it doesn't work, the control center keeps the focus).

      So at that point, what I need to do is actually give the focus back to the Warning box ... but I have no idea how to find it.

      Your help in this matter will be greatly appreciated

      Thanks in advance
      Dominique

      Comment


        #4
        Hello Dominique,
        Unfortunately that is the default behavior and you will face such scenario while using SendKey functions.

        Instead of using the SendKey functions you can try using PInvoke methods (like PostMessage etc) to set the clicks etc. However nothing we could support.
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          May-be there is a way to configure that chart/strategy so that it doesn't ask for confirmation on the data reload ?

          Comment


            #6
            Hello Dominique,
            If you reinitialize the strategy then unfortunately the message box should pop up.
            JoydeepNinjaTrader Customer Service

            Comment


              #7
              Or a way to launch a strategy from a NinjaScript ?

              Comment


                #8
                Hello Dominique,
                Unfortunately no native way to do it.

                You can use reflections etc to do it however nothing we would support.
                JoydeepNinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by rdtdale, Yesterday, 01:02 PM
                2 responses
                15 views
                0 likes
                Last Post rdtdale
                by rdtdale
                 
                Started by TradeSaber, Today, 07:18 AM
                0 responses
                7 views
                0 likes
                Last Post TradeSaber  
                Started by PaulMohn, Today, 05:00 AM
                0 responses
                9 views
                0 likes
                Last Post PaulMohn  
                Started by ZenCortexAuCost, Today, 04:24 AM
                0 responses
                6 views
                0 likes
                Last Post ZenCortexAuCost  
                Started by ZenCortexAuCost, Today, 04:22 AM
                0 responses
                3 views
                0 likes
                Last Post ZenCortexAuCost  
                Working...
                X