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

Custom grid for buttons

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

    Custom grid for buttons

    I have WPF buttons for ATM strategy. I wanna move them in 2 columns. Any educational resources to do this? Preferably simple.
    Is it possible to move buttons on panel 2 where my indicators are plotted?
    Thanks.
    Attached Files

    #2
    As I understand I should change this part:

    Code:
     System.Windows.Controls.ColumnDefinition column1 = new System.Windows.Controls.ColumnDefinition();
    System.Windows.Controls.ColumnDefinition column2 = new System.Windows.Controls.ColumnDefinition();
    System.Windows.Controls.ColumnDefinition column3 = new System.Windows.Controls.ColumnDefinition();
    System.Windows.Controls.ColumnDefinition column4 = new System.Windows.Controls.ColumnDefinition();
    System.Windows.Controls.ColumnDefinition column5 = new System.Windows.Controls.ColumnDefinition();
    
    myGrid.ColumnDefinitions.Add(column1);
    myGrid.ColumnDefinitions.Add(column2);
    myGrid.ColumnDefinitions.Add(column3);
    myGrid.ColumnDefinitions.Add(column4);
    myGrid.ColumnDefinitions.Add(column5);
    Code:
     System.Windows.Controls.Grid.SetColumn(longButton, 0);
    System.Windows.Controls.Grid.SetColumn(shortButton , 1);
    
    System.Windows.Controls.Grid.SetColumn(pendinglong Button, 2);
    System.Windows.Controls.Grid.SetColumn(pendingshor tButton, 3);
    System.Windows.Controls.Grid.SetColumn(beButton, 4);
    Last edited by Leeroy_Jenkins; 01-21-2021, 04:59 AM.

    Comment


      #3
      Hello Leeroy_Jenkins,

      Thank you for your reply.

      You can reduce your number of columns to 2 and add some rows to the columns to contain your buttons. Here's a publicly available example from Microsoft's documentation of adding rows to columns using C# code and placing content in the correct column/row location:



      As far as moving the buttons to the panel with the indicator, if you wanted to do that you should have the indicator add the buttons and have the indicator trigger methods within the strategy to submit orders from them. A script accessing the UserControlCollection will only have that on the panel it is added to.

      Please let us know if we may be of further assistance to you.
      Kate W.NinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by inanazsocial, Today, 01:15 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Jason  
      Started by rocketman7, Today, 02:12 AM
      0 responses
      10 views
      0 likes
      Last Post rocketman7  
      Started by dustydbayer, Today, 01:59 AM
      0 responses
      2 views
      0 likes
      Last Post dustydbayer  
      Started by trilliantrader, 04-18-2024, 08:16 AM
      5 responses
      23 views
      0 likes
      Last Post trilliantrader  
      Started by Davidtowleii, Today, 12:15 AM
      0 responses
      3 views
      0 likes
      Last Post Davidtowleii  
      Working...
      X