Errors, bugs, questions - page 173

 
stringo:
Parameter. How else could it be? We won't have Custom max 1, Custom max 2, ... Custom max n
I see. We will think
 

Good afternoon!

How can the error: posible use of unintialised variable " time"be cured here?

datetime OpenBuyOrdersTime() // vajadzetu atgriezt ordera izliksanas laiku
{
     datetime time;
     uint total=HistoryDealsTotal();

      for(int i=HistoryDealsTotal()-1;i>=0;i--)
        {
         ulong ticket=HistoryDealGetTicket(i);
         if(ticket!=0)
           {
            time  =(datetime)HistoryDealGetInteger(ticket,DEAL_TIME);
           }
        }
    return(time); 
}
 
abeiks:

Good afternoon!

How can the error: posible use of unintialised variable " time"be cured here?

datetime OpenBuyOrdersTime() // vajadzetu atgriezt ordera izliksanas laiku
  {
   datetime time=0;
   uint total=HistoryDealsTotal();

   for(int i=HistoryDealsTotal()-1;i>=0;i--)
     {
      ulong ticket=HistoryDealGetTicket(i);
      if(ticket!=0)
        {
         time=(datetime)HistoryDealGetInteger(ticket,DEAL_TIME);
        }
     }
   return(time);
  }
time always returns a value to a return but the value is initialized by a condition, so there may be a condition where the variable will not be initialized, so what should be returned to the return?
 
Urain:
Time always returns a value to a return but the value is initialized by a condition, there may be a condition where the variable will not be initialized, so what should be returned to the return?

Got it, thanks! :)

 

Developers.

What build has the following phenomenon already been observed (and very often).

OC - Win XP SP3 MUI 32 bit


 

I found this code in the manual

   int filehandle;
   ResetLastError();
   filehandle=FileOpen("fractals.csv",FILE_WRITE|FILE_CSV);
   if(filehandle!=INVALID_HANDLE)
     {
      FileWrite(filehandle,TimeCurrent(),Symbol(),PERIOD_CURRENT);
      FileClose(filehandle);
      Print("FileOpen OK");
     }
   else Print("Операция FileOpen неудачна, ошибка ",GetLastError());

everything works, question: how do I create a file to write in another convenient location?

If I enter an absolute path, the code doesn't work...

 
Olegts:

I found this code in the manual

everything works, question: how do I create a file to write in another convenient location?

If I enter an absolute path, the code doesn't work...

Probably only via DLL
 
sergey1294:
Probably only through DLL
Thanks of course, but I was hoping that mt5 would solve this issue somehow, I guess I'll have to do it like mt4:((((
 
Olegts:

I found this code in the manual

everything works, question: how do I create a file to write in another convenient location?

If I enter an absolute path, the code doesn't work...

MQL4 solved it this way - Write quotes into txt file with full path and file name
 
Interesting:
In MQL4 it was solved like this - Write quotes into a txt file with the full path and file name
Thanks, I will check it in mt5
Reason: