MQL4 ObjectSetDouble Bug!

 

Hi all,

I have encountered an unexpected bug or error while using the ObjectSetDouble function, following is the program segment.

#define error Print("Error: ", GetLastError());
void Deserializer::Create(long id){
   int len = ArraySize(this.obj);
   for(int i=0; i<len; i++){
      if(!ObjectCreate(id, this.obj[i].name, (ENUM_OBJECT)this.obj[i].type, this.obj[i].subwin, 0, 0)){
         error;
         return;
      }
      int count = ArrayRange(this.obj[i].prop, 0);
      for(int j=0; j<count; j++){
         int p=(int)StringToInteger(this.obj[i].prop[j][_prop]);
         int m = (int)StringToInteger(this.obj[i].prop[j][_mod]);
         
         //double typed property never updated!
         if(this.obj[i].prop[j][_type] == "ENUM_OBJECT_PROPERTY_DOUBLE")
            if(!ObjectSetDouble(id, this.obj[i].name, p, m, StringToDouble(this.obj[i].prop[j][_val]))) error;  /*not updated and no error message*/

         //successfully updated
         if(this.obj[i].prop[j][_type] == "ENUM_OBJECT_PROPERTY_INTEGER")
            if(!ObjectSetInteger(id, this.obj[i].name, p, m, StringToInteger(this.obj[i].prop[j][_val]))) error;
         
         //successfully updated
         if(this.obj[i].prop[j][_type] == "ENUM_OBJECT_PROPERTY_DOUBLE")
            if(!ObjectSetString(id, this.obj[i].name, p, m, this.obj[i].prop[j][_val])) error;

      }
   }
}

Does anyone has an idea?

Thanks in advance.

Ken

 
My idea would be printing out the obj[i].prop[j][_val]
 

Ovo,

My idea would be printing out the obj[i].prop[j][_val]

Thanks for your reply.

I have already tried. It seems no problem for the value, as the _val had been Serialized previously.

I also tried to hard code the _val in a test script, which performed correctly.

Later on, I felt I found the problem as the modifier variable may affect the correctness, but finally turned out it is not the cause.

This drives me crazy.

 

Weird, i would bet the problem was with parsing the StringToDouble parameter. Does it really contain only digits (no whitespace)?

Reason: