![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Actually I wanted to do something nice for FORES, but I guess it wasn't meant to be.
Long time ago I wrote a plug-in file for Magic, and now I tweaked it
I decided to do it for forex, but it was not meant to be.
If someone adds functionGetForexName to it, it will work for FOREX too.
The last 2 bytes are used to use a lot of wizards in one EA.
chart_id - is used to identify the chart (you can open as many identical symbols as you want)
Before any work with Magic, call the functionIsMyMagic, which will check if the magician belongs to the given EA
It's just not clear how to analyse a symbol if it can have anything in front of it :(
Create an array of used currencies, for example "EUR" "USD" "JPY"
Then use this function to pair all possible combinations, for example "EURUSD" "EURJPY" "USDEUR" "USDJPY" "JPYEUR" "JPYUSD".
And each time you check if there is an occurrence of this combination in the name of the symbol you are analyzing. If there is an occurrence - the six-letter name is found.
Create an array of used currencies, for example "EUR" "USD" "JPY".
Then use this function to pair all possible combinations, for example "EURUSD" "EURJPY" "USDEUR" "USDJPY" "JPYEUR" "JPYUSD".
And each time you check if there is an occurrence of this combination in the name of the symbol you are analyzing. If there is an occurrence - the six-letter name is found.
Do everyone a favour, add theGetForexName function
Thanks, but I only need to get the "bare" name of the pair (6 characters).
Maybe someone has a ready-made solution?
Added
It's just not clear how to analyse a symbol if it can have anything in front of the pair itself :(
copiers often use 2 parameters prefix and suffix (an additional symbol before EURUSD or after)
Thanks, but I only need to get the "bare" name of the pair (6 characters).
Maybe someone has a ready-made solution?
Added
It's just not clear how to analyse a symbol if it can have anything in front of the pair itself :(
StringFind
it depends on the broker I remember a situation that threw me into a kind of stupor - the client had an error, which really freaked me out and I figured that I would have to write crude kits for symbol recognition
2016.10.16 13:08:51.633 2016.08.25 04:39 Expert EURUSD(€),M15: OrderSend error 4106
2016.10.16 13:08:51.633 2016.08.25 04:40 Expert EURUSD(€),M15: unknown symbol name EURUSD(ˆ) for OrderSend function
In forex there are symbols mostly with suffixes, with prefixes very rarely, but always the base (pair) is written in capital letters and all the prefixes in small letters, so you can build on that.
In forex there are symbols with suffixes mostly, prefixes very rarely, but always the base (pair) is written in capital letters and all prefixes in small letters, so this is a good starting point.
It's more reliable, especially if it's an input parameter to reduce everything to single case StringToLower or StringToUpper and search StringFind. Then it doesn't matter where or what is added.
if only currency pairs are used:
For SymbolInfoString()
ENUM_SYMBOL_INFO_STRING
Identifier
Description
Property type
SYMBOL_BASIS
Name of the underlying asset for the derivative
string
SYMBOL_CURRENCY_BASE
Base currency of the instrument
string
SYMBOL_CURRENCY_PROFIT
Profit currency
string
SYMBOL_CURRENCY_MARGIN
Currency in which the margin is calculated
string
SYMBOL_BANK
Current quote source
string
SYMBOL_DESCRIPTION
String description of the symbol
string
SYMBOL_FORMULA
Formula for constructing the price of a custom symbol
string
SYMBOL_ISIN
Name of a trading symbol in the International Securities Identification Number (ISIN) system. The International Securities Identification Number is a 12-digit alphanumerical code which uniquely identifies a security. The presence of this characteristic is defined on the trade server side.
string
SYMBOL_PAGE
Address of the web page containing information on the symbol. This address will be displayed as a link when viewing the symbol properties in the terminal
string
SYMBOL_PATH
Path in the symbol tree
string
It is more reliable, especially if it is an input parameter, to reduce everything to a single case StringToLower or StringToUpper and search StringFind. Then it doesn't matter where or what is added.
But I don't understand the problem, why a character cannot be substituted there immediately, regardless of its length