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 Balage0922, Today, 07:38 AM
            0 responses
            1 view
            0 likes
            Last Post Balage0922  
            Started by JoMoon2024, Today, 06:56 AM
            0 responses
            6 views
            0 likes
            Last Post JoMoon2024  
            Started by Haiasi, 04-25-2024, 06:53 PM
            2 responses
            19 views
            0 likes
            Last Post Massinisa  
            Started by Creamers, Today, 05:32 AM
            0 responses
            6 views
            0 likes
            Last Post Creamers  
            Started by Segwin, 05-07-2018, 02:15 PM
            12 responses
            1,786 views
            0 likes
            Last Post Leafcutter  
            Working...
            X