Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1877
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
And faster version:
I agree about case-insensitive comparison, I wrote a more generalized bicycle for my own enum, where I don't use lower case.
But if for ENUM_TIMEFRAMES run this variant:
you can have time for a coffee while it picks up, e.g. for PERIOD_MN1 :)Get the prices from the straight lines on each bar and compare or find the difference, in places where the signs of the crossing differences change) There may be no equalities on the bar, by the way.
Help please, I draw two Gann lines and they intersect at a certain point, I need to know the coordinates of the intersection point of these lines.
I agree about comparison with case ignoring, I wrote a more generalized bicycle for myself, for my own enum, where I don't use lower case.
But if for ENUM_TIMEFRAMES this variant is run:
you may have time to drink coffee before it picks up, e.g. for PERIOD_MN1 :)Well, in ENUM_TIMEFRAMES the minimum and maximum values are known. That's why they can be specified explicitly.
With the rest of the enum, it is sufficient to know their approximate range of values. If constants are not specified in the enum declaration, the values there are usually from 0. i_max_enum can be specified by any two- or three-digit number: 50, 100, 255.
Right now, I need to write indicator settings and EA parameters to the database. At the same time I would like to have:
1. human-readable records
2. machine-readable records
3. stability to add new values in its custom enum, not necessarily at the end.
There is no problem with record - EnumToString, but developers did not make a reverse function, unlike all other types.
Have you ever tried to print an enumeration?
What do you think will be printed?
But creating an enumeration programmatically... yes. That would be interesting.
Why can't we loop through the input parametres? Why are you punishing us like this?
Well, in ENUM_TIMEFRAMES the minimum and maximum values are known. Therefore they can be set explicitly.
With other enum, it is enough to know their approximate range of values. If constants are not specified in the enum declaration, the values there usually start at 0. i_max_enum can be set by any two- or three-digit number: 50, 100, 255.
You can also experimentally get the minimum and maximum enum values. Write them down and specify them in StringToEnum for the most optimal speed:
Result of the script:
Open ENUM_ACCOUNT_INFO_DOUBLE and see. The number of constants is Count (14). Thus at the start of the application you can handle all necessary enum, write their minimum and maximum values and use StringToEnum corresponding min and max with the best speed.
P.S. The second variant of enumFindMinMax with INT_MIN and INT_MAX is really very slow. I tried it at first. Then I got tired of waiting for enumFindMinMax to finish and set values from -500 to 500.
Thus, I came to a conclusion that it is not necessary to use the whole int range at all.
I am facing a strange behaviour of the terminal.
The situation is as follows: an Expert Advisor is working in one chart, which at a certain moment opens another chart and sets a certain temple on the new chart. The latter template has been defined for launching the second EA on the new chart.
Everything works fine in the middle of the week, but when the market is closed, on weekends, the new templet is started on the new chart (as can be seen when changing the chart's appearance), but the second EA does not start there. The only way to "push" the second Expert Advisor is to manually start, on any chart, any script, even an absolutely empty one. Then the second expert starts working on a new chart.
I have written this code in the first Expert Advisor both using ChartOpen and ChartApplyTemplate functions and using CChart class - it always turns out the same way, in a closed market the second Expert Advisor on a new chart won't start until I manually "push" the terminal somehow.
Who may have faced with such a situation? How to cope with it, what direction to "dig"?
Who may have faced with such a situation? How to deal with it, what way to "dig"?
How do you know it doesn't start?
P.S.
Try it like this
You can find the constant in enum with a brute force function (same principle as#18697), translating it with EnumToString and comparing it with the desired constant. All that remains is to return the result.
Can we have an example (or at least a key line), because nothing comes to mind? Would you also have to go through a huge list of values, sifting through all the left-handed ones or would you just look for useful ones? At the moment I don't think there's anything to sift from, there are no left-handed ones in the list... but I can't get hold of the idea.