Open and close market orders by hotkeys

 
I have not been able to find any way to open market orders with hotkeys, my way of operating requires that the operations 
be open and closed at the exact moment you decide (scalper very fast), doing it with the mouse and clicking below the small 
arrow is something impossible. Is there a way to open and close orders only with the keyboard? How can you do with Ninjatrader?

Greetings and thanks.
 

I found hotkeys for MT5 (but it is not for the openning/closing the orders sorry):

MT5 - https://www.metatrader5.com/en/terminal/help/start_advanced/hotkeys

-----------------

Hot Keys - For Advanced Users - MetaTrader 5
Hot Keys - For Advanced Users - MetaTrader 5
  • www.metatrader5.com
Hot keys (accelerating keys) are keys and their combinations that allow to execute various commands fast and without using menus or toolbars. Hot keys can be assigned for calling any element of the Navigator window, except for elements of the Accounts group. In order to assign a combination of keys to an element, the " Set hotkey" command of...
 

Sergey Golubev thanks for response.


This Ea and Scrip It fulfills the function of opening an operation and closing it. But

The response time is very slow, which in the long run is the same as pressing the mouse click and close with the "X" (quite small) of the platform, the operations open or close almost instantly with the One Click Trading, but with the aforementioned Ea and Script delay more, which in the long run is better to do with the mouse, I am Scalper of ultra short periods (seconds of operation), the only thing that MT5 is missing is to control operations by HOT KEYS, to open and close operations in a second while you are looking at 4 graphics, you do not have time to press the button and then close the operation, it is very uncomfortable.


Very Thanks and regards.

 
sjmotos:

Sergey Golubev thanks for response.


This Ea and Scrip It fulfills the function of opening an operation and closing it. But

The response time is very slow, which in the long run is the same as pressing the mouse click and close with the "X" (quite small) of the platform, the operations open or close almost instantly with the One Click Trading, but with the aforementioned Ea and Script delay more, which in the long run is better to do with the mouse, I am Scalper of ultra short periods (seconds of operation), the only thing that MT5 is missing is to control operations by HOT KEYS, to open and close operations in a second while you are looking at 4 graphics, you do not have time to press the button and then close the operation, it is very uncomfortable.


Very Thanks and regards.

you may try ChartEvents.  You will need to modify OrderSend function for MT5.

//------------------------------------------------------
/* sparam value in CHARTEVENT_MOUSE_MOVE
//------------------------------------------------------
   1 = State of the left mouse button 
   2 = State of the right mouse button
   3 = State of the SHIFT button
   4 = State of the CTRL button
   5 = State of the middle mouse button
   6 = State of the first extra mouse button
   7 = State of the second extra mouse button
*///+---------------------------------------------------+

//+------------------------------------------------------------------+
/* Keyboard strokes are captured in chartevents
//+------------------------------------------------------------------+
        id       lparam   dparam          sparam
a             0    65         1       30
b             0    66         1       48
c             0    67      1          46
d             0    68         1       32
e             0    69         1       18
f             0    70         1       33
g             0    71         1       34
h             0    72         1       35
i             0    73         1       23
j             0    74         1       36
k             0    75         1       37
l             0    76         1       38
m             0    77         1       50
n             0    78         1       49
o             0    79         1       24
p             0    80         1       25
q             0    81         1       16
r             0    82         1       19
s             0    83         1       31
t             0    84         1       20
u             0    85         1       22
v             0    86         1       47
w             0    87         1       17
x             0    88         1       45
y             0    89         1       21
z             0    90         1       44
shift    0     16       1        42
*///+---------------------------------------------------+

#property copyright "Copyright 2018, Kaleem Haider"
#property link      "https://www.mql5.com/en/users/kaleem.haider/seller"
#property version   "1.00"
#property strict

#define PipsPoint Get_PipsPoint()
#define PipsValue Get_PipsValue()

//inputs
input double dTradeLots=2.1; //Trade Lots       (means 2.1 Lots)
input double dTakeProfit=5.0; //Take Profit Pips
input bool bStopLoss = false;    //Use Stop Loss?
input double dStopLoss = 50;     //Stop Loss Pips
input int iMagic=786;
//variables
long llastlparam; //used for chart events, custom
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
struct STRUC_tradeLots
  {
   double            buyLots,sellLots;
   void reset(){buyLots=sellLots=0.0;};
  };
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---

//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---

  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {

  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
//---



   if(llastlparam==16 && lparam==66) //Shift+B, buy
     {
      if(!OrderSend(_Symbol,OP_BUY,dTradeLots,Ask,5,(bStopLoss)?Ask-dStopLoss*PipsPoint:0.0,Ask+dTakeProfit*PipsPoint,"Mashkur EA",iMagic,0,clrBlue))
         Print("Unable to open buy trade for "+(string)dTradeLots+" lots");
     }
   if(llastlparam==16 && lparam==83) //Shift+S, sell
     {
      if(!OrderSend(_Symbol,OP_SELL,dTradeLots,Bid,5,(bStopLoss)?Bid+dStopLoss*PipsPoint:0.0,Bid-dTakeProfit*PipsPoint,"Mashkur EA",iMagic,0,clrRed))
         Print("Unable to open buy trade for "+(string)dTradeLots+" lots");
     }
   if(llastlparam==16 && lparam==69) //Shift+E, both buy+sell
     {
      if(!OrderSend(_Symbol,OP_BUY,dTradeLots,Ask,5,(bStopLoss)?Ask-dStopLoss*PipsPoint:0.0,Ask+dTakeProfit*PipsPoint,"Mashkur EA",iMagic,0,clrBlue))
         Print("Unable to open buy trade for "+(string)dTradeLots+" lots");
      if(!OrderSend(_Symbol,OP_SELL,dTradeLots,Bid,5,(bStopLoss)?Bid+dStopLoss*PipsPoint:0.0,Bid-dTakeProfit*PipsPoint,"Mashkur EA",iMagic,0,clrRed))
         Print("Unable to open buy trade for "+(string)dTradeLots+" lots");
     }
   llastlparam=lparam;
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Get_PipsPoint()
  {
   double PP=(_Digits==5 || _Digits==3)?_Point*10:_Point;
   return (PP);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
double Get_PipsValue()
  {
   double PV=(SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_VALUE)*PipsPoint)/SymbolInfoDouble(_Symbol,SYMBOL_TRADE_TICK_SIZE);
   return(PV);
  }
//+------------------------------------------------------------------+
 
any hot key for partial close trade? or modify order by hot key?
Reason: