DoubleToStr() Problem

 

I am trying to write to file the string DaysOpen with with precision to 2 decimal places. In the FileWrite line, both DaysOpen and StrToDouble(DaysOpen) write to flle only single interger. Example: 0.02 wrties 0 and 1.25 writes 1.

Please advise. Thank you in advance.

if(IsTesting() && RecordData) 
      {
      if(OrdersTotal()<1 && t==1) 
      { 
         int handle;
         int orderOpen=OrderOpenTime();
         int orderClose=TimeCurrent();
         string DaysOpen=DoubleToStr((TimeCurrent()-OrderOpenTime())/86400,2);
         handle=FileOpen("MACD_MATrend-v3", FILE_CSV|FILE_READ|FILE_WRITE, ',');
         if(handle>0)
         {
         FileSeek(handle,0,SEEK_END);
         FileWrite(handle,TimeToStr(orderOpen),TimeToStr(orderClose),DaysOpen,slgap);
         FileClose(handle);
         } 
         slgap=0; 
         t=0;
    }
      if( SellGap() < slgap && OrdersTotal()==1) { slgap=SellGap(); t=1; }
    }    
 

since Time is an integer !

So Change to :

DoubleToStr(1.0*(TimeCurrent()-OrderOpenTime())/86400.0,2);

Reason: