I have OBJ_LABEL containing text. How I can make it move a few pixels right and down on CHARTEVENT_OBJECT_CLICK, then return back, to imitate click.
Use the
ObjectMove();
Or you can use the
ObjectSetInteger();
//+------------------------------------------------------------------+ //| Move the text label | //+------------------------------------------------------------------+ bool LabelMove(const long chart_ID=0, // chart's ID const string name="Label", // label name const int x=0, // X coordinate const int y=0) // Y coordinate { //--- reset the error value ResetLastError(); //--- move the text label if(!ObjectSetInteger(chart_ID,name,OBJPROP_XDISTANCE,x)) { Print(__FUNCTION__, ": failed to move X coordinate of the label! Error code = ",GetLastError()); return(false); } if(!ObjectSetInteger(chart_ID,name,OBJPROP_YDISTANCE,y)) { Print(__FUNCTION__, ": failed to move Y coordinate of the label! Error code = ",GetLastError()); return(false); } //--- successful execution return(true); } //+------------------------------------------------------------------+
Documentation on MQL5: Constants, Enumerations and Structures / Named Constants / Predefined Macro Substitutions
- www.mql5.com
//| Expert initialization function | //| Expert deinitialization function | //| Expert tick function | //| test1 |...
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register