Bid vs. MarketInfo(Symbol(),MODE_BID)

 

Hi,

can someone explain me difference between "Bid" and MarketInfo(Symbol(),MODE_BID) ?

I used "Bid" value for some open positions and when I wanted to check opened position with OrderSelect it didn't find it and that order was opened with that price "Bid". After that I started to use MarketInfo(Symbol(),MODE_BID) and everything was right but I don't know difference?????

 
moneysmile:
can someone explain me difference between "Bid" and MarketInfo(Symbol(),MODE_BID) ?
Absolutely NO difference. The MI version allows you to get the bid of other pairs not just the chart pair.
 
albry:

I realize this is a VERY old post, but for those that rely on searches for answers, thought it might be useful to add to this...

Just to clarify (and whroeder1's comments tried to point this out), but they can be different.

They will give the same answer, WHEN the selected Symbol() is the same as the current chart symbol.

However since Bid and Ask return the values for the current chart symbol, and MarketInfo(Symbol(),MODE_BID/MODE_ASK/MODE_DIGIT...) returns information about the current OrderSelect'ed or specified Symbol()..., so they will give different results when the selected symbol is the different than the current chart symbol.

For example, if the code you are executing is on say EURUSD chart and the code is looking for a pair other than EURUSD, e.g. MarketInfo ("AUDCAD", MODE_BID), Bid and MarketInfo will naturally have different results. In Vlada's case he won't find the open positions using Bid except for those on the current chart (EURUSD).


You're wrong. Symbol() - is always the symbol of current chart and has nothing in common with last selected order. So MarketInfo(Symbol(),MODE_BID) is always the same as Bid. Don't mislead other people.

 
Stanislav Korotky:

You're wrong. Symbol() - is always the symbol of current chart and has nothing in common with last selected order. So MarketInfo(Symbol(),MODE_BID) is always the same as Bid. Don't mislead other people.

Hey Stanislav,

Yup, my apologies. I was thinking of OrderSymbol(). I'll try to delete that last post to remove confusion.

 
There is only one difference (assuming the symbol is the current _Symbol.) Bid (and other predefined variables) do not change in OnTick (unless RefreshRates is used.) MarketInfo returns the current value.
 
whroeder1:
There is only one difference (assuming the symbol is the current _Symbol.) Bid (and other predefined variables) do not change in OnTick (unless RefreshRates is used.) MarketInfo returns the current value.

Exactly what I wanted to comment!

So, of course there is a difference, and it is a big one, when your code is lengthy and includes many CPU-demanding calculations, between the beginning of the OnTick function to its end, the bid/ask prices might change, but not so for the predefined variables.

Reason: