Download MetaTrader 5
To add comments, please log in or register
Do you want to order an application? Find out how to obtain the desired result
Max Enrik
646
Max Enrik 2016.10.03 13:47 

Hi,

 

I made some "OBJ_RECTANGLE_LABEL" s but I can't find how can I link each other. That mean I need to move all with single object.

So where can I learn about that with example?

Any idea would be better.

 

Best,

Max 

whroeder1
13936
Max Enrik
646
Max Enrik 2016.10.03 16:16  

Huge thanks for prompt response.

I added to the chart, but I can't see any graphics (GUI) as you mentioned.

But I tried to understand your code. Maybe I did not figure it out yet.

I am still looking for it. But I do not solved my issue so any idea would be better.

    // MOVE GROUP - Start
    ObjectCreate        ( 0,    trade_panel + "MOVE",      OBJ_RECTANGLE_LABEL,        0,0,0                          );
    ObjectSetInteger    ( 0,    trade_panel + "MOVE",      OBJPROP_XDISTANCE,          MoveX                          );
    ObjectSetInteger    ( 0,    trade_panel + "MOVE",      OBJPROP_YDISTANCE,          MoveY                          );
    ObjectSetInteger    ( 0,    trade_panel + "MOVE",      OBJPROP_XSIZE,              10                             );
    ObjectSetInteger    ( 0,    trade_panel + "MOVE",      OBJPROP_YSIZE,              10                             );
    ObjectSetInteger    ( 0,    trade_panel + "MOVE",      OBJPROP_BGCOLOR,            clrAqua                        );
    ObjectSetInteger    ( 0,    trade_panel + "MOVE",      OBJPROP_CORNER,             CORNER_LEFT_UPPER              );
    ObjectSetInteger    ( 0,    trade_panel + "MOVE",      OBJPROP_COLOR,              clrRed                         );
    ObjectSetInteger    ( 0,    trade_panel + "MOVE",      OBJPROP_BACK,               0                              );
    ObjectSetInteger    ( 0,    trade_panel + "MOVE",      OBJPROP_SELECTABLE,         true                           );
    ObjectSetInteger    ( 0,    trade_panel + "MOVE",      OBJPROP_SELECTED,           false                          );
    ObjectSetInteger    ( 0,    trade_panel + "MOVE",      OBJPROP_HIDDEN,             true                           );
    ObjectSetInteger    ( 0,    trade_panel + "MOVE",      OBJPROP_ZORDER,             Priority_Box                   );  // Priority - which one I need to make priority object for others all objects links this object.
    ObjectSetString     ( 0,    trade_panel + "MOVE",      OBJPROP_TEXT,               "TradingPanel"                 );
    // MOVE GROUP - Close
    // SELL GROUP - Start
    ...
whroeder1
13936
whroeder1 2016.10.03 19:52  
Max-Enrik: I added to the chart, but I can't see any graphics (GUI) as you mentioned.
Press a "b" or "s." Try moving the selected box in the upper left.
Max Enrik
646
Max Enrik 2016.10.03 20:01  
WHRoeder:
Max-Enrik: I added to the chart, but I can't see any graphics (GUI) as you mentioned.
Press a "b" or "s." Try moving the selected box in the upper left.

OMG! No attention no results.

All the best to you man, much appreciate that.

Since you shared your GREAT GUI with me, I am checking it for how I can get a good code for single move obj.

(P.S I am not CODE, Programmer man.)

Thanks for your golden time. 

----------------------------------------

I bring below code from your EA to my EA script.

But it looks like does not enough.

int OnInit()
{
    // MOVE GROUP - Start

    ObjectCreate ( 0, trade_panel + "MMGT_RecMov", OBJ_RECTANGLE_LABEL, 0,0,0 );
    ...

//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(
    const int id,
    const long & lparam,
    const double & dparam,
    const string & sparam
)
{
   if(id == CHARTEVENT_OBJECT_DRAG)
   {
      if( sparam == "MMGT_RecMov")
      {
         ObjectGet("MMGT_RecMov", OBJPROP_XDISTANCE);
         ObjectGet("MMGT_RecMov", OBJPROP_YDISTANCE);
      }
   }
}

I can't find any reason why this is not work for me. 

I am trying to make it myself.

Thanks. 

Keith Watford
Moderator
8799
Keith Watford 2016.10.04 00:46  

How do you know it doesn't work?

You don't print anything and your code does nothing visually.

ObjectCreate ( 0, trade_panel + "MMGT_RecMov", OBJ_RECTANGLE_LABEL, 0,0,0 );
ObjectGet("MMGT_RecMov", OBJPROP_XDISTANCE);

Does the object exist?

Max Enrik
646
Max Enrik 2016.10.04 06:48  
GumRai:

You don't print anything and your code does nothing visually.

https://cdn.pbrd.co/images/6HdAXpFU.png  

I understood I will learn about "Objects Link Each Other".

So I will look for it in  MQL5 Reference PDF format.

I want to know MQL5 is same as MQL4?

If not can I get link  MQL4 Reference PDF format?

(I did not find MQL4)

Also may I get reference about how to "MOVE" objects with single obj?

Thanks for your answers. 

Fernando Carreiro
1948
Fernando Carreiro 2016.10.04 08:01  
Max-Enrik:
  1. So I will look for it in  MQL5 Reference PDF format. I want to know MQL5 is same as MQL4?
  2. If not can I get link  MQL4 Reference PDF format? (I did not find MQL4)
  3. Also may I get reference about how to "MOVE" objects with single obj?
  1. MQL4 is not the same as MQL5. It has similarities, but they are not the same.
  2. For documentation, look at the top - It says Documentation! (or hit F1 in the MetaEditor).
  3. For moving Graphical Chart Ojects, use ObjectMove().

You should first learn coding in general, so that you can understand the basics of coding before trying to code your own Indicator or EA. It is of no use to anyone if you don't first learn the basics. This can take many months (even a couple of years), for a complete beginner, to properly learn to code Indicators or EAs. You need time to properly gain the necessary knowledge and coding experience for it. Remember that it is a long-term project, and not short term.

Max Enrik
646
Max Enrik 2016.10.04 08:43  
FMIC:
Your answer helped me a lot. Thanks man for the great answer, so you right.
Max Enrik
646
Max Enrik 2016.10.06 12:26  

Dear Moderators,

I added some comments after short period I deleted them, because I solved them by myself, and I would not like to you spend time for them. 

Max Enrik
646
Max Enrik 2016.10.06 21:06  
Below code works very well for me, but I would like to "ShowSpread" always showing.

That mean when I start EA, "Spread" disappear until Market Spread action. ( When market closed I do not see market spread. )

 

int start()
{
    ShowSpread();
}
void ShowSpread()
{
    static double gSpread;
                  gSpread    = MarketInfo  ( Symbol(), MODE_SPREAD ) / 10;
    string        Spread_num = DoubleToStr ( gSpread, 1            );
}
/ /12
To add comments, please log in or register