Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

want to use hidden RelayCommand in NinjaTrader.Gui.Tools.RelayCommand

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

    want to use hidden RelayCommand in NinjaTrader.Gui.Tools.RelayCommand

    Ok, I know for sure that Ninja won't support this, but maybe a C# guru will know...



    in my search to get control of the up-arrow and down-arrow keys on a chart I found ChatGpt suggestings to use KeyBinding.

    the code that was suggested to do this I uses RelayCommand

    I was given that code, but on compile it noted that there was already a RelayCommand in Ninja.Gui.Tools

    so, I would prefer to use that

    any suggestions?

    #2
    here is the binding code

    KeyBinding shiftUpBinding = new KeyBinding();
    shiftUpBinding.Key = Key.Up;
    shiftUpBinding.Modifiers = ModifierKeys.Shift;
    shiftUpBinding.Command = new RelayCommand(ShiftUpCommandExecute);
    this.InputBindings.Add(shiftUpBinding);

    KeyBinding controlDownBinding = new KeyBinding();
    controlDownBinding.Key = Key.Down;
    controlDownBinding.Modifiers = ModifierKeys.Control;
    controlDownBinding.Command = new RelayCommand(ControlDownCommandExecute);
    this.InputBindings.Add(controlDownBinding);​

    Comment


      #3
      Ok, well when I use the Ninja RelayCommand it does not execute the key binding target

      Comment


        #4
        Hello llanqui,

        As you expected using RelayCommand is not supported and is an internal core method within NinjaTrader.

        Below are links to some scripts that capture key presses.

        This is a conversion of the NYSE TICK and Advance/Decline Market Internals developed and originally coded for the NinjaTrader 7 platform by monpere. Please contact the original author for any questions or comments.

        This is a conversion of the a1ChartNotes indicator by monpere. Chart Notes v3 Add notes to your chart. For example, identify a chart template, or put specific notes on how to trade a particular chart, or instrument, etc. – Added selectable fonts and text color – Control Shift toggles compact/expanded visibility (number of lines shown) […]
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          thank you...

          I'm trying to use the up and down arrow keys....

          Comment


            #6
            Hello llanqui,

            I expected comparing the e.Key to Key.Up in the previewkeydown event in the example would suffice, however after a google search i'm finding the Key.Up (up arrow key) does not trigger the previewkeydown or keydown events, but does trigger the keyup event.
            This forum gives this a mention.
            If I type a letter it goes to the event, but not the arrow keys. KeyUp does catch the arrow keys, so that's what I'm going to use I'm basically doing this to...


            private void TextBox_KeyUp(object sender, KeyEventArgs e)
            {
            if (e.Key == Key.Up)
            Print("Key.Up");
            }​

            Note, this would interfere with the intended functionality of the platform and would not be supported to do.
            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Ok, but that may not work for me....it might, but it will make a tiny delay if it works I'll try it.

              (I'm using it for order entry...shift-up arrow = order at ask, control-down = order at bid, this way I don't have to move the mouse to submit these types or orders. I can't use a custom Ninja Hot key for this because my order submission first checks a series of rules before it will allow an order to be placed. The Ninja Hot keys will allow these combinations for Order Entry hotkey.

              But it seems Ninja 8 is doing something so that I can't use the arrow keys on a key down....unless I use an external hot key program to get control of the arrow keys before Ninja does.

              That is my current work around.

              There was no problem in Ninja 7, previewkeydown worked





              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              557 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              324 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              101 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              545 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              547 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X