fxDreema

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

    trading tool with weird info box

    Questions & Answers
    2
    7
    1696
    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.
    • Fabien S
      Fabien S last edited by Fabien S

      Hey guys! So i created a trading tool where one can set pending orders using the edit field, directly on chart. This all works pretty well but in my pending order info box every time the price level is a plain number like 0.6300 it will show 0.63000001 in the box does anyone know why this happens? It doesnt happen with other numbers and messes with my info box structure Anyway i would really appreciate if someone can help me understand why this happens. 0_1572880392942_Bildschirmfoto 2019-11-04 um 16.10.36.png 1_1572880473670_Bildschirmfoto 2019-11-04 um 16.13.38.png 0_1572880473670_Bildschirmfoto 2019-11-04 um 16.13.44.png .

      link to project: https://fxdreema.com/shared/oumT1JtO

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

        @fabien-s
        I don't exactly know what causes this, I think it is something in the way computer uses floating point numbers... But there's a way to cut off the 5th digit and everything after it:

        MathFloor( var * 10000) / 10000

        where var is whatever variable or function that you use to get that 0.6300 value.
        Example:
        MathFloor( 0.63000001 * 10000) / 10000 = 0.6300

        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
        • Fabien S
          Fabien S last edited by

          @roar thanks for your reply! 0_1572888703874_Bildschirmfoto 2019-11-04 um 18.30.24.png Do you think it works if i put it in the Adjust field? In my case i would want to add (*10000/10000) or would this not work? or do i need to make my open price a variable first?

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

            @fabien-s
            You have to apply the Floor function, so the adjust-field will not work...
            So yeah, make it a variable first. The MathFloor function is like rounding, but only downwards. Here's the example in more detail:

            MathFloor( 0.63000001 * 10000) / 10000
            = MathFloor( 6300.0001) / 10000
            = 6300 / 10000
            = 0.6300

            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
            • Fabien S
              Fabien S last edited by Fabien S

              1_1572893797165_Bildschirmfoto 2019-11-04 um 19.53.23.png 0_1572893797165_Bildschirmfoto 2019-11-04 um 19.56.12.png

              Unless i have made a misstake with the implementation of the MathFloor function i think it doesnt work for my project, https://fxdreema.com/shared/NyjmMDpic
              would you have implemented it the same way?

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

                @fabien-s Youre right, doesn't seem to work 😕

                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

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

                  @roar thanks for your time!

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

                  Online Users

                  K
                  C
                  E
                  M
                  F
                  T
                  M

                  20
                  Online

                  146.6k
                  Users

                  22.4k
                  Topics

                  122.6k
                  Posts

                  Powered by NodeBB Forums | Contributors