Spread values of bars ? - page 2

 
nicholi shen:

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

actually I'm working with ticks.
just needed previous spread data to find some starting values, needed for formulas.

The procedure I follow is :
collect N spread data from ticks, and calculate Mean, weighted_average, Population Deviation etc. based on that N number of ticks.
N is initially calculated, based on average number of ticks per day, considering last 10 days or so .(that's D1 Tick Volumes averaged)

but, from EA start, until completion of spread collection (receiving Nth tick) , Ticks samples are too small* to be reliable for Mean and Min and Mode,and DEV calculations...

SO, you have any other idea how to achieve a reliable-enough starting point to answer this question :
What range of spread is considered normal for the current symbol ? (considering this question is asked right after EA start)
[ normal being defined as a range in population of data, that %80 or %90 or so of values happen in that range ]

hope I make sense, please share your idea if you think it could improve the procedure.
Thanks

EDIT:

* : not after a while. I use Sample-Standard_Dev formula when 10% of N ticks are arrived already. but that also needs a good starting MEAN or MODE value , to be valid

 

Hi @Code2219 or 2319,

Did you manage to find a workable solution beyond your suggestion above? I'd be very much interested to learn what you figured out in the end as will need to incorporate some logic for high-spread avoidance during trading for my EA. In the meantime, I also found the article linked below to be quite instructive on the subject -- the author also includes code for Bid-Ask Spread analysis that relies on CopyTicksRange() to retrieve recent historical tick data into a MqlTick structure array, which allows you to compute & analyse the spread distribution.

Bid/Ask spread analysis in MetaTrader 5 - MQL5 Articles

Bid/Ask spread analysis in MetaTrader 5
Bid/Ask spread analysis in MetaTrader 5
  • www.mql5.com
An indicator to report your brokers Bid/Ask spread levels. Now we can use MT5s tick data to analyze what the historic true average Bid/Ask spread actually have recently been. You shouldn't need to look at the current spread because that is available if you show both bid and ask price lines.
Reason: