Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1101

 
Yevhenii Levchenko:
How do I know if an order was closed manually or by a robot?

DEAL_OUT... 'manually' the robot will have ID=magic

If you search with a robot, then magic = 0 for a manual exit order (although a robot can also have 0, but this is more of an exception than a rule)

 
Vitaly Muzichenko:

Screenshot please, never seen a mark in the logbook as the closure/deletion happened


here

in the experts tab it was meant to be

 
Andrey Sokolov:


here

in the experts tab meant

Thank you, I will have to pay attention to that for general development.

 

Why does this code draw the wrong arrows - MQL5

void ArrowCreate(ENUM_OBJECT             type,
                 datetime                time,
                 double                  price)
  {
   
   string name = (type == OBJ_ARROW_UP ? "Arrow Up №"+(string)(up+1) : "Arrow Down №"+(string)(down+1));
   if(type == OBJ_ARROW_UP)  { up++; }
   else                      { down++; };
   
   ResetLastError();
   if(ObjectCreate(ChartID(),name,OBJ_ARROW,0,time,price))
     {
      ObjectSetInteger(ChartID(),name,OBJPROP_ARROWCODE,(type == OBJ_ARROW_UP ? 241 : 242));
     }
   else
     {
      Print(__FUNCTION__,
            ": не удалось создать знак \"Стрелка\"! Код ошибки = ",GetLastError()); return;
     };
   ObjectSetInteger(ChartID(),name,OBJPROP_ANCHOR,(type == OBJ_ARROW_UP ? ANCHOR_TOP : ANCHOR_BOTTOM)); 
   ObjectSetInteger(ChartID(),name,OBJPROP_COLOR,(type == OBJ_ARROW_UP ? a_color_buy : a_color_sell));
   ObjectSetInteger(ChartID(),name,OBJPROP_STYLE,STYLE_SOLID); 
   ObjectSetInteger(ChartID(),name,OBJPROP_WIDTH,a_size); 
   ObjectSetInteger(ChartID(),name,OBJPROP_BACK,false); 
   ObjectSetInteger(ChartID(),name,OBJPROP_SELECTABLE,false); 
   ObjectSetInteger(ChartID(),name,OBJPROP_SELECTED,false); 
   ObjectSetInteger(ChartID(),name,OBJPROP_HIDDEN,true); 
   ObjectSetInteger(ChartID(),name,OBJPROP_ZORDER,0);
  }


It should draw OBJPROP_ARROWCODE 241 or 242
... but instead it draws normal OBJ_ARROW_UP or OBJ_ARROW_DOWN

 
Sergey Likho:

Can MQL4/MQL5 be used to stretch a BMP image to the whole screen?

As far as I know - no.

 
Alexandr Sokolov:

Why does this code draw the wrong arrows - MQL5


It should draw OBJPROP_ARROWCODE 241 or 242
... but instead it draws the usual OBJ_ARROW_UP or OBJ_ARROW_DOWN

Replace

      ObjectSetInteger(ChartID(),name,OBJPROP_ARROWCODE,(type == OBJ_ARROW_UP ? 241 : 242));

to

      ObjectSetInteger(ChartID(),name,OBJPROP_ARROWCODE,(type == OBJ_ARROW_UP ? 225 : 226));

and check - so what is actually drawn?

 
Vladimir Karputov:

Replace

to

and check - so what is actually drawn?

these arrows are drawn, but why aren't the arrows coded 241 and 242 drawn?

 
Igor Zakharov:

DEAL_OUT... 'manually' the robot will have ID=magic

If you search with a robot, then magic = 0 for a manual exit order (although a robot might also have 0, but that's more the exception than the rule)

Thanks! But it's on mt5...
Andrey Sokolov:

here

in the Expert Advisors tab this means

Is there any way to get it out programmatically?
 
Igor Makanu:

I did not do it, or rather I did not search for it in the subwindow. In the KB I have laid out an example of clicking on the main window bars and displaying information about the bar - you can look it up

i have made an indicator for experimenting with the buttons - i checked if the buttons move the indicator line

to see if the indicator is moving put a horizontal line in the indicator subwindow ... that's pretty cool ))))

Thanks. Just don't understand how to attach this to my indicator.

 
Yevhenii Levchenko:
software can weed this out?

Then perhaps, as already suggested, by magicka

Reason: