Errors, bugs, questions - page 1808
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
There's really only so much to go around so far. By selecting the longest time. But it's additional expense of getting two time values at each OnBookEvent()...
Application to the SR#1674783
Please decide as soon as possible!
EmulateTimeTradeServer via GetMicrosecondCount. Either add the difference between TimeTradeServer and TimeCurrent in 99% of the BookEvent.
It is still a matter of getting a few parameters.
The question is not the number of parameters, but their total cheapness.
So, do you think that TimeTradeServer() will work faster than SymbolInfoInteger( _Symbol, SYMBOL_TIME )?
TimeTradeServer works through GetMicrosecondCount by adding the corresponding difference to TimeCurrent.
I don't know what you need to get. But saving money on microseconds doesn't seem reasonable to me.
TimeTradeServer works through GetMicrosecondCount by adding the corresponding difference to TimeCurrent.
I don't know what you need to get. But saving on units of microseconds doesn't seem reasonable to me.
I need to get the correct value of the current time. I'm querying the current time from OnBookEvent() to write the value of the parameter linked to the time. And I need the current time, not the past time, and preferably without the crutches of getting multiple time values and selecting the highest value. TimeCurrent() is supposed to handle this task (according to description in documentation). But it turned out that it doesn't do that now!
{
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));
}
Run through all symbols by querying SymbolInfoTick (+ CopyTicks). From there, scratch out the time in milliseconds.