Why? Is it a bug?

 

Why does this

double SomeDouble;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   SomeDouble=0;
   
   ObjectCreate("sDouble", OBJ_LABEL, 0, 0, 0);  // Creating obj.
   ObjectSet("sDouble", OBJPROP_CORNER, 0);    // Reference corner
   ObjectSet("sDouble", OBJPROP_XDISTANCE, 10);// X coordinate   
   ObjectSet("sDouble", OBJPROP_YDISTANCE, 15);// Y coordinate
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectDelete("sDouble");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----

   ObjectSetText("sDouble",SomeDouble+" my double",8,"Arial",Lime);
//----
   return(0);
  }
//+------------------------------------------------------------------+

// ('-')

Shows the number part like this

While using string concatenate like this

double SomeDouble;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   SomeDouble=0;
   
   ObjectCreate("sDouble", OBJ_LABEL, 0, 0, 0);  // Creating obj.
   ObjectSet("sDouble", OBJPROP_CORNER, 0);    // Reference corner
   ObjectSet("sDouble", OBJPROP_XDISTANCE, 10);// X coordinate   
   ObjectSet("sDouble", OBJPROP_YDISTANCE, 15);// Y coordinate
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   ObjectDelete("sDouble");
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
string mytext=StringConcatenate(SomeDouble," my double");
   ObjectSetText("sDouble",mytext,8,"Arial",Lime);
//----
   return(0);
  }
//+------------------------------------------------------------------+

Shows only one zero like this

 
tonny:

Why does this

Shows the number part like this

Because you did this . . .

SomeDouble + " my double"

. . . the + converts the double with 8 digits and then adds the strings . . .

 
RaptorUK:

Because you did this . . .

. . . the + converts the double with 8 digits and then adds the strings . . .


And why does it do this
 
tonny:

And why does it do this
I assume that is what it is designed to do . . . I have very rarely used the addition ( + ) operator with strings, I looked for documentation on it but didn't find any so I chose not to use it, I used StringConcatenate() and my ToStr() function . . .
 
tonny:

Why does this

Shows the number part like this

While using string concatenate like this

Shows only one zero like this

  1. string to double expands to 8 characters and concatenate/print/alert/comment up to 4 digits because that's what they programmed it to do.
  2. If you want different use DoubleToStr and specify the exact number
  3. Of if you don't want the trailing zeros, use
    string   DoubleToString(double v, int d=8){              // 1.60000000 -> 1.6
       string   value = DoubleToStr(v, d);
       for(int iRight = StringLen(value)-1; true; iRight--){
          int      c = StringGetChar(value, iRight);
          if(c != '0'){
             if(c == '.') iRight--;
             break;
          }
       }
       return( StringSubstr(value, 0, iRight+1) );
    }
    

 
WHRoeder:
  1. string to double expands to 8 characters and concatenate/print/alert/comment up to 4 digits because that's what they programmed it to do.
  2. If you want different use DoubleToStr and specify the exact number
  3. Of if you don't want the trailing zeros, use

I hope new IDE comes soon. Lots of bugs. Ofcourse i have new IDE but the platform isnt new so im scared compiling with new IDE as the work may refuse to work with old platform.
 
tonny:

I hope new IDE comes soon. Lots of bugs. Ofcourse i have new IDE but the platform isnt new so im scared compiling with new IDE as the work may refuse to work with old platform.
There is no "may refuse to work" . . . it won't work. You need the new Terminal . . .
 
RaptorUK:
There is no "may refuse to work" . . . it won't work. You need the new Terminal . . .

But all in all the thing i find in the old ide is the lack of numbering of the lines of code so if when compiling error is given in say line 527 i have to transfer the code to mt5 ide via copy-paste just to see where the line is then go back to mt4 to correct it.
 
tonny:
But all in all the thing i find in the old ide is the lack of numbering of the lines of code so if when compiling error is given in say line 527 i have to transfer the code to mt5 ide via copy-paste just to see where the line is then go back to mt4 to correct it.
LOL . . . just double click on the error and the cursor will be taken to the correct line . . . you also have a line number and column number for the current cursor position in the bottom right corner of the MetaEditor window.
 
Yer but it is more convenient to have the numbers
 
tonny:
Yer but it is more convenient to have the numbers


It's more convenient to . . .

. . . to transfer the code to mt5 ide via copy-paste just to see where the line is then go back to mt4 to correct it.

. . . than to double click the error message and be taken to the correct line ?