Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Most efficient user input [for controlling Long/Short/Neither]

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

    Most efficient user input [for controlling Long/Short/Neither]

    First of all I want to thank every single member of the NT team. I don't think a lot of people realize how insanely unique and valuable it is that you guys are here helping people with their coding.

    I am a discretionary trader and I've recently managed to get a basic version of a script put together that handles trade entry and management.

    Because my systematic entries are based on levels and orderflow that I interpret discretionarily, I need to control which side (long/short) the script will take as well as none at all.

    Currently I need to open the strategy settings and manually type "LONG/SHORT/NEITHER" to control which side to allow the script to take (if either).

    I was wondering what options exist that I may explore to make this more efficient.

    One thing that comes to mind would be having buttons on the chart itself. I'm not sure how difficult that would be, and before I start investing time into that route I wanted to ask the team/community if there are other routes that might be worth looking at as in addition to or instead of buttons?

    Even a drop-down menu would be a step improved from having to type into the settings. Ideally I'd like to not be required to open the strategy settings at all but that's still better than typing.

    Thanks again for your help so far!
    Last edited by butt_toast; 07-22-2021, 12:22 PM.

    #2
    Hello butt_toast,

    You can add custom buttons or other WPF elements to the window. The most simple way is to add them using the UserControlCollection: https://ninjatrader.com/support/help...ub=usercontrol

    You can find other examples here: https://ninjatrader.com/support/foru...t=1#post499327

    I look forward to being of further assistance.

    Comment


      #3
      Originally posted by NinjaTrader_Jesse View Post
      Hello butt_toast,

      You can add custom buttons or other WPF elements to the window. The most simple way is to add them using the UserControlCollection: https://ninjatrader.com/support/help...ub=usercontrol

      You can find other examples here: https://ninjatrader.com/support/foru...t=1#post499327

      I look forward to being of further assistance.
      Wow that is absolutely perfect thank you.

      Last edited by butt_toast; 07-22-2021, 01:32 PM.

      Comment


        #4
        I cannot believe I got it working.

        The easiest thing for me to do was take the example from the language reference and include that almost line for line.

        Then I changed the location to top center, added a new button for SOH with a new color (gray).

        I was not able to use "==" to compare the name of the button to "LONG" for example, but I was able to use content. This is what I mean in case someone else finds this thread:

        // Define a custom event method to handle our custom task when the button is clicked
        private void OnMyButtonClick(object sender, RoutedEventArgs rea)
        {
        System.Windows.Controls.Button button = sender as System.Windows.Controls.Button;
        if (button != null)
        {
        Print(button.Name + " Clicked");
        if (button.Content == "LONG")//button name is buy
        {
        LongShort = "LONG"; //variable to decide long/short is LONG
        }
        else if (button.Content == "SHORT")//button name is sell
        {
        LongShort = "SHORT"; //variable to decide long/short is SHORT
        }
        else if (button.Content == "SOH") //button name is soh
        {
        LongShort = "SOH";//variable to decide long/short is SOH
        }
        }
        } //OnMyButtonClick

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Yesterday, 05:17 AM
        0 responses
        56 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        132 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        73 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        45 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        49 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X