Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
I don't think it is possible, at least not in pure MQL.
It could also be that it is undocumented but possible, however, I don't remember it ever being mentioned in the forum.
I don't think it is possible, at least not in pure MQL.
It could also be that it is undocumented but possible, however, I don't remember it ever being mentioned in the forum.
I doubt I understood correctly what exactly you mean, but I suspect it's possible to track right-clicks. Although I've never tried it myself.
I just found something interesting in a AlgoBook that could theoretically help do this:
https://www.mql5.com/en/book/applications/events/events_mouse
In addition, for the CHARTEVENT_MOUSE_MOVE event, the sparam parameter contains a string representation of a bitmask describing the status of mouse buttons and control keys (Ctrl, Shift). Setting a particular bit to 1 means pressing the corresponding button or key.
| Bits | Description |
|---|---|
| 0 | Left mouse button state |
| 1 | Right mouse button state |
I doubt I understood correctly what exactly you mean, but I suspect it's possible to track right-clicks. Although I've never tried it myself.
I just found something interesting in a AlgoBook that could theoretically help do this:
I think that's exclusive to the mouse move event
try this:
void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { if(id == CHARTEVENT_MOUSE_MOVE) { uint state = (uint)sparam; Print("CHARTEVENT_MOUSE_MOVE triggered: sparam='", sparam, "', state=", state, ", x=", lparam, ", y=", dparam); if(state == 2) // right mouse click pressed (bit 1) { Print("Right mouse click held: x=", lparam, ", y=", dparam); } else { Print("Mouse moved (no right click): x=", lparam, ", y=", dparam); } } }
If you want to stop the context menu interfering with a right click event, you can disable that:
int OnInit() { ChartSetInteger(ChartID(), CHART_CONTEXT_MENU, false); return(INIT_SUCCEEDED); }
but you'll have to close the chart in that case while not being able to remove the indicator as normal (menu disabled on the chart)
I think that's exclusive to the mouse move event
try this:
If you want to stop the context menu interfering with a right click event, you can disable that:
but you'll have to close the chart in that case while not being able to remove the indicator as normal (menu disabled on the chart)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use

When we push left click the following code help us to do something(for example comment something):
I want to do something when I push right click too. Is it possible?
(At first I must write the following code:
)