MarketInfo()

 
I am trying to use the MarketInfo() command but I must be doing something wrong. The company I trade with is Oanda, in case that makes a difference. Here's my code:

double Spread = 0; 

Spread = MarketInfo(“eurusd”,MODE_SPREAD);
Alert(“Spread = ”,DoubleToStr(Spread,10));


Here's the output I get:

Spread = 0.00000000

Thanks for any help you can give.

Steve
 
guelphguy:
I am trying to use the MarketInfo() command but I must be doing something wrong. The company I trade with is Oanda, in case that makes a difference. Here's my code:

double Spread = 0; 

Spread = MarketInfo(“eurusd”,MODE_SPREAD);
Alert(“Spread = ”,DoubleToStr(Spread,10));


Here's the output I get:

Spread = 0.00000000

Thanks for any help you can give.

Steve
In Oanda MT4, is it "eurusd" or EURUSD" ?
 

Guelphguy and phi.nuts,

I typed this up in MetaEditor and the result is "spread = 16". The spread for the broker is 1.6 not 16. How can I adjust the code so that this comment displays 1.6 instead of 16?

double spread=MarketInfo("EURUSD",MODE_SPREAD);
   
Comment("spread = ",spread);

Thank you.

 
WhooDoo22:

Guelphguy and phi.nuts,

I typed this up in MetaEditor and the result is "spread = 16". The spread for the broker is 1.6 not 16. How can I adjust the code so that this comment displays 1.6 instead of 16?

Thank you.


That's 16 in Points not 16 in pips. Oanda must be a fractional pip broker.

To change 16 to 1.6 we must adjust the Point to work with 5 digit broker http://www.google.com/search?q=site:https://forum.mql4.com/%204/5%20digit 

 

phi.nuts,

I am not using Oanda as a test, I am using AlpariUS as a test for this code-

double spread=MarketInfo("EURUSD",MODE_SPREAD);
   
Comment("spread = ",spread);

I was curious to read what you or guelphguy would type as a response to my question.

Thank you for your reply and link you provided me.

BTW, can you please assist shenlongming by deleting this post OR messaging him with assistance on how to delete his posts?

I do not believe he understands how to delete his post(s).

Thank you.

 

phi.nuts, thanks. You correctly identified the problem. Once I changed "eurusd" to "EURUSD" everything works. Within the Terminal/Trade window the currency pair is shown in lower case so I assumed... incorrectly, it appears! Thanks again for your timely assistance.

 

Steve 

Reason: