Errors, bugs, questions - page 88

 
gumgum:

It's a shame I don't have the depo and profit function just for me

gives 1.#INF.

Servicedesk has already written...

and the zero after the dot can't be written like this
double pro=AccountInfoDouble(ACCOUNT_BALANCE)/10000.0;
 
sergey1294:
and you can't put a zero after the dot like this.

No matter how you spell it, it's still 1.#INF.

It doesn't seem to make any difference whether it's 10. or 10.0.

 
gumgum:

No matter how you spell it, it's still 1.#INF.

It doesn't seem to make any difference 10. or 10.0.

I just checked the expression.

double pro=AccountInfoDouble(ACCOUNT_BALANCE)/10000.; 
или 
double pro=AccountInfoDouble(ACCOUNT_BALANCE)/10000.0;

It doesn't give you an error, it works fine.

2010.08.07 22:27:13     проверка (EURUSD,M5)    pro = 0.5929100000000001
 
sergey1294:

Just checked the expression.

no error, everything works fine.

Of course it's fine and it will be fine!

I am using two libraries.... I won't describe the whole situation.

 
gumgum:

Of course it's fine and it will be fine!

I have two libraries in use.... I won't describe the whole situation.

Why would you ask why there is an error, there is no error in the expression you gave as an example, the error must be in something else.
 
sergey1294:
Then why ask why there is an error, there is no error in the expression you gave as an example, the error must be in something else.
I didn't ask.)
 
gumgum:
I wasn't asking).

Then what is the meaning of your post

Жадь конечно что нет функции депо и прибыли просто у меня

double pro=AccountInfoDouble(ACCOUNT_BALANCE)/10000.;

дает 1.#INF. 

Сервисдеск уже написал... 
 
sergey1294:

Then what is the meaning of your post

Where did you see the question? )))
 
gumgum:
Where did you see the question? )))
well if it wasn't a question, then apologies for trying to help with your problem.
 

I decided to test one strategy. But somehow the Expert Advisor started to behave strangely in the tester.

I wanted to use it for long periods. Although the algorithm is almost scalper. ;)


So I decided to check the data coming to enter the Expert Advisor.

I started an unpretentious Expert Advisor

input bool diskret=false;  // работать по открытию бара?

input bool File=true;
MqlTradeRequest mReq;
MqlTradeResult mRez;
int handle1,handle2;
double iBuffer1[],iBu1[];
double iBuffer2[],iBu2[];
double vol[22],OTS;
MqlDateTime newT,oldT;
datetime newTT,oldTT;

string FName;

int hF;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//--------------Set default vaules for all new order requests
   mReq.action=TRADE_ACTION_DEAL;
   mReq.magic=777;
   mReq.symbol=Symbol();                 // Trade symbol
   mReq.deviation=3;                     // Maximal possible deviation from the requested price
   mReq.type_filling=ORDER_FILLING_AON;  // Order execution type
   mReq.type_time=ORDER_TIME_GTC;        // Order execution time
   mReq.comment="MAMASKHA_"+IntegerToString(PeriodSeconds()/60,2);
//----------------------- Set Volume pi
    Print ("----- Start init ---");
   
   oldTT=TimeCurrent()+51;TimeToStruct(oldTT,oldT);
   oldTT-=oldT.hour; oldTT-=oldT.min;
   printf("%02d.%02d.%4d %2d:%2d   %3d",oldT.day,oldT.mon,
          oldT.year,oldT.hour,oldT.min,
          SymbolInfoInteger(Symbol(),SYMBOL_TRADE_STOPS_LEVEL));
   StringConcatenate(FName,mReq.comment,"_",oldT.year,"x",oldT.mon,"x",
         oldT.day,"_",oldT.hour,"_",oldT.min,".csv");
   if (File) {hF=FileOpen(FName, FILE_WRITE|FILE_CSV|FILE_COMMON);
              if (hF<-1) Print ("Ошибка открытия файла ",FName," ",
                            GetLastError());
              if (File) FileWrite(hF,oldT.day,oldT.mon,
                   oldT.year,oldT.hour,oldT.min,"I"
                );
               Print ("Start on ",FName);   
              }
   Print ("Start ",mReq.comment);                              
   return(0);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   if (File) FileClose(hF);
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {   

   bool poz=true;

   int i,per=PeriodSeconds();

   MqlTick tick;
   //------------------
   if(!SymbolInfoTick(Symbol(),tick))
     {
      Print("Failed to get Symbol info!",per);
      return;
     }
   
   newTT=tick.time;
   if(newTT<=oldTT+per+1)
       {if (diskret)return;}
   else
   {
     
      MqlRates rates[];
      
     int copied=CopyRates(Symbol(),0,0,1,rates);
     if(copied<=0)
        Print("Ошибка копирования ценовых данных ",GetLastError());
        else oldTT=rates[0].time;
          
      
      TimeToStruct(oldTT,oldT);
      printf("%02d.%02d.%4d %2d:%2d",oldT.day,oldT.mon,
                  oldT.year,oldT.hour,oldT.min);
      TimeToStruct(newTT,newT);
      printf(" New %02d.%02d.%4d %2d:%2d",newT.day,newT.mon,
                  newT.year,newT.hour,newT.min);            
      if (File) FileWrite(hF,oldT.day,oldT.mon,
                   oldT.year,oldT.hour,oldT.min,"I",
                tick.ask,tick.bid,tick.last,tick.volume);
    }
   

   return;
  }

and got a strange log. Who can tell me the reason for skipping of data periods?

And one more thing - the file, which must be created (xp2sp) in the directory is not detected.

Please clarify, I haven't look into MT5 for a long time and I'm completely lost...

:(