Please use this to post code . . . it makes it easier to read.
Do you have any other calls to MarketInfo in your code ?
I suspect there is a typo . . or the OP has declared one of the modes he is using as a variable, eg . .
int MODE_SPREAD; double MarketSpread = MarketInfo(CurrencyPair, MODE_SPREAD)*Point;
I think the error is saying that the "type" being passed to MarketInfo has a value of 0 and that isn't valid.
RaptorUK:
I suspect there is a typo . . or the OP has declared one of the modes he is using as a variable, eg . .
I think the error is saying that the "type" being passed to MarketInfo has a value of 0 and that isn't valid.
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ void start(){ int MODE_SPREAD; double MarketSpread = MarketInfo(Symbol(), MODE_SPREAD)*Point; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~I agree with you that he may have other calls to market-info which could be causing problems. But the above would not compile. That would suck if constant names could be used as variable names. More than likely it's not my earlier guess either because even if the Instrument is Disabled by broker, it'd probably more than likely still give the market info. But we can only guess based on the codes we see and what he'd explained.
Could be a typo which was then added as a variable due to the error from the compiler.
Yep, the reason is because Mode=0. So while he thinks he's passing MODE_SPREAD or What_Ever. He's actually passing one of his Variables. Gotcha.
But when I tried during normal trading hours (non-news period), it was running fine.
ubzen:
Yep, the reason is because Mode=0. So while he thinks he's passing MODE_SPREAD or What_Ever. He's actually passing one of his Variables. Gotcha.
Yep, the reason is because Mode=0. So while he thinks he's passing MODE_SPREAD or What_Ever. He's actually passing one of his Variables. Gotcha.
ubzen, when you say that I am passing one of my Variables, can you explain? I dont get it...
I was able to duplicate your error you using something like this. double MarketSpread = MarketInfo(Symbol(), 0). So somehow the MODE_WHATEVER is 0. You'll need to check all MarketInfo Calls within your code and make sure you don't have something like Mode_Spread or MODE_SPREAD*Point or MODE_SPRAED.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
Got an error for MarketInfo. The EA error "unknown mode 0 for MarketInfo" for the trade entry for the codes below:
double MarketSpread = MarketInfo(CurrencyPair, MODE_SPREAD)*Point;
double AskPrice = MarketInfo(CurrencyPair, MODE_ASK);
double BidPrice = MarketInfo(CurrencyPair, MODE_BID);
where CurrencyPair is the currency pair that I wanted to get for info. The data that I have entered for the variable are the major currency pairs such as "GBPUSD", "EURUSD", etc. This normally happens during news hour.
Anyone faced the same issue before?
Thanks.