Type of Array Needed to include Currency Pairs description ?

 

Hi,

Still a NewtBee and WillBee for quite some time by the looks of things.

I’m creating an array that I want to store various information about trades such as their currency pairs descriptions, MagicNumbers, perhaps some text: Comments and WHU ???

Do I have to create and define it as a ‘string’ array in order to store text such as EURUSD and other text in it, or can I do this with a ‘double’ information type?

If I do create it as a string array, will other parts of the programs still recognize numbers stored in it as numerical values or will they subsequently only be seen as text strings ?

As always, thanks to one and all for any assistance!

 

If u do it as a string array then any numerical part will have to be converted in order to be used as a number type (see conversion functions: https://docs.mql4.com/convert). But that would make the program much longer to code and much slower to execute. A more preferable method would be to use defines, such as:

#define SYM_EURUSD 0
#define SYM_EURCHF 1

etc...

This will allow u to use an array of doubles (unless u r absolutely sure u don't need doubles - then use an array of ints).

 
gordon:

If u do it as a string array then any numerical part will have to be converted in order to be used as a number type (see conversion functions: https://docs.mql4.com/convert). But that would make the program much longer to code and much slower to execute. A more preferable method would be to use defines, such as:

#define SYM_EURUSD 0
#define SYM_EURCHF 1

etc...

This will allow u to use an array of doubles (unless u r absolutely sure u don't need doubles - then use an array of ints).



Hi Gordon,

I don't want to get into a position where I can't use numerical values and I want to keep the processing overhead low and the execution speed high, so I appreciate the info. Your suggestion sounds like the way to go.

For clairification: then I am correct in that I couldn use text strings in a numerical array, or is there some feature that will allow this?

.

The page link you posted for me comes back as being non-existent.

But I'm finding that the search feature here is quite erratic. I was going to post a query to find out if others had similar problems and it is something on the website Data Base management or if the trouble was at my end?

.

Thanks for your assistance Gordon, much appreciated (< 8)

Regards,

Doug

 
DougRH4x:

Hi Gordon,

I don't want to get into a position where I can't use numerical values and I want to keep the processing overhead low and the execution speed high, so I appreciate the info. Your suggestion sounds like the way to go.

For clairification: then I am correct in that I couldn use text strings in a numerical array, or is there some feature that will allow this?

Correct, you can't use text string in a numerical array. Using defines is a nice little trick of putting non-numerical data in a numeric array in a way which makes the code readable.


The page link you posted for me comes back as being non-existent.

But I'm finding that the search feature here is quite erratic. I was going to post a query to find out if others had similar problems and it is something on the website Data Base management or if the trouble was at my end?

.

Thanks for your assistance Gordon, much appreciated (< 8)

Regards,

Doug

The link works fine on my side. Try searching for conversion functions.