Download MetaTrader 5

identify Mouse(press or release) on chart objects

To add comments, please log in or register
No time to learn MQL5? The source code library is at your service!
Alexander Piechotta
6954
Alexander Piechotta 2014.02.22 14:29 

identify Mouse(press or release) on chart objects

Is it possible with MQL5?

example: identify left mouse click (only press) on object trendline.
Vladimir Karputov
Moderator
46230
Vladimir Karputov 2014.02.22 14:49  
FinGeR:

identify Mouse(press or release) on chart objects

Is it possible with MQL5?

example: identify left mouse click (only press) on object trendline.

void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
   switch(id)
     {
      case CHARTEVENT_CLICK:
         Print(__FUNCTION__,"; CHARTEVENT_CLICK");break;
      case CHARTEVENT_OBJECT_CLICK:
         Print(__FUNCTION__,"; CHARTEVENT_OBJECT_CLICK");break;
     }
  }
Documentation on MQL5: Standard Constants, Enumerations and Structures / Chart Constants / Types of Chart Events
Documentation on MQL5: Standard Constants, Enumerations and Structures / Chart Constants / Types of Chart Events
  • www.mql5.com
Standard Constants, Enumerations and Structures / Chart Constants / Types of Chart Events - Documentation on MQL5
Vladimir Karputov
Moderator
46230
Vladimir Karputov 2014.02.22 15:24  

Sorry,  only press:

void OnInit()
  {
   ChartSetInteger(0,CHART_EVENT_MOUSE_MOVE,true);
  }
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
   switch(id)
     {
      case CHARTEVENT_MOUSE_MOVE:
         Print(__FUNCTION__,"; CHARTEVENT_MOUSE_MOVE; sparam= ",sparam);break;
     }
  }
//+------------------------------------------------------------------+

 sparam=1 - pressing the left key

sparam=2 -  pressing the right key

Alexander Piechotta
6954
Alexander Piechotta 2014.02.23 12:21  
Thanks.
To add comments, please log in or register