I'm trying to get my head around MarketData updates. In particular I'm trying to use the data to work out the correct spread.
The docs at the above link indicate that when x.MarketDataType is (Ask | Bid | Last) that x.Price represents that particular price. However on the MarketDataEventArgs object the x.Ask and x.Bid properties often do not always equate to x.Price.
I wrote the attached indicator to print out MarketData updates where x.MarketData type is (Ask | Bid) and where x.Price does not equal the relevant x.Ask x.Bid property.
I've also printed out the value of GetCurrentBid() and GetCurrentAsk().
The output of this indicator shows that there are many market updates where x.Price is not equal to the corresponding x.Ask/x.Bid property in the EventArgs. Furthermore there are some updates where GetCurrentBid/GetCurrentAsk also does not equal the expected value from x.Price.
I've attached an output from my indicator with highlighting.
The reason I've undertook this analysis is because on certain CFD instruments with Forex.com such as Index CFDs (SP500/UK100) Forex.com provide guaranteed fixed spreads - their own platform shows the spread fixed as expected. If I use GetCurrentAsk() - GetCurrentBid() in an indicator, it always gives me the correct spread; and on these CFD instruments its always fixed, as expected. However using MarketDataEvents I cannot establish the correct way to calculate the spread, my calculated spread jumps around all over the place, I've tried various ways to calculate this, but I can't get the correct fixed spread.
I've done my analysis on Crude oil futures to ensure this isn't something peculiar to Forex.com / CFDs.
I'd be very grateful if someone could help me to understand how to interpret these market data updates in order to obtain the correct values for bid and ask to calculate the spread.
Thanks,
Kevin.
Comment