![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
I'm afraid to imagine how. Actually, I need a flexible variant, I don't need one string in unchanged form, but several different strings to form, in a loop... If it's possible, I'd like to see a more specific example...
...
You can also form more complicated conditions in #define into one line:
I don't know how to solve your problem, I haven't tried it. I'll have to experiment... ))
Maybe you may form several #define' s like this and then choose what you may need in a loop.
From string to enum you can prepare function with switch in advance. But you may have a very large number of options, apparently, and this method will not work...
Oh, here's another option! You can generate an mqh file, which is preconnected to the main file. That is, there should be a function that accepts a string and then generates an mqh file. The file will be overwritten all the time. That's exactly how it would work.)))
tol64, the #define option makes me break into a cold sweat... I'm not disputing that I can probably work out where I need to, but it's somewhere in the Olympiad on programming using non-standard ways - if only to achieve the result at any cost. I rejected the switch method for the same reason I described above: I do not want to add extra large blocks of code for an ideologically elementary task. It seems to me that there should be a quite simple standard way... Otherwise I'm starting to feel like a hacker trying to hack into the system and get the desired result in a sophisticated way...
There's a crucial question in the air: is it possible and how to access element by element the standard list of the same timeframe periods, timeframe object visibility list and the like ready-made lists? So far I have to manually fill the array by brute force and then retrieve from there what I need by index:
How much longer! Maybe you can take these elements out of the predefined array/list at once? It's one thing if I don't have enough knowledge... but I've never yet encountered anyone accessing predefined resources in someone else's code without first stuffing the cushion with copies of feathers...How can I prepare in advance a string with logical(?) enumeration like: OBJ_PERIOD_M10| OBJ_PERIOD_H4, to then just substitute in ObjectSetInteger () ready variable in the form of glued string? I tried to glue it together symbolically and then wrap it in StringToInteger(), but it did not work... BecauseOBJ_PERIOD_... - is an element of enum type but has the flag hex-equivalent of int type? Then this enumeration looks more like a bitwise OR operation...
...i.e. by adding the required enums to the int variable.
Unrealistically large spreads:
On AlpariFS server GBPUSD 648, USDCHF 110
GBPUSD 168, USDCHF 185 on the MQ-Demo server
other symbols are within the norm.
Is it a peculiarity of the thin market or a bug in MetaTrader 5?
Pound seems to have calmed down now, but spreads on Canadian and Aussie are 88 and 61 correspondingly. The Swiss is still stuck with 185 pips spread.
You can just add them up, that's how it works:
i.e. by adding the desired enums to the int variable.
How can I prepend a string with logical(?) enumeration like: OBJ_PERIOD_M10| OBJ_PERIOD_H4
Then this enumeration looks more like an OR bitwise operation...
It doesn't look like that. It is what it is.
Where do you take the enums from? They're sort of embedded in the language in the form of predefined (reserved) words/values.
From the enums, of course. Look in the help.
I don't want to create my own array of duplicate enums.
you'll have to have something at least... enums, arrays, defines.
otherwise you won't get any further than that
It doesn't look like that. It is what it is.
from the enums, of course. Look it up in the help.
You'll have to do something about it. Enums, arrays, defines.
You won't get any further than that.
Where do you take the enums from? They are sort of embedded in the language as predefined (reserved) words/values. Don't want to create my own array of duplicate enums.
don't understand the question)
ENUMs = integers, no predefined array/list.
don't understand the question)
ENUM_es = integers, no predefined array/list.
But why can't we access a repository of list items embedded in the language in the form of predefined names and constants? Where did the developers put all these enumerations...
You're using the same ENUM_TIMEFRAMES. What's that to you?