Errors, bugs, questions - page 2427

 
Slava:
Show the output code


// Создадим поле ввода лота
   EditCreate(0,prefix+"LotBuy",xd,yd+15,47,15,0,(string)Lots,"Lot Buy","Verdana",8,clrBlack,C'241,239,226',clrGray,false,ALIGN_CENTER);

   EditCreate(0,prefix+"LotSell",xd,yd+15,47,15,0,(string)Lots,"Lot Sell","Verdana",8,clrBlack,C'241,239,226',clrGray,false,ALIGN_CENTER);

void EditCreate(long chart_ID,string nm="Edit",int xd=0,int yd=0,int width=50,int height=18,int cr=0,
                string text="Edit",string tooltip="Edit",string font="Arial",int font_size=9,
                color clr=clrBlack,color back_clr=C'236,233,216',color border_clr=clrNONE,
                                                              bool read_only=false,int align=0) {
 if(ObjectFind(chart_ID,nm)<0) {
    ObjectCreate(chart_ID,nm,OBJ_EDIT,0,0,0);
    ObjectSetInteger(chart_ID,nm,OBJPROP_XDISTANCE,xd);
    ObjectSetInteger(chart_ID,nm,OBJPROP_YDISTANCE,yd);
    ObjectSetInteger(chart_ID,nm,OBJPROP_XSIZE,width);
    ObjectSetInteger(chart_ID,nm,OBJPROP_YSIZE,height);
    ObjectSetString(chart_ID,nm,OBJPROP_TEXT,text);
    ObjectSetString(chart_ID,nm,OBJPROP_TOOLTIP,tooltip);
    ObjectSetString(chart_ID,nm,OBJPROP_FONT,font);
    ObjectSetInteger(chart_ID,nm,OBJPROP_FONTSIZE,font_size);
    ObjectSetInteger(chart_ID,nm,OBJPROP_ALIGN,align);
    ObjectSetInteger(chart_ID,nm,OBJPROP_READONLY,read_only);
    ObjectSetInteger(chart_ID,nm,OBJPROP_CORNER,cr);
    ObjectSetInteger(chart_ID,nm,OBJPROP_COLOR,clr);
    ObjectSetInteger(chart_ID,nm,OBJPROP_BGCOLOR,back_clr);
    ObjectSetInteger(chart_ID,nm,OBJPROP_BORDER_COLOR,border_clr);
    ObjectSetInteger(chart_ID,nm,OBJPROP_SELECTABLE,false);
    ObjectSetInteger(chart_ID,nm,OBJPROP_SELECTED,false);
    ObjectSetInteger(chart_ID,nm,OBJPROP_HIDDEN,false);
  }
 }
 
Vitaly Muzichenko:


"1.e-002" is (string)Lots?
 
Slava:
"1.e-002" is (string)Lots?

Yes.

 
Slava:
"1.e-002" is (string)Lots?

Changed the lot in the input parameters to 0.05

Changed the code to:

   EditCreate(0,prefix+"LotBuy",xd,yd+15,47,15,0,DoubleToString(Lots),"Lot Buy","Verdana",8,clrBlack,C'241,239,226',clrGray,false,ALIGN_CENTER);

   EditCreate(0,prefix+"LotSell",xd,yd+15,47,15,0,Lots,"Lot Sell","Verdana",8,clrBlack,C'241,239,226',clrGray,false,ALIGN_CENTER);



P.S. But if I enter 0.01 at once, it displays correctly

 EditCreate(0,prefix+"LotBuy",xd,yd+15,47,15,0,(string)0.01,"Lot Buy","Verdana",8,clrBlack,C'241,239,226',clrGray,false,ALIGN_CENTER);
 
Vitaly Muzichenko:

Changed the lot in the input parameters to 0.05

Changed the code to:



P.S. But if you enter 0.01 at once, it displays correctly

Vitaliy, but DoubleToString has the second parameter. And it is mandatory in your version, otherwise it will be by default. Fortunately I don't remember how much, it is not interesting to me.

 
Alexey Viktorov:

Vitaly, but DoubleToString has a second parameter. And in your variant it is obligatory, otherwise it will be by default. Fortunately I don't remember how much, I'm not interested in it.

By default it should not output 0.01 as 1.

We will correct

 
Slava:

By default, it should not output 0.01 as 1.e-002

Let's correct

I'm just glad that this error will be fixed. But my message was only that DoubleToString needs a second parameter in the presented code.
 
Igor Zakharov:

the compiler behaves differently in the same cases.

Downloaded 2 files from kodobase:https://www.mql5.com/en/code/15440

were made, obviously before iTime() appeared. One of them compiles, the other one swears:

Functions are identical:

calls too.

The reason for the scolding is obvious, understandable and easily fixed by auto-replacement, but the different behaviour in similar situations is alarming.

PS:

The compiled indicator works correctly.

I have both files causing exactly the same error list (8 in total).

 
Stanislav Korotky:

I have both files causing exactly the same error lists (8 in total).

Re-downloaded, tried to compile, both with errors, but the number is different: 8 and 9.


Judging by the auto-replacement report, it must be different.

So there was some sort of ME failure yesterday. I see the first one as a failure in favour of the user (compiled without edits and worked!).

 
Igor Zakharov:

Re-downloaded, tried to compile, both with errors, but the numbers are different: 8 and 9.

Judging by the auto-change report, it must be different.

Yes indeed, the range has 1 more.

Reason: