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?????
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.
Yup, my apologies. I was thinking of OrderSymbol(). I'll try to delete that last post to remove confusion.
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.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.