Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with hotkeys

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

    Problem with hotkeys

    I have an indicator which is sending orders using the Account method. These orders don't have an ATM strategy.

    I noticed that the hotkeys that reference the "last order", such as "Cancel last order", "Increase last order price", etc, are not working for these orders. These orders are sent with Account.Submit() and are being sent correctly as far as I can tell. They also don't have an ATM strategy and therefore should be included in the definition of "last order" stated in Trading with Hotkeys.

    Other orders sent by ChartTrader in the same chart respond correctly to these "last order" hotkeys. Is there something that I need to set or configure on the order for it to respond to these hotkeys?



    #2
    Hello VolatyTrading,

    Thanks for your post.

    If we look at the Log tab of the Control Center, we can see messages that are relative to the order entry window that the hot key was pressed.
    4/23/2021 6:35:12 AM Order Hot Key Cancel Last Order Chart - There is no order to cancel
    If you are submitting orders with Account.Submit, they would not originate from the NinjaTrader order entry controls and they would not be found when NinjaTrader looks for orders that have originated from that window.

    You would need to create your own hot keys for this sort of functionality. I have attached an example that can subscribe to ChartControl.PreviewKeyDown and ChartControl.PreviewKeyUp where you can detect key presses in your own code.

    Below is a link to another script that I converted in the past that uses a different approach with timers and Regex to detect key presses in a "global" fashion.

    https://ninjatraderecosystem.com/use.../a1chartnotes/

    The link above is publicly available.

    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.


    We look forward to assisting.
    Attached Files
    JimNinjaTrader Customer Service

    Comment


      #3
      NinjaTrader_Jim thanks, I was able to detect the OCO order hotkey but not the others related to the "last order". It seems that they are filtered out before reaching my callback.

      Is it possible to use the IOrderEntryHotKeys interface? The interface seems to be straightforward but I would need to register my object somewhere so it can be notified when a hotkey is used. If this is not possible now, can we have a request to make the hotkey interfaces publicly available?

      Comment


        #4
        Hello VolatyTrading,

        There is not any documentation to advise using this in a supported fashion. If you find use interfacing with it and want to inform others of your experience, we would welcome your feedback for what you have tried for the community.

        (Any thing that is not documented NinjaScript is technically unsupported, which just means that we cannot help accomplishing the goal.)

        I have added a vote on your behalf to a feature request tracking interest behind adding this functionality.

        The ticket ID is SFT-2669. This is an internal number, but for anyone else wishing to have their interest tracked, please let our support staff know that you would like a vote added for this request.

        Feature Request Disclaimer

        We receive many requests and cannot reasonably implement all requested features or changes. Interest is tracked internally and if enough interest is tracked, it would be weighed against how feasible it would be to make those changes to consider implementing.

        When new features are implemented, they will be listed in the Release Notes page of the Help Guide. The ID number will be different than the internal feature request tracking ID, but the description of the feature will let you know if that feature has been implemented.

        Release Notes - https://ninjatrader.com/support/help...ease_notes.htm


        We look forward to assisting.
        JimNinjaTrader Customer Service

        Comment


          #5
          Hi Jim,

          thanks for adding my vote to the ticker. In the meantime, I have tried to use the PreviewKeyDown and KeyDown handlers to capture hotkey events, but without much success.

          Apparently only certain hotkey events fire these handlers. For instance, Ctrl+G correctly changes the chart cursor to the "Global" crosshair but it does not fire my event handler. To be more accurate, it does fire the handler but only with the Ctrl key down, not the 'G' key:

          Code:
          Modifiers: Control
          Key.System: System
          e.Key: LeftCtrl
          e.SystemKey: None
          e.KeyStates: Down
          e.ImeProcessedKey: None

          I assume that the Ctrl+G event is being handled before reaching my handler, and e.Handled is being set to true at that time.

          Any idea how can I capture these missing hotkey events?
          Last edited by VolatyTrading; 04-30-2021, 09:34 AM.

          Comment


            #6
            Hello VolatyTrading,

            The tips I have given in post #2 would be my only unsupported ideas for being able to handle the key presses. I do see that the PreviewKey approach would not work for already handled hot keys and using Regex as is done in ChartNotes may not be suitable for non-modifier keys.

            Since we are talking about doing things that are not documented/supported, I do not have any additional insight I can offer.

            I would then suggest using different key combinations for your AddOn. Otherwise another community member may have some input for handling key presses which are already owned by NinjaTrader hotkeys.

            We look forward to assisting.
            JimNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by yodaler, Today, 06:12 PM
            0 responses
            5 views
            0 likes
            Last Post yodaler
            by yodaler
             
            Started by op1031, Today, 05:16 PM
            0 responses
            1 view
            0 likes
            Last Post op1031
            by op1031
             
            Started by fscabrera03, Today, 01:18 PM
            1 response
            12 views
            0 likes
            Last Post fscabrera03  
            Started by BottomShark77, Today, 12:20 PM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_ShawnB  
            Started by bowling, Today, 06:16 AM
            3 responses
            30 views
            0 likes
            Last Post NinjaTrader_ShawnB  
            Working...
            X