fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    String conversion from Double not working correctly

    Bug Reports
    2
    10
    1054
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • MMBInvest
      MMBInvest last edited by MMBInvest

      @admin @fxDreema

      I am dealin with this now for quite some time and now I acutally would like to ask for your support. There is an issue, that was mentioned by the way several times now in this forum, that Doubles are not converted correctly to Strings. It works 90% of the time, but then 10% it does not work. As I am using mql code directly, the issue must be produced by fxdreema.

      Capture1.PNG
      Capture2.PNG

      I used following code lines and all of them produce the same results:

      printProfit = DoubleToStr(AccountProfit(), 2);
      printProfit = DoubleToString(AccountProfit(), 2);
      printProfit = NormalizeDouble(AccountProfit(), 2);
      printProfit = StringSubstr(printProfit, 0, StringFind(printProfit, ".", 0) +3);

      It would be great if that issue could be resolved, as this messes up the text on charts and buttons.

      Thank you

      roar 1 Reply Last reply Reply Quote 0
      • roar
        roar @MMBInvest last edited by

        @MMBInvest it is a common issue with mql language itself, I think it would happen if you coded the whole thing in Metaeditor. https://www.forexfactory.com/thread/1190602-rounding-in-mql4

        NormalizeDouble often fails to cut the digits, but DoubleToString does work for me 100%.
        Can you show some example case in shared link?

        Need small help? Tag me in your post
        Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

        1 Reply Last reply Reply Quote 0
        • MMBInvest
          MMBInvest last edited by

          Ok, in this case I take back the fxdreema blaming ;o) - it is not working however, and it super annoying, because you cannot use this functions ...

          https://fxdreema.com/shared/qg1zUs2Wd

          1 Reply Last reply Reply Quote 0
          • roar
            roar last edited by roar

            The example doesn't compile, but I assume the printProfit is a string variable

            Need small help? Tag me in your post
            Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

            1 Reply Last reply Reply Quote 0
            • MMBInvest
              MMBInvest last edited by

              Yes, it is just the part where the function is used ... I can make it compileable ... this one compiles now: https://fxdreema.com/shared/OtJ389D1d

              1 Reply Last reply Reply Quote 0
              • roar
                roar last edited by

                Its difficult to reproduce the bug with this, even when making it backtestable: https://fxdreema.com/shared/hPqJMbjyb

                Can you find some number that produces the infinite zeroes with StringToDouble?

                Need small help? Tag me in your post
                Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                1 Reply Last reply Reply Quote 0
                • MMBInvest
                  MMBInvest last edited by

                  So, now if I use the same code for pure mql4 and for fxdreema, I don't get the issue with the pure code (see attached example code) whilst fxdreema will created this long numbers ... but again, not always, it is ok for a minute and then it shows the long numbers once or twice, and then it is ok again, still it is annoying not useable that way... no work-around is working (!) EVEN if I convert everything in strings and then use string functions to build something useable ... the same behaviour... I mean, a string has nothing to do with the number conversions, and it is still not working.

                  Profit-Loss Meter v2.mq4

                  1 Reply Last reply Reply Quote 0
                  • MMBInvest
                    MMBInvest last edited by

                    Video

                    1 Reply Last reply Reply Quote 0
                    • MMBInvest
                      MMBInvest last edited by

                      The video shows the problem ... how its working until there is a glitch ... so I will remove this and don't use it anymore.

                      roar 1 Reply Last reply Reply Quote 0
                      • roar
                        roar @MMBInvest last edited by roar

                        @MMBInvest DoubleToString() always works, I dont know what else to say. Here is an example you can actually reproduce, maybe it helps.
                        testtt.mq4
                        5c8ffb4e-8ff6-435f-8b18-d6a3762f10a1-image.png 5a793df8-85be-4292-9346-4282faa817b0-image.png

                        Need small help? Tag me in your post
                        Need big help? https://www.fiverr.com/big_algo/automate-your-winning-strategy-in-mql4-or-mql5

                        1 Reply Last reply Reply Quote 1
                        • 1 / 1
                        • First post
                          Last post

                        Online Users

                        S
                        E
                        J
                        D
                        M
                        X
                        K
                        E
                        D
                        M

                        25
                        Online

                        146.6k
                        Users

                        22.4k
                        Topics

                        122.6k
                        Posts

                        Powered by NodeBB Forums | Contributors