Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1875

 
Mihail Matkovskij #:
If you answer questions from newbies only, there will be no trolling at all. Unless, of course, he turns out to be a troll.

If you respond with normal information, or at least to comments, don't start writing nonsense in packs.

 
Artyom Trishkin #:

Drink foamy beer - you'll have a great bellyful...

You take that and you answer the new guy's question yourself.

Profit.

You think I'll be gone long?))) I only went to the fridge.

And how will the newcomer feel, not the poison you might think of, when given two different pieces of advice... Who to listen to? That's where it all started. That's it, let him give all the nonsense advice he writes, I don't care. CodeBase is riddled with it even without this kind of crap. A little more, a little less, whatever.
 
That's it! Everybody stop. Charging the flüggeheimen
 
What a bunch of "market women"! That's it. Let Artyom deal with you himself. That's his job. And I'm not going to respond to your flubbery.
 
Mihail Matkovskij #:
It's just some "market women"! That's it. Let Artem deal with you. It's his job to deal with you. And I'm not going to respond to your flubbery.

It applies to everyone.

 
Artyom Trishkin #:

It touches everyone.

Well, Artem... you've scared everyone away. No one even asks anything... Then I'll go get some vodka, beer doesn't help...

 
Alexey Viktorov #:

Well, Artem... you've scared everyone away. No one even asks anything... Then I'll go get some vodka, beer doesn't help...

It's all about the hot Finnish guys, not the ones who need help. On the topic of the branch, of course.

 
Alexey Viktorov #:

Well, Artem... you've scared everybody away. Nobody even asks anything... Then I'll go for vodka, beer doesn't help...

Maybe I'll go straight to the extreme, for drugs :)

In general, it's sad when a technical forum, in a technical thread, starts a clownery.

 
And in general, after not the first pint of beer and vodka, a thought. The point of an intu loop is to find out what the user has entered and send it back to ))))
 

Going back to StringToEnum, I found a relatively universal solution for cases where enumerations are numbered sequentially (1, 2, 3, ...).

For explicit numbering of sequences with large values will not work (e.g. ENUM_TIMEFRAMES). But, if you use your own enum without explicit numbering (or at least sequential numbering) - solution will work.

template<typename T>
bool StringToEnum(const string i_str, T &o_val)
{
   for(int i = 0; i < 256; i++)
      {
         o_val = (T)i;
         if(StringCompare(EnumToString(o_val), i_str, false) == 0)
            return(true);
      }
   o_val = WRONG_VALUE;
   return(false);
}

For all other cases you need bicycles, like static arrays of names of each possible value and string search in this array.