MQL4 - automated forex trading   /  

Forum

MarketInfo

Back to topics list To post a new topic, please log in or register

avatar
21
Brygada 2010.02.09 07:50 

A very simple problem.


BuysSpread = MarketInfo("EURJPY",MODE_ASK);

Comment("BuysSpread ", BuysSpread);

On the output it shows zero. The current chart is GBPUSD.

Can somebody please help?

article

Trend-Hunting

The article describes an algorithm of volume increase of a profit trade. Its implementation using MQL4 means is presented in the article.


avatar
791
gordon 2010.02.09 08:00 
Brygada wrote >>

A very simple problem.


BuysSpread = MarketInfo("EURJPY",MODE_ASK);

Comment("BuysSpread ", BuysSpread);

On the output it shows zero. The current chart is GBPUSD.

Can somebody please help?

Make sure BuysSpread is of type double and try this:

int digits = MarketInfo("EURJPY", MODE_DIGITS);
Comment("BuysSpread ", DoubleToStr(BuysSpread,digits));



avatar
21
Brygada 2010.02.09 08:21 
gordon wrote >>

Make sure BuysSpread is of type double and try this:


Thanks Gordon,

looks like some misunderstanding.

I am on GBPUSD chart and I need to get spread of EURJPY, actually


int Spread;

Spread = (MarketInfo("EURJPY",MODE_ASK)-MarketInfo("EURJPY",MODE_BID))/Point;

Comment ("Spread ", Spread);


I get zero on the output instead of actual spread.


avatar
791
gordon 2010.02.09 08:36 
Brygada wrote >>

Thanks Gordon,

looks like some misunderstanding.

I am on GBPUSD chart and I need to get spread of EURJPY, actually


int Spread;

Spread = (MarketInfo("EURJPY",MODE_ASK)-MarketInfo("EURJPY",MODE_BID))/Point;

Comment ("Spread ", Spread);


I get zero on the output instead of actual spread.

Oh, I was wondering why u were calling it BuysSpread while getting Ask price... :)


Anyway, do this:

int Spread = MarketInfo("EURJPY",MODE_SPREAD);
Comment ("EURJPY Spread ", Spread);
For future reference, here are the identifiers of MarketInfo() function -> http://docs.mql4.com/constants/marketinfo.


Note that u were using the predefined variable Point, but it is the point for GBPUSD, not the point for EURJPY. To get EURJPY point while expert runs on another pair's chart, should use the identifier MODE_POINT with MarketInfo().


avatar
179
EADeveloper 2010.02.09 08:42 
Brygada wrote >>

A very simple problem.

BuysSpread = MarketInfo("EURJPY",MODE_ASK);

Comment("BuysSpread ", BuysSpread);

On the output it shows zero. The current chart is GBPUSD.

Can somebody please help?

You are in backtest?

Here you dont get values of other currency...


avatar
21
Brygada 2010.02.09 09:24 

That was my mistake.

The actual symbol name in my platform is EURJPYs.

Thanks for quick help.

Very nice forum.

Back to topics list  

To add comments, please log in or register