I find another solution so it's ok now.
But i desire to know if there is a center/middle mouse click in mql ?
I can't find it.
Please help.
Regards.
I find another solution so it's ok now.
But i desire to know if there is a center/middle mouse click in mql ?
I can't find it.
Please help.
Regards.
on event MOUSEMOVE , what does the "sparam" return when you click or roll the wheel ?
id==CHARTEVENT_MOUSE_WHEEL
and print all the paramsid==CHARTEVENT_MOUSE_WHEEL
and print all the paramson event MOUSEMOVE , what does the "sparam" return when you click or roll the wheel ?
Thank you,
I will follow that way.
Regards.
id==CHARTEVENT_MOUSE_WHEEL
and print all the paramsIt doesn't compile...
Is it working for mt4 ?
Edit :
I tried "CHARTEVENT_CLICK" and "CHARTEVENT_MOUSE_MOVE" ... these 2 last work well.
Any idea please ?
What are you trying to compile exacty?
int OnInit() { ChartSetInteger(0,CHART_EVENT_MOUSE_WHEEL,true); return(INIT_SUCCEEDED); } void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { if(id==CHARTEVENT_MOUSE_WHEEL) Print("Lparam: "+(string)lparam+", Dparam: "+(string)dparam+", Sparam: "+(string)sparam); }
Does this work? If it doesn't - what build of MT4 you have?
It's not in MQL4 documentation, which is strange.
https://www.mql5.com/en/docs/constants/chartconstants/enum_chartevents
https://docs.mql4.com/constants/chartconstants/enum_chartevents
- docs.mql4.com
What are you trying to compile exacty?
Does this work? If it doesn't - what build of MT4 you have?
It's not in MQL4 documentation, which is strange.
https://www.mql5.com/en/docs/constants/chartconstants/enum_chartevents
https://docs.mql4.com/constants/chartconstants/enum_chartevents
Hi,
It gives me this error
I have this version of MT4
Open a demo at MetaQuotes server, that will update your MT4 to latest beta. Which is 1121 and has the CHART_EVENT_MOUSE_WHEEL defined.
If you want to revert back to 'release' for some reason (if you encounter problems with the beta) delete whatever is in WebInstall folder (next to Terminal, which is where the MetaTrader data folders are) and reinstall from your broker's setup.
What are you trying to compile exacty?
Does this work? If it doesn't - what build of MT4 you have?
It's not in MQL4 documentation, which is strange.
https://www.mql5.com/en/docs/constants/chartconstants/enum_chartevents
https://docs.mql4.com/constants/chartconstants/enum_chartevents
I have see this code on the documentation :
//+------------------------------------------------------------------+ //| MouseState | //+------------------------------------------------------------------+ string MouseState(uint state) { string res; res+="\nML: " +(((state& 1)== 1)?"DN":"UP"); // mouse left res+="\nMR: " +(((state& 2)== 2)?"DN":"UP"); // mouse right res+="\nMM: " +(((state&16)==16)?"DN":"UP"); // mouse middle res+="\nMX: " +(((state&32)==32)?"DN":"UP"); // mouse first X key res+="\nMY: " +(((state&64)==64)?"DN":"UP"); // mouse second X key res+="\nSHIFT: "+(((state& 4)== 4)?"DN":"UP"); // shift key res+="\nCTRL: " +(((state& 8)== 8)?"DN":"UP"); // control key return(res); } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam) { if(id==CHARTEVENT_MOUSE_MOVE) Comment("POINT: ",(int)lparam,",",(int)dparam,"\n",MouseState((uint)sparam)); }
It detects the MOUSE MIDDLE CLICK state.
I think there is a way to use it and turn it according my needs.
Kind of
// if state&16 == DN // then do something...
How can I translate this idea in "true" code please ?
Regards.
It would do the same job as your previous code, the state variable is just the sparam of the event. And, of course, it still needs mouse move detecting allowed in initialization.
You should use id==CHART_EVENT_MOUSE_MOVE && sparam==<sparam of middle click> if you want your function on middle click.
The wheel click is assigned for haircross so you may run into conflict (sometimes your functions execute, sometimes a crosshair appears).
If you want to use the scroll wheel it's the same procedure with id==CHART_EVENT_MOUSE_WHEEL and lparam. Except you need Build 1121, because Build 1090 doesn't support it.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello all, I am trying to put the "CHART_AUTOSCROL" parameter false...when i use the wheel of the mouse. I succed with a simple click
But I did'nt succeed with the mouse's wheel. Can someone help me please.
Kind regards.