Errors, bugs, questions - page 2096

 
elibrarius:

Hmm. Well find it ))))

int OnInit()
  {
   return(INIT_SUCCEEDED);
}

void OnTick()
  {
  int s[];
  CopySpread(_Symbol,_Period,0,1,s);
  Print(s[0]);
  }

So who told you that the spread field of the current bar equals the current spread or, for example, the minimum?

UseSymbolInfoTick, bars are a historical rudiment.

 
fxsaber:

So who told you that the spread field of the current bar equals the current spread or e.g. the minimum?

Use SymbolInfoTick, bars are a historical rudiment.

CopySpread - remembers the minimum - said practice, which in most cases turns out to be the criterion of truth. From it it is established that bar 2017.10.23 01:00 CopySprea=-3, as there was no less when checking against ticks.

I would call bars - a very necessary tool to analyse the past.

SymbolInfoTick is correct, but is it really the reason to leave CopySpread wrong? I understand that 1 pt. - is a trifle, I think, and fix it elementary s=s-1. That's all )

 
elibrarius:

SymbolInfoTick - it shows correctly, but is it really necessary to leave CopySpread wrong because of this? I understand that 1 pt. - is a trifle, I think, that it's elementary to correct it s=s-1. That's all )

Before running the tester, look at the bar history to see if it has a negative spread. It's a crooked field about nothing.

If the developers today would come up with MqlRates, there would be normal fields instead of this crap. But they have no time to reconsider this structure and have already made all sorts of nonsense out of it. So, we have got such a rudiment of history. And now they will be pulling this burden all the time.

 
elibrarius:

CopySpread - remembers the minimum - said practice, which in most cases proves to be the criterion of truth. From it it is established that bar 2017.10.23 01:00 CopySprea=-3, as there was no less when checking by ticks.

I would call bars - a very necessary tool to analyse the past.

SymbolInfoTick is correct, but is it really the reason to leave CopySpread wrong? I understand that 1 pt. - is a trifle, I think, and fix it elementary s=s-1. That's all )

If you pay attention, you may watch the minutes and see, that the last value of spread is remembered when a new bar appears.

 
Alexey Viktorov:

If you are careful, you can watch the minutes to see that the last spread value is remembered when a new bar appears.

Looked more closely - I agree, but in part.

Expert's code:

void OnTick() { 
  int s[];
  CopySpread(_Symbol,_Period,0,1,s);
  Print(s[0]);
  MqlTick last_tick;
  if(SymbolInfoTick(Symbol(),last_tick)) { Print(last_tick.time,": Bid = ",last_tick.bid, " Ask = ",last_tick.ask,"  SP = ",DoubleToString(last_tick.ask-last_tick.bid,5)); }
}

Here's a one minute printout - first the spread from CopySpread. Then calculated from Ask-Bid

2018.01.01 11:55:00.478 2017.10.23 01:00:00 14
2018.01.01 11:55:00.478 2017.10.23 01:00:00 2017.10.23 01:00:00: Bid = 1.17715 Ask = 1.17729 SP = 0.00014
2018.01.01 11:55:00.494 2017.10.23 01:00:00 9
2018.01.01 11:55:00.494 2017.10.23 01:00:00 2017.10.23 01:00:00: Bid = 1.17715 Ask = 1.17724 SP = 0.00009
2018.01.01 11:55:00.510 2017.10.23 01:00:00 9
2018.01.01 11:55:00.510 2017.10.23 01:00:00 2017.10.23 01:00:00: Bid = 1.17716 Ask = 1.17726 SP = 0.00010
...........
2018.01.01 11:55:01.023 2017.10.23 01:00:30 1
2018.01.01 11:55:01.023 2017.10.23 01:00:30 2017.10.23 01:00:30: Bid = 1.17704 Ask = 1.17705 SP = 0.00001
2018.01.01 11:55:01.876 2017.10.23 01:00:30 -1
2018.01.01 11:55:01.876 2017.10.23 01:00:30 2017.10.23 01:00:30: Bid = 1.17707 Ask = 1.17705 SP = -0.00002
2018.01.01 11:55:01.893 2017.10.23 01:00:31 -3
2018.01.01 11:55:01.893 2017.10.23 01:00:31 2017.10.23 01:00:31: Bid = 1.17707 Ask = 1.17703 SP = -0.00004

2018.01.01 11:55:01.909 2017.10.23 01:00:31 -3
2018.01.01 11:55:01.909 2017.10.23 01:00:31 2017.10.23 01:00:31: Bid = 1.17707 Ask = 1.17704 SP = -0.00003
2018.01.01 11:55:01.925 2017.10.23 01:00:32 -3
...........
2018.01.01 11:55:02.293 2017.10.23 01:00:48 -3
2018.01.01 11:55:02.293 2017.10.23 01:00:48 2017.10.23 01:00:48: Bid = 1.17702 Ask = 1.17707 SP = 0.00005
2018.01.01 11:55:02.309 2017.10.23 01:00:48 -3
2018.01.01 11:55:02.309 2017.10.23 01:00:48 2017.10.23 01:00:48: Bid = 1.17703 Ask = 1.17707 SP = 0.00004
2018.01.01 11:55:02.325 2017.10.23 01:00:49 -3
2018.01.01 11:55:02.325 2017.10.23 01:00:49 2017.10.23 01:00:49: Bid = 1.17707 Ask = 1.17707 SP = 0.00000

I.e. CopySpread value on the current bar = minimum.

But in the history of the bar the last value is really gone.

<DATE> <TIME> <OPEN> <HIGH> <LOW><CLOSE> <TICKVOL> <VOL> <SPREAD>
2017.10.23 01:00:00 1.17715 1.17720 1.17693 1.17707 64 0 0

Most of the time (min 10 checked), but there are glitches here too.
Here is the problem described above on 2017.10.23 00:53

In the history.

2017.10.23 00:53:00 1.17685 1.17725 1.17685 1.17725 8 0 9

And on the ticks:

2018.01.01 11:54:59.009 2017.10.23 00:53:43 48
2018.01.01 11:54:59.009 2017.10.23 00:53:43 2017.10.23 00:53:43: Bid = 1.17724 Ask = 1.17733 SP = 0.00009
2018.01.01 11:54:59.025 2017.10.23 00:53:43 48
2018.01.01 11:54:59.025 2017.10.23 00:53:43 2017.10.23 00:53:43: Bid = 1.17725 Ask = 1.17736 SP = 0.00011
2018.01.01 11:54:59.041 2017.10.23 00:53:43 48
2018.01.01 11:54:59.041 2017.10.23 00:53:43 2017.10.23 10.23 00:53:43: Bid = 1.17725 Ask = 1.17737 SP = 0.00012 <<<<<<---------- last bar tick
2017.10.23 00:53
2018.01.01 11:54:59.057 2017.10.23 00:54:11 9
2018.01.01 11:54:59.057 2017.10.23 00:54:11 2017.10.23 00:54:11: Bid = 1.17728 Ask = 1.17737 SP = 0.00009 <<<<<<---------- first tick bar 2017.10.23 00:54 - here it matches

Checked the version that the spread from the first tick of the next bar goes into history. Not confirmed:

History
2017.10.23 00:59:00 1.17717 1.17723 1.17709 1.17715 14 0 3

1st tick of the next bar
2018.01.01 11:55:00.478 2017.10.23 01:00:00 14
2018.01.01 11:55:00.478 2017.10.23 01:00:00 2017.10.23 01:00:00: Bid = 1.17715 Ask = 1.17729 SP = 0.00014

History

2017.10.23 01:00:00 1.17715 1.17720 1.17693 1.17707 64 0 0

1st tick of the next bar
2018.01.01 11:55:02.342 2017.10.23 01:01:03 1
2018.01.01 11:55:02.342 2017.10.23 01:01:03 2017.10.23 01:01:03: Bid = 1.17707 Ask = 1.17708 SP = 0.00001

All in all - some mess with spreads (

 
elibrarius:

...

All in all - some confusion about the spreads (


 

MT4 b1090, many dozens of symbols in Market Watch, several charts open. terminal.exe is eating 0-1% CPU.

MT5 b1730, only GBPUSD MetaQuotes-Demo in Market Watch, no charts. terminal64.exe is eating 2-3% CPU.

Is this normal?

 
fxsaber:

MT4 b1090, many dozens of symbols in Market Watch, several charts open. terminal.exe is eating 0-1% CPU.

MT5 b1730, only GBPUSD MetaQuotes-Demo in Market Watch, no charts. terminal64.exe is eating 2-3% CPU.

Is it normal?

The topic has come up several times. MT5 is a bit more CPU-intensive because it broadcasts more information.

But it is incorrect to compare within 1-2%.

 
Andrey Khatimlianskii:

The topic has come up several times. MT5 is slightly more CPU intensive because it broadcasts more information.

But it is incorrect to compare within 1-2%.

Several browsers with dozens of open tabs in read mode eat zero. It's strange when a completely empty terminal consumes like a torrent client. And it doesn't change if you unplug the internet from the computer.

 
fxsaber:

Several browsers with dozens of tabs open in read mode eat zero. It's strange when a completely empty terminal consumes like a torrent client. And it doesn't change if you unplug it from the computer.

It's incorrect to compare it with a browser. Background tabs, as far as I can see, don't consume resources at all.

And the terminal receives ticks and builds a time-series, regardless of whether the chart is active or not, so that when you switch to it, it shows the current information without delays.

But I'm not really defending MT, just pointing out that no one has ever bothered to make a full-fledged comparison with all the calculations for the service-desk.

Reason: