Objects not moving at the same time

 

Hello everyone,


I'm trying to build trading panel and I'm finding it difficult to move few items at the same time.

I'm using on event handler on EA, tried Drag option and also object click, the result remain the same: after moving one item and releasing my button, the other objects follow.

Would love to get a clue how to solve it so all items depend on one item and move simultaneously.

//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
   if(sparam == "OmriN")
     {
      int new_x = (int)ObjectGet("OmriN",OBJPROP_XDISTANCE);
      int new_y = (int)ObjectGet("OmriN",OBJPROP_YDISTANCE);  
      ObjectSetInteger(0,panel_name,OBJPROP_XDISTANCE,new_x+5);
      ObjectSetInteger(0,panel_name,OBJPROP_YDISTANCE,new_y+5);
     }
  }


Best regards,

Omri

Moving Average - Trend Indicators - Technical Indicators - Price Charts, Technical and Fundamental Analysis - MetaTrader 5 Help
Moving Average - Trend Indicators - Technical Indicators - Price Charts, Technical and Fundamental Analysis - MetaTrader 5 Help
  • www.metatrader5.com
The Moving Average Technical Indicator shows the mean instrument price value for a certain period of time. When one calculates the moving average...
 

1.  Please insert the code correctly: when editing a message, press the button       Codeand paste your code into the pop-up window. (The first time I corrected your message)

2. See how the panel is implemented: [data folder]\MQL5\Experts\Examples\Controls\Controls.mq5

 
OmriNa181287: tried Drag option and also object click,

Stop using either. As the mouse is moved, see if the main object has moved; move the rest accordingly. See see my GUI/Trade Assistant EA (for MT4): 'Money Manager Graphic Tool' indicator by 'takycard' - Risk Management - Articles, Library comments - MQL5 programming forum - Page 6 #55 (2018) and modified for screen resolution #75 (2020.02.17)

 
William Roeder #:

Stop using either. As the mouse is moved, see if the main object has moved; move the rest accordingly. See see my GUI/Trade Assistant EA (for MT4): 'Money Manager Graphic Tool' indicator by 'takycard' - Risk Management - Articles, Library comments - MQL5 programming forum - Page 6 #55 (2018) and modified for screen resolution #75 (2020.02.17)

Thanks it was really helpful and easy to implement.


Vladimir, thank you too. I'm using MT4 :)