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 llanqui, Today, 10:32 AM
            0 responses
            1 view
            0 likes
            Last Post llanqui
            by llanqui
             
            Started by StockTrader88, 03-06-2021, 08:58 AM
            45 responses
            3,992 views
            3 likes
            Last Post johntraderuser2  
            Started by TAJTrades, Today, 09:46 AM
            0 responses
            7 views
            0 likes
            Last Post TAJTrades  
            Started by rhyminkevin, Yesterday, 04:58 PM
            5 responses
            62 views
            0 likes
            Last Post dp8282
            by dp8282
             
            Started by realblubb, Today, 09:28 AM
            0 responses
            8 views
            0 likes
            Last Post realblubb  
            Working...
            X