Einzelnen Beitrag anzeigen
  #6 (permalink)  
Alt 09.12.16
Kronenchakra Kronenchakra ist offline
Gesperrter Benutzer
 
Registriert seit: Feb 2016
Ort: 2100 Österreich
Beiträge: 313
Kronenchakra befindet sich auf einem aufstrebenden Ast
Standard

Code:
//+------------------------------------------------------------------+
//|                                                      KeyTest.mq5 |
//+------------------------------------------------------------------+

#property indicator_chart_window
#property indicator_plots 0

int OnInit()
{
   return(INIT_SUCCEEDED);
}

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
{
   return(rates_total);
}

//mogliche Chartevents
//CHARTEVENT_KEYDOWN — event of a keystroke, when the chart window is focused;
//CHARTEVENT_MOUSE_MOVE — mouse move events and mouse click events (if CHART_EVENT_MOUSE_MOVE=true is set for the chart);
//CHARTEVENT_OBJECT_CREATE — event of graphical object creation (if CHART_EVENT_OBJECT_CREATE=true is set for the chart);
//CHARTEVENT_OBJECT_CHANGE — event of change of an object property via the properties dialog;
//CHARTEVENT_OBJECT_DELETE — event of graphical object deletion (if CHART_EVENT_OBJECT_DELETE=true is set for the chart);
//CHARTEVENT_CLICK — event of a mouse click on the chart;
//CHARTEVENT_OBJECT_CLICK — event of a mouse click in a graphical object belonging to the chart; 
//CHARTEVENT_OBJECT_DRAG — event of a graphical object move using the mouse;
//CHARTEVENT_OBJECT_ENDEDIT — event of the finished text editing in the entry box of the LabelEdit graphical object;
//CHARTEVENT_CHART_CHANGE  — event of chart changes;
//CHARTEVENT_CUSTOM+n — ID of the user event, where n is in the range from 0 to 65535.
//CHARTEVENT_CUSTOM_LAST — the last acceptable ID of a custom event (CHARTEVENT_CUSTOM +65535).

void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
{
   if(id==CHARTEVENT_OBJECT_CLICK)
      { 
         Print("Objectname: ",sparam," wurde angeclickt");
      }
     
   if(id==CHARTEVENT_CLICK)
      {
         Print("Auf den Chart geclickt");
      }
   
   if(id==CHARTEVENT_KEYDOWN)
      {
         Print(lparam);
         if(lparam==0x26) Print("VK_UP"); else
         if(lparam==0x28) Print("VK_DOWN"); else
         if(lparam==0x43) Print("VK_C"); else
         if(lparam==0x46) Print("VK_F"); else
         if(lparam==0x54) Print("VK_T"); else
         if(lparam==0x5A) Print("VK_Z"); else
         if(lparam==0x13) Print("VK_PAUSE");
      }
}
Kann man natürlich auch mit switch machen.
Hoffentlich kannst du's brauchen.

Grüße Otto