Errors, bugs, questions - page 2050

 

Can you tell me if there is a working MT4 and MT5 demo server with weekend quotes?

 
Kirill Belousov:

Is there a working MT4 and MT5 demo server with quotes on weekends?

The demo server is a demo server because the trading is done not with real money but with "demo" :), and everything else (as well as the time of quotations) is almost like in real life.

 
Kirill Belousov:

Can you tell me if there is a working MT4 and MT5 demo server with weekend quotes?

There are no quotes at the weekend.
Can you emulate the arrival of quotes.
 

Take MT5 offline (left proxy, for example) and run the EA like this

void OnInit()
{
  Print("Hello World!");
}

Print in log will be only five seconds after start of advisor - BAG.


Run this indicator offline

#property indicator_chart_window

#property indicator_buffers 0
#property indicator_plots 0

int OnCalculate( const int rates_total,
                 const int prev_calculated,
                 const datetime &time[],
                 const double &open[],
                 const double &high[],
                 const double &low[],
                 const double &close[],
                 const long &tick_volume[],
                 const long &volume[],
                 const int &spread[] )
{
  return(rates_total);
}

void OnInit()
{
  const datetime LastBar = (datetime)SeriesInfoInteger(_Symbol, PERIOD_CURRENT, SERIES_LASTBAR_DATE);

  Print(LastBar);
  Print(Bars(_Symbol, PERIOD_CURRENT, LastBar - 24 * 3600, LastBar)); // 0
  Print(GetLastError());                                              // ERR_HISTORY_NOT_FOUND
}

We get a bummer in Bars. The same bummer will happen with repeated calls, for example, in OnTimer. But if you call Bars in Expert Advisor, everything will work. In the case of the indicator, this is clearly a bug.

2017.10.22 23:35:40.678 Terminal        Alpari Limited MT5 x64 build 1653 started (Alpari Limited)
2017.10.22 23:35:40.678 Terminal        Windows 7 Ultimate (x64 based PC), IE 09.00, Intel Core i7-2700 K  @ 3.50 GHz, RAM: 11310 / 16301 Mb, HDD: 827 / 30000 Mb, GMT+02:00
The explanation in the documentation doesn't explain anything

Если данные для таймсерии с указанными параметрами при вызове функции Bars() еще не сформированы в терминале, или данные таймсерии в момент вызова функции не синхронизированы с торговым сервером, то функция вернет нулевое значение.

Sending the request for refreshing the timeseries with the same period, as the indicator calling the refresh is extremely undesirable. The undesirability of the request for the same symbol-period as the indicator has is due to the fact that the historical data update is performed in the same thread which runs the indicator. Therefore, there is a high probability of a clash.

 

Forum on trading, automated trading systems and trading strategies testing

Features of mql5 language, subtleties and tricks

fxsaber, 2017.10.17 15:07

Descendant arrays are not able to convert to ancestor arrays. Element by element, on the other hand, yes. There is a limitation of ArrayCopy in this, which would be good to remove.

Something is wrong with the language in this situation

struct RATES : public MqlRates {};

void f1( RATES& ) {}

void f2( MqlRates& ) {}
void f2( MqlRates &[] ) {}

void OnStart()

{
  MqlRates a = {0};  
  
  f1(a); // 'a' - parameter conversion not allowed
  
  RATES b[1] = {0};
  
  b[0] = a; // no problem
  a = b[0]; // no problem
  
  f2(b[0]); // no problem
  f2(b);    // 'f2' - no one of the overloads can be applied to the function call
}


The yellow and red strings contradict each other. If inheritance from a structure is in progress and the constructor, assignment operator and fields are not changed, transformation of the descendant into the parent and vice versa must occur without problems. And the yellow lines prove it. However, in some situations bummers occur - red ones.
 
fxsaber:

Something wrong with the language in this situation

My compiler gave out


 
Kirill Belousov:

My compiler gave out

Yes, corrected the message.
 
   int tim=(int)FileGetInteger(aFileName,FILE_CREATE_DATE);
   int cur_tim=(int)TimeCurrent();

   RefreshRates();
   if(FileGetInteger(aFileName,FILE_EXISTS)==1)
      if(tim>0)
         if((cur_tim-tim)>120) 
           {
            Print(" ttt   "+TimeToString(cur_tim)+"  "+TimeToString(tim));
            FileDelete(aFileName);
            Print("Обновление файла ");
            return false;
           }

int tim=(int)FileGetInteger(aFileName,FILE_CREATE_DATE); does not update time.

I create a file and want to delete it after 60 seconds, the file is deleted andint tim=(int)FileGetInteger(aFileName,FILE_CREATE_DATE); returns the time of the first file after compilation. I see in Windows window that file is deleted and created with new time.

RefreshRates doesn't help...

 

int tim=(int)FileGetInteger(aFileName,FILE_MODIFY_DATE);

Works correctly

 
Vladimir Pastushak:

int tim=(int)FileGetInteger(aFileName,FILE_CREATE_DATE); does not update time.

I create a file and want to delete it after 60 seconds, the file is deleted andint tim=(int)FileGetInteger(aFileName,FILE_CREATE_DATE); returns the time of the first file after compilation. I see in the Windows window that the file is deleted and is created with the new time.

RefreshRates doesn't help...

Where is the file creation code?

Do you close the file before deleting it?

What does RefreshRates have to do with it?

Are we talking about a five or a four?