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

Auto Form Pop Up from Strategies

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

    Auto Form Pop Up from Strategies

    I have implemented a number of strategies that create forms. Is there any way that I can make my forms auto pop up when the strategy is enabled using the Control Centre.

    Currently the only way I get my forms to create is when I enable the strategy on the chart. As I have 3-4 forms for each e-mini, this takes me ages in set up time.

    I'd like to be able to just run down the control centre strategy list and enable/pop up in one action.

    thanks

    #2
    Hello I_Quant,

    Thank you for your post.

    I have not attempted this from the Strategies tab. I will look into this further on my end but keep in mind this is unsupported.

    Comment


      #3
      Hello I_Quant,

      Just wanted to follow up and let you know I am still looking into this on my end.

      Comment


        #4
        I appreciate it Patrick

        Thanks Patrick

        Comment


          #5
          Hello I_Quant,

          Thank you for your patience.

          The following code will open a form when enabling the strategy on the Strategies tab of the Control Center:
          Code:
          protected override void Initialize()
                  {
                      CalculateOnBarClose = true;
                  }
          
                  private Form testForm = new Form();
                  private Button testButton = new Button();
          
                  protected override void OnStartUp()
                  {
                      testButton.Click += testButton_Click;
                      testButton.Text = "Unload Form";
                      testButton.Width = 300;
                      testForm.Controls.Add(testButton);
                      testForm.Width = 500;
                      testForm.Height = 500;
                      testForm.Show();
                  }
          
                  protected override void OnTermination()
                  {
                      testButton.Click -= testButton_Click;
                      testForm.Close();
                      testForm = null;
                  }
          
                  private void testButton_Click(object sender, EventArgs e)
                  {
                      testButton.Click -= testButton_Click;
                      testForm.Close();
                      testForm = null;
                  }
          
                  /// <summary>
                  /// Called on each bar update event (incoming tick)
                  /// </summary>
                  protected override void OnBarUpdate()
                  {
                  }

          Comment


            #6
            Perfect

            works perfectly
            thanks a lot Patrick, this will save me a ton of setup time

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by lightsun47, Today, 03:51 PM
            0 responses
            4 views
            0 likes
            Last Post lightsun47  
            Started by 00nevest, Today, 02:27 PM
            1 response
            8 views
            0 likes
            Last Post 00nevest  
            Started by futtrader, 04-21-2024, 01:50 AM
            4 responses
            44 views
            0 likes
            Last Post futtrader  
            Started by Option Whisperer, Today, 09:55 AM
            1 response
            13 views
            0 likes
            Last Post bltdavid  
            Started by port119, Today, 02:43 PM
            0 responses
            8 views
            0 likes
            Last Post port119
            by port119
             
            Working...
            X