- How is TickValue calculated?
- Zero Divide (Found the issue - but why?)
- optimising gives different results each time I do it
The variable MarketInfo(Symbol(), MODE_BID) (or MODE_ASK) only works to return the current bid/ask price of the chart symbol. It does not return/import the bid/ask of a different symbol! Please read my question more thoroughly before assuming an answer! If a string is constructed in the name of a pair different from the chart pair, and that string is inserted in place of "Symbol()", the value returned for the bid or the ask is zero!
Please read the documentation more thoroughly before assuming a topic. The answer from Keith is correct, you have to add error checking and managing to your code.
Please also note that :
Negative discussions of any banking, brokerage and other financial institutions are not allowed.
The variable MarketInfo(Symbol(), MODE_BID) (or MODE_ASK) only works to return the current bid/ask price of the chart symbol. It does not return/import the bid/ask of a different symbol! Please read my question more thoroughly before assuming an answer! If a string is constructed in the name of a pair different from the chart pair, and that string is inserted in place of "Symbol()", the value returned for the bid or the ask is zero!
Your question was
"So, how can the bid and ask price of this other pair be obtained via MQL4 code?"
I don't see that reading it more thoroughly would interpret it in any other way.
traderathome: The variable MarketInfo(Symbol(), MODE_BID) (or MODE_ASK) only works to return the current bid/ask price of the chart symbol. | Correct. So don't use Symbol() |
traderathome: The variable MarketInfo(Symbol(), MODE_BID) (or MODE_ASK) only works to return the current bid/ask price of the chart symbol. | Correct. So don't use Symbol() |
My suggestion isn't totally worthless. If you can't use something other than Symbol, then why is it there in the function?
What is the error number, when you get zero? Are you handling 4066? What is your string? Is in in market watch? What is Symbol()/_Symbol?
Don't be asking for help if you want to be insulting.
Not using Symbol(), but instead creating a string representing the desired "other" symbol always returns a zero value. So, instead of "suggesting" totally worthless replies, I suggest you actually try to do this yourself. If successful, then you have something worth replying with.
Lorenze
please do not disrespect other posters unless you would like to be banned..
Note also that there is very little point when the posts are over 3 years old

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use