NexusFi: Find Your Edge


Home Menu

 





Hotkeys for strategy ?


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one l1onel with 3 posts (0 thanks)
    2. looks_two terratec with 2 posts (2 thanks)
    3. looks_3 sam028 with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 3,475 views
    2. thumb_up 2 thanks given
    3. group 2 followers
    1. forum 6 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 
l1onel's Avatar
 l1onel 
The Valley ANGUILLA Caribbean
 
Experience: Advanced
Platform: TWS,Ninjatrader
Broker: IB, Ninjatrader
Trading: ES, NQ
Posts: 81 since Apr 2010
Thanks Given: 25
Thanks Received: 33

Can someone suggest a simple code to add to a strategy 2 hotkeys like ctrl+shift+B and ctrl+shift+S, for buy or sale.
I saw chart buttons which are nice but I prefer by experience simple things.
Thanks in advance.


I believe only in profits, not in prophets.
Follow me on X Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
My Rant with AMP Futures
Trading Reviews and Vendors
requesting .nrd replay files from 2026 spy and qqq
The Elite Circle
Building a free browser DOM/SMC simulator - need some ad …
Platforms and Indicators
What we know about Binances $6.3bn hack - BBC News
Cryptocurrency
AI for Traders — Agents, Memory, Tools & Real-Worl …
Elite Quantitative GenAI/LLM
 
  #3 (permalink)
 terratec 
Zurich Switzerland
 
Experience: Intermediate
Platform: NinjaTrader
Broker: IB
Trading: ES, 6E, CL
Posts: 403 since Sep 2009
Thanks Given: 64
Thanks Received: 517



kissandfly View Post
Can someone suggest a simple code to add to a strategy 2 hotkeys like ctrl+shift+B and ctrl+shift+S, for buy or sale.

SendKeys.Send("^+{B}"); // HotKey for "buy"
SendKeys.Send("^+{S}"); // HotKey for "sell"

^=Ctrl
%=Alt
+=Shift

SendKeys.Send Method (System.Windows.Forms)

Or do you mean something like this?
https://social.msdn.microsoft.com/forums/en-US/csharplanguage/thread/e0f8bc49-f4a8-4182-8b20-35d2f31845bd

could be something like:

private void chart_KeyDown (object sender, KeyEventArgs e)
{
if (e.KeyCode==Keys.Ctrl && e.KeyCode==Keys.Shift && e.KeyCode==Keys.B)
{
isLong=true;
} ...


Reply With Quote
Thanked by:
  #4 (permalink)
 
l1onel's Avatar
 l1onel 
The Valley ANGUILLA Caribbean
 
Experience: Advanced
Platform: TWS,Ninjatrader
Broker: IB, Ninjatrader
Trading: ES, NQ
Posts: 81 since Apr 2010
Thanks Given: 25
Thanks Received: 33

Thanks a lot.
It is more like the second one I think.
When I press key combination, my strategy opens a trade.
I look for a way to send information to my running strategy with the keyboard.
But I am not a coder :-( and still does not work. I miss something.
Maybe would you have a more detailed code to send me ?
Thanks a lot anyway very kind of you :-)


I believe only in profits, not in prophets.
Follow me on X Started this thread Reply With Quote
  #5 (permalink)
 
sam028's Avatar
 sam028 
Site Administrator
 
Posts: 3,779 since Jun 2009
Thanks Given: 3,840
Thanks Received: 4,709


kissandfly View Post
Thanks a lot.
It is more like the second one I think.
When I press key combination, my strategy opens a trade.
I look for a way to send information to my running strategy with the keyboard.
But I am not a coder :-( and still does not work. I miss something.
Maybe would you have a more detailed code to send me ?
Thanks a lot anyway very kind of you :-)

You need an event handler: "if this key is pressed, then chart_KeyDown is executed".


Success requires no deodorant! (Sun Tzu)
Reply With Quote
  #6 (permalink)
 terratec 
Zurich Switzerland
 
Experience: Intermediate
Platform: NinjaTrader
Broker: IB
Trading: ES, 6E, CL
Posts: 403 since Sep 2009
Thanks Given: 64
Thanks Received: 517


kissandfly View Post
Thanks a lot.
It is more like the second one I think.
When I press key combination, my strategy opens a trade.
I look for a way to send information to my running strategy with the keyboard.
But I am not a coder :-( and still does not work. I miss something.
Maybe would you have a more detailed code to send me ?
Thanks a lot anyway very kind of you :-)

There is a mistake Ctrl should be Control. Did not test the combination.
The correct code for the combination is:

if (e.Control && e.Shift && e.KeyCode==Keys.B)

You need some more stuff to declare the event etc.
But I am not a programmer, so I am not so good in explaining that stuff.

OK. I see sam028 did.


Reply With Quote
  #7 (permalink)
 
l1onel's Avatar
 l1onel 
The Valley ANGUILLA Caribbean
 
Experience: Advanced
Platform: TWS,Ninjatrader
Broker: IB, Ninjatrader
Trading: ES, NQ
Posts: 81 since Apr 2010
Thanks Given: 25
Thanks Received: 33

Sam028, as you made SampleMACrossOverWithButton could you maybe make the same, more simple, with just to hotkeys input ?
Just to tell the strategy to go long or short.
Would be great as we have no clue how to code it
Big thanks in advance


I believe only in profits, not in prophets.
Follow me on X Started this thread Reply With Quote




Last Updated on September 23, 2011


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts