Hello comrades, just as the integer values for OP_BUY, OP_SELL, OP_BUYLIMIT, OP_SELLLIMIT, OP_BUYSTOP and OP_SELLSTOP are 0, 1, 2, 3 and 4, respectively, are there integer values for the traded instruments. That is, integer values for GBPUSD, EURUSD, USDJPY, etc. The idea is to run through the mentioned instruments using their integer values in a loop such as in the following codes:
int extern IntendedInstrumentInteger; \\ This value input as 11 say.
int i, FirstInstrumentInteger, LastInstrumentInteger;
for (i == FirstInstrumentInteger, i <= LastInstrumentInteger, i++)
if (i == IntendedInstrumentInteger)
Print ("Execute some codes");
If no such integer values exist, what is a good possible way to run through the currency pairs listed on the broker platform while searching for a particular one? Thank you in advance.
Use SymbolsTotal() and SymbolName() to loop through the list of the instruments.
Something like this:
bool all_symbols = true;
for(int i = 0; i < SymbolsTotal(all_symbols); i++)
string instrument = SymbolName(i, all_symbols);
// do something with a symbol name here
To add comments, please log in or register