Spread values of bars ?

 
hi,

functions : CopySpread() and iSpread return the spread value of bars.

What's definition of spread for BARs ?!!! (as compared to tick spread)

Spread at any tick = Ask - Bid.
Ask and Bid can change each tick, and bars are accumulations of ticks.
so spread of bar is first spread of ticks of that bar ? (that's what i seen so far, by checking a few D1 bars.)
EDIT : or max spread of ticks of that bar ?
 
found this

So, the value of Bar Spread is the max value of tick spreads, belonging to that bar.

that Bar Spread value, can be retrieved by CopyRates, CopySpread, and iSpread.
but the current tick spread is retrieved by SymbolInfoInteger(SYMBOL_SPREAD).

Now that I'm answering my own threads, hope it clears it up for others wondering what returns what. :)
 
Code2219 or probably 2319:
found this

So, the value of Bar Spread is the max value of tick spreads, belonging to that bar.

that Bar Spread value, can be retrieved by CopyRates, CopySpread, and iSpread.
but the current tick spread is retrieved by SymbolInfoInteger(SYMBOL_SPREAD).

Now that I'm answering my own threads, hope it clears it up for others wondering what returns what. :)

That's incorrect information.

Forum on trading, automated trading systems and testing trading strategies

Can broker deny access to server's historic time-series/spread info?

Alain Verleyen, 2018.07.04 09:44

Not at all. It's an MT5 feature, not available with MT4. The broker can't nothing about that. The only problem is it's not well documented, so people are trying to use it with MT4.

Under MT5, the spread value of MqlRates is the minimum spread of this bar. On Metaquotes world, the spread is always related to Ask-Bid, never to high-low or whatever.

Actually it was the maximum in the past, but changed to minimum, I don't remember when.
 
Alain Verleyen:
Actually it was the maximum in the past, but changed to minimum, I don't remember when.

Right now in my MT5 terminal (build 1881), spread value of each bar is the max tick spread found in that bar.
So CopySpread and CopyRates return minimum spread in bar, and DataWindow shows max spread of bar :)


spread

 
Code2219 or probably 2319:

Right now in my MT5 terminal (build 1881), spread value of each bar is the max tick spread found in that bar.

Why are you thinking it's max spread found in that bar ?

 
Alain Verleyen:

Why are you thinking it's max spread found in that bar ?

because when I  look at values of smaller bars within that bar Open&Close times, it shows it was the max spread.

example : EURJPY
right now, last closed D1 bar (open time is : 2018-07-18) spread in Data-Window reads : 82
now, among all H1 bars that formed during 2018-07-18 00:00 till 2018-07-18 23:00, max spread found is : 82
so are all other smaller timeframes bars...

 
Code2219 or probably 2319:

because when I  look at values of smaller bars within that bar Open&Close times, it shows it was the max spread.

example : EURJPY
right now, last closed D1 bar (open time is : 2018-07-18) spread in Data-Window reads : 82
now, among all H1 bars that formed during 2018-07-18 00:00 till 2018-07-18 23:00, max spread found is : 82
so are all other smaller timeframes bars...

Well you reasoning is right.

However it's not coherent, checking current D1 and lower timeframe I can see it's the minimum.

Seems a weird logic. Bug or feature ?

 
Alain Verleyen:

Well you reasoning is right.

However it's not coherent, checking current D1 and lower timeframe I can see it's the minimum.

Seems a weird logic. Bug or feature ?

It's weird logic to consider the minimum spread occurrence of a bar. What possible use could one have for that?

Checking D1 and lower TF of different brokers on my terminal shows that it is not the minimum spread but something else. 

 
Alain Verleyen:

However it's not coherent, checking current D1 and lower timeframe I can see it's the minimum.

does "It's not coherent" mean I can find bars showing minimum spread in my terminal too ? (without changing anything)
also, can changing server/settings, or anything affect the bar spread values (or it's just calculated intra-terminal) ?

nicholi shen:

It's weird logic to consider the minimum spread occurrence of a bar. What possible use could one have for that?

Actually, i hoped to see minimum spreads of bar. [ honestly i want to calculate this : minimum_weighed_average among spreads occurring in lower 90% of spread population]

this Weighted_Average can be used to find a Standard Deviation value, which shows how much spread tend to get high out of acceptable-range.
and since normal formula for Standard Deviationis not suitable for spread values population, (since spread values are not standard  distributed and their curve isn't bell-shaped around their MEAN value)
so it would be great to be able to find a minimum of spreads, among a big-enough sample of spread values, and use it a base for Deviation calculation. (instead of mean value)

 
Code2219 or probably 2319:

does "It's not coherent" mean I can find bars showing minimum spread in my terminal too ? (without changing anything)
also, can changing server/settings, or anything affect the bar spread values (or it's just calculated intra-terminal) ?

I monitored on M1 live bars and it's the minimum of the bar without any doubt, at least when I checked.

Apparently on higher timeframe, which on MT5 are build from M1 data, it's the maximum of M1 bars of the considered timeframe candle. Need to be confirmed.

 
Code2219 or probably 2319:

does "It's not coherent" mean I can find bars showing minimum spread in my terminal too ? (without changing anything)
also, can changing server/settings, or anything affect the bar spread values (or it's just calculated intra-terminal) ?

Actually, i hoped to see minimum spreads of bar. [ honestly i want to calculate this : minimum_weighed_average among spreads occurring in lower 90% of spread population]

this Weighted_Average can be used to find a Standard Deviation value, which shows how much spread tend to get high out of acceptable-range.
and since normal formula for Standard Deviationis not suitable for spread values population, (since spread values are not standard  distributed and their curve isn't bell-shaped around their MEAN value)
so it would be great to be able to find a minimum of spreads, among a big-enough sample of spread values, and use it a base for Deviation calculation. (instead of mean value)

In that case you need to be working with ticks instead of bars.

Reason: