Errors, bugs, questions - page 1809

 
fxsaber:
Didn't check.
datetime NewTimeCurrent( void )
{
  static ulong PrevStartTime = GetMicrosecondCount();
  static datetime PrevTimeCurrent = TimeCurrent(); // TimeTradeServer()
  
  const datetime NewTimeCurrent = TimeCurrent(); // TimeTradeServer()
  const ulong NowTime = GetMicrosecondCount();
  
  if (PrevTimeCurrent < NewTimeCurrent)  
  {
    PrevTimeCurrent = NewTimeCurrent;
    
    PrevStartTime = NowTime;
  }
  
  return(PrevTimeCurrent + (datetime)((NowTime - PrevStartTime) / 1000000));
}
Thanks, but I don't think there's any point in such accuracy, especially since the time will anyway be "not real", but approximate and will depend on many factors. To be exact, we need the possibility to get the time from the server, i.e. if I set SymbolInfoDouble( _Symbol, SYMBOL_SESSION_TIME_INTEREST ), then I can get the time immediately, for example with SymbolInfoInteger( _Symbol, SYMBOL_SESSION_TIME_INTEREST ) (with millisecond precision). You'll be fine then!
 
fxsaber:
You could be more exact. For example, you could run through all the symbols by querying SymbolInfoTick (+ CopyTicks). From there, scratch out the time in milliseconds. I just don't understand what practical use it could be.

It's simple - the timing! It's all about it! There's a lot of data available now: ticks, sentiment, glass. Millisecond time is ONLY available for ticks! But what about the arrival time of the rest of the data? Glass doesn't have it. The sentiment doesn't have it either! Accordingly, if we collect all the data together - we won't be able to synchronize them! It's not possible to do a complex analysis! I don't understand why the developers don't pay proper attention to it. They have the data, but it's impossible to work with them properly! So we have to make something, but even "crutches", as it turned out, don't always work correctly.

 
The TimeCurrent() bug has been fixed, they said it would be on MQ-Demo today.
 
fxsaber:
A millisecond analogue of TimeCurrent is long overdue, with its reflection in the GUI.
+1. But for the values I described above, it's better to make a separate fetching option.
 
Alexey Kozitsyn:
The TimeCurrent() bug has been fixed, they said it would be on MQ-Demo today.
It would be good to make it a rule
 
fxsaber:
It would be good to make it a rule
Debatable, as no one but the creator of the application would understand anything. I think detailed descriptions are enough.
 

Compilation error: no function can be defined later, even if declared before

int f(); //объявление
static int i1 = f(); //Error: 'f' - function must have a body
int g()
{
static int i2 = f(); //нормально //даже если нет объявления
    return i2;
}
void OnStart()
{
    g();
}
int f() { return 0; }
 
A100:

Compilation error: You cannot define a function later, even if there is a declaration before

int f(); //объявление
static int i1 = f(); //Error: 'f' - function must have a body
int g()
{
static int i2 = f(); //нормально //даже если нет объявления
    return i2;
}
void OnStart()
{
    g();
}
int f() { return 0; }

Makes sense to me.

But why there is no error here is unclear.

int f(); //объявление
static int i1 = f(); //Error: 'f' - function must have a body
int g()
{
static int i2 = f(); //нормально //даже если нет объявления
    return i2;
}

class A
{
public:  
  A() { f(); }
};

A a;


void OnStart()
{
    g();
}
int f() { return 0; }
 
fxsaber:

Seems logical to me.

But why there is no error here is not clear.

An error is only logical if there is some sort of collision. If everything is done correctly - unnecessary errors take away flexibility

class A; //не зря же такую запись придумали
 
They've done something wrong again.

Compiled in version 1531. On startup I got:

2017.02.16 18:55:19.101 MQL5 'TradePanel.ex5' has newer unsupported version, please update your client terminal

Good thing it's not on a live account.