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.
    JesseNinjaTrader Customer Service

    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 Cecialton, Today, 05:30 AM
        0 responses
        1 view
        0 likes
        Last Post Cecialton  
        Started by rcrook23, Today, 03:06 AM
        1 response
        11 views
        0 likes
        Last Post rcrook23  
        Started by timekiller1985, Today, 02:46 AM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by sidlercom80, Today, 01:19 AM
        0 responses
        5 views
        0 likes
        Last Post sidlercom80  
        Started by aelagha, Today, 12:21 AM
        0 responses
        14 views
        0 likes
        Last Post aelagha
        by aelagha
         
        Working...
        X