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 carnitron, Today, 08:42 PM
            0 responses
            2 views
            0 likes
            Last Post carnitron  
            Started by strategist007, Today, 07:51 PM
            0 responses
            3 views
            0 likes
            Last Post strategist007  
            Started by StockTrader88, 03-06-2021, 08:58 AM
            44 responses
            3,969 views
            3 likes
            Last Post jhudas88  
            Started by rbeckmann05, Today, 06:48 PM
            0 responses
            5 views
            0 likes
            Last Post rbeckmann05  
            Started by rhyminkevin, Today, 04:58 PM
            4 responses
            58 views
            0 likes
            Last Post dp8282
            by dp8282
             
            Working...
            X