Need some help with some MT5 code - page 2

 
whroeder1:

Really? EnumToString(anInt) compiles? I don't think so.

It was you that started the argument "Please pay attention to what you post. Your code doesn't compile as mql5." My post was about self-documenting code. You brought up a nit.

I am trying to solve problems through dialogue, but it seems it's not possible with you.

Don't post mql4 code on a mql5 topic ! Is it more clear like that ? If you don't know what is mql5 code that compiles then refrain from answering.

 
giogee:

As before it has worked @Lakshan Perera 

some 1 has recommended i use this. I'm not a coder I paid for the code to be written then when i asked for the message to be edited the coder wanted more money so i thought i would ask.

how would i use the code below. I just want to see which works better  

IntegerToString(Period()) IntegerToString(Symbol())

IntegerToString(Symbol()) is wrong, because Symbol() returns a string already...
By better if you mean you want to cut that "PERIOD_" part, use the following,

txt = Symbol()+" "+ StringSubstr(EnumToString(_Period),7);
 
-
Petr Nosek: You should try it (EnumToString(_Period)) first and then you should apologize to Alain and Lakshan. As I know you, you can't admit that you are wrong. Let everyone do it in his own way.
    1. I admit I'm wrong when I am.
    2. It does not work on MT4
      #property strict
      void OnStart()
      {
       string t=EnumToString(_Period);
      }

      '_Period' - parameter for EnumToString must be an enumeration    testscr.mq4    4    24

      because _Period is an int per the documentation.
                _Period - Predefined Variables - MQL4 Reference

    3. I don't have MT5 but per the documentation, _Period is still an int. So it shouldn't compile. If it actually does, then I am still not wrong, the documentation is.
                Predefined Variables / _Period - Reference on algorithmic/automated trading language for MetaTrader 5

  1. I can't stop anybody from doing "it their way." I have decades more experience coding than you, so if you don't want to heed my advice, that's fine, but don't tell me to stop voicing my opinion. Who do you think you are?

  2. Alain Verleyen:

    I am trying to solve problems through dialogue, but it seems it's not possible with you.

    Don't post mql4 code on a mql5 topic ! Is it more clear like that ? If you don't know what is mql5 code that compiles then refrain from answering.

    Other can copy/paste problem with DoubleToStr vs DoubleToString, I didn't post MQL4 code. I posted generic functions. Show me what won't compile.

 
whroeder1:
    I don't have MT5 but per the documentation, _Period is still an int. So it shouldn't compile. If it actually does, then I am still not wrong, the documentation is.
              Predefined Variables / _Period - Reference on algorithmic/automated trading language for MetaTrader 5

    I hear you, but it compiles in MQL5.., and it is true it does not compile in MQL4 , Anyway, the question was about MQL5, that's why gave that answer. (I have used it in the past)

    and guys, I think we need to cool down little.. :D

     
    whroeder1

    No surprise lol

    1. I admit I'm wrong when I am.  => This is really good joke.
    2. It does not work on MT4.  => You spread this forum by writing "Why did you post your MT4 question in the Root / MT5 Indicators section instead of the MQL4 section" and similar templates and now you post MT4 code to MT5 topic.
    3. I don't have MT5 but ... If it actually does, then I am still not wrong.  => As I said you can't admit that you are wrong.
    4. I have decades more experience coding than you.  => Maybe but how can you know it. I have just 30+ years coding experience and if you have decades more then I understand your style now.
    5. if you don't want to heed my advice  => I don't need your advice. Another thing is that I always appreciate help if I need it.
    6. don't tell me to stop voicing my opinion.  => I've never told you to stop voicing your opinion. It would be better (with your experience) if you voice much more helpful advice and much less useless templates.
    7. Who do you think you are?  => I'm happy man and my name is Petr ;-)
     
    whroeder1:
    -
    1. Other can copy/paste problem with DoubleToStr vs DoubleToString, I didn't post MQL4 code. I posted generic functions. Show me what won't compile.

    William I will not continue this stupid dispute.

    You posted mql4 code that doesn't compile under mql5 and it's confusing for people who are not professional coders. This is obvious to everyone except to you. Why is it so hard to say "That's right I will pay more attention to such things" ?

     

    I think both are correct or at least can be used.

    Comment(EnumToString(_Period)+" "+IntegerToString(_Period));

    This results in "PERIOD_M30 30" when dropped on a 30 min chart and "PERIOD_D1 16408" on daily.

    Whroeder's code (should result in D1, not PERIOD_D1) is definitely the proper way if output would be read by humans.
     
    Petr Nosek:
    1. I admit I'm wrong when I am.  => This is really good joke.
    2. It does not work on MT4.  => You spread this forum by writing "Why did you post your MT4 question in the Root / MT5 Indicators section instead of the MQL4 section" and similar templates and now you post MT4 code to MT5 topic.
    3. I don't have MT5 but ... If it actually does, then I am still not wrong.  => As I said you can't admit that you are wrong.
    4. I have decades more experience coding than you.  => Maybe but how can you know it. I have just 30+ years coding experience and if you have decades more then I understand your style now.
    5. if you don't want to heed my advice  => I don't need your advice. Another thing is that I always appreciate help if I need it.
    6. Who do you think you are?  => I'm happy man and my name is Petr ;-)
    1. No one has shown me where I'm wrong, joker
    2. I didn't post a MT4 question. I posted generic code.
    3. I'm not wrong when I go by the documentation and it's wrong. Had it been correct I would have posted correct code also.
    4. Try 46+.
    5. I didn't give you any since you didn't ask a question.
    6. And arrogant enough to tell people to stop voicing opinions.
    Alain Verleyen: You posted mql4 code that doesn't compile under mql5. This is obvious to everyone except to you.

    What MT4 code? Show me the compile errors! If it's so obvious, show me. How can I learn where I am wrong, if no one will answer my direct question?

     
    whroeder1:

      ..

      What MT4 code? Show me the compile errors! If it's so obvious, show me. How can I learn where I am wrong, if no one will answer my direct question?

      That's not serious. You edited your code AFTER my post, then you made all a fuss about it.

      You are dishonest.

       
      Alain Verleyen: That's not serious. You edited your code AFTER my post, then you made all a fuss about it. You are dishonest.

      I am serious.

      I edited the code after your first post, and commented that you are complaining about a nit.

      It is you that has, after that, repeatedly called it MT4 code, when it is generic MT code snippet, and with the typo fixed, MT5 code.

      You have gone so far as to strike out everything over a nit, a typo. You are dishonest. Not once have you stated what was wrong with it. (The noobs still won't know.)

      It was a month ago that you asked me whether I wanted to be a moderator. I don't think you should be. Most of the time you're reasonable. But sometimes you go off the deep end and become fixated or inconsistent. So last month I'm good enough to be a moderator but today I'm dishonest. LOL. I'm done with this thread.


      Alain Verleyen: Please stop that. WHRoeder is one of most helpful coder here. You don't like it, ignore him. Insults are not acceptable.
      Reason: