Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Keyboard input

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

    Keyboard input

    I want to use keyboard input in my c# scripts in order to test out my strategies

    For example

    if (Keyboard.IsKeyDown(Key.X))
    {
    Print("Hello");
    }

    I'm getting an error.. Is there a conflict with a namespace?

    #2
    Hello DuggyLou,

    Thank you for the post.

    There is an existing sample you can use as a references for handling key events in NinjaScript. This is not specific to NinjaScript and you would be using the C#/WPF keyboard events here. That also entails this is not a documented subject but you can find samples on the forum by searching for specific events.

    In the linked post the PreviewKey events are being used from a textbox to handle key presses however the same concepts would be applied to the control you are targeting such as a window or the ChartControl.




    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    21 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    40 views
    0 likes
    Last Post CarlTrading  
    Working...
    X