Different Broker Information

 

Different Brokers have Different quotes for EURUSD, such as EUR/USD, EUR.USD, and EURUSD2. So trying to use the market info function in the following way.....

maxlots = MarketInfo("EURUSD",MODE_MAXLOT);

won't return the value if you're using a broker that has a quote of say EUR.USD.

Is there a way to use a universal value that will recognize EURUSD on ALL brokers?

Any help in this area would be greatly appreciated,

Thanks,

BB

 
Bauer_Boy:

Different Brokers have Different quotes for EURUSD, such as EUR/USD, EUR.USD, and EURUSD2. So trying to use the market info function in the following way.....

maxlots = MarketInfo("EURUSD",MODE_MAXLOT);

won't return the value if you're using a broker that has a quote of say EUR.USD.

Is there a way to use a universal value that will recognize EURUSD on ALL brokers?

Any help in this area would be greatly appreciated,

Thanks,

BB

If it is OK to use the symbol of the chart you apply the EA to, you can use

maxlots = MarketInfo(Symbol(),MODE_MAXLOT);

or if you need to use a different symbol from the chart, I think you are stuck. Perhaps you can a bunch of #defines at the top of you EA to make it easier to update, e.g.

#define EURUSD "EUR.USD"
#define USDJPY "EUR.USD"
...
maxlots = MarketInfo(EURUSD,MODE_MAXLOT);
...
maxlots = MarketInfo(USDJPY,MODE_MAXLOT);
...

Cheers

Jellybean

 
Bauer_Boy:

Different Brokers have Different quotes for EURUSD, such as EUR/USD, EUR.USD, and EURUSD2. So trying to use the market info function in the following way.....

maxlots = MarketInfo("EURUSD",MODE_MAXLOT);

won't return the value if you're using a broker that has a quote of say EUR.USD.

Is there a way to use a universal value that will recognize EURUSD on ALL brokers?

Any help in this area would be greatly appreciated,

Thanks,

BB

IBFX uses EURUSDm on mini-accounts

Parse the Symbol() output.

if char 4 is A-Z then sep="" else sep=char 4

if string length > 6 and sep="" then trailing=char 7 else ""

newSymbol=cur1+sep+cur2+trailing; // GBPJPY, GBP/JPY, GBPJPYm

 

Using the symbol output seems to work fine, thank you Jellybean. Roeder, thanks for your help, interesting analysis.

BB

Reason: