Download MetaTrader 5
To add comments, please log in or register
Looking for like-minded people? You will find lots of them on the Forum!
traderathome
84
traderathome 2015.02.14 20:24 
What code can accomplish importing the current bid and ask price of the currency pair that would be in the account base currency, and that would be used in the TICKVALUE calculation?   I ask because more and more brokers are prostituting MT4 data feed by not including incorrect values which the interfere with proper computations within user coding when calling up a prostituted value MQL4 code variable.   Case in point, some brokers have incorrect data for "MarketInfo(Symbol(),MODE_TICKVALUE).    The only way to get the correct TICKVALUE is to compute it.  The formula requires bid/ask data from a pair which is not the chart pair.  So, how can the bid and ask price of this other pair be obtained via MQL4 code?
Keith Watford
Moderator
7979
Keith Watford 2015.02.14 22:28  
MarketInfo with MODE_BID or MODE_ASK
traderathome
84
traderathome 2015.02.15 14:10  
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!
Alain Verleyen
Moderator
28635
Alain Verleyen 2015.02.15 14:26  
traderathome:
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 GumRai 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.

Keith Watford
Moderator
7979
Keith Watford 2015.02.15 22:15  
traderathome:
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. 

whroeder1
13630
whroeder1 2015.02.16 13:40  
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
84
traderathome 2015.02.19 17:29  
WHRoeder:
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()

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.
whroeder1
13630
whroeder1 2015.02.19 17:53  

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.

Carl Schreiber
5954
Carl Schreiber 2015.02.19 19:13  
traderathome:
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.
May be it helps if you start reading? Start with MatketInfo() in e.g. the editor's reference!
/
To add comments, please log in or register