fxDreema

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

    How to remove the last digit if the "digit count > 5 "

    Questions & Answers
    2
    12
    616
    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.
    • T
      tharindu999 last edited by

      Case -:

      High - 1.08713
      Low - 1.08282
      price distance (High - Low) = 0.00431

      Mid-Level Price = High - (Price Distance / 2 )

      The issue is when I dived the price distance by "2", sometimes the digit count is above 5 digits. The math works without no issues,

      But when place a trade using these prices are not working. because let's say the entry price is came as 1.089003
      then there is a issue.

      My EA didn't placed orders. I guess this digit issue is the case here.

      Question -:

      are there any code blocks to remove the last digit of a price level when it was saved into a variable ?.

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

        DoubleToString(YourValue,2) this will cut the digits after the "." to 2

        Learn fxDreema Without the Wait!

        My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

        The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

        Don’t miss out

        Click here➡️ https://mybook.to/fxDreema to get your copy today!

        Enjoy! 😊

        1 Reply Last reply Reply Quote 0
        • T
          tharindu999 last edited by

          I need to pick the variable that contains the 6 digits number and do the math, then update that variable to the correct value. Can you help bro, honestly, I don't know how to code custom MQL codes.

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

            do you have the value like "1.089003", and if so would it need to be 1.08 or 1.09? With the code above you can just put the variable name where I put "YourValue"

            Learn fxDreema Without the Wait!

            My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

            The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

            Don’t miss out

            Click here➡️ https://mybook.to/fxDreema to get your copy today!

            Enjoy! 😊

            1 Reply Last reply Reply Quote 0
            • T
              tharindu999 last edited by

              brother, will this condition block check the price value in "PDif" has more than 5 digits compared to the original digit by broker?

              image.png

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

                Is this your lot size, or a price value?

                Learn fxDreema Without the Wait!

                My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

                The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

                Don’t miss out

                Click here➡️ https://mybook.to/fxDreema to get your copy today!

                Enjoy! 😊

                1 Reply Last reply Reply Quote 0
                • T
                  tharindu999 last edited by

                  Price value bro.
                  (High - Low ) / 2

                  ex - (1.08713 - 1.08282) / 2

                  = 0.002155

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

                    You do not need to normalise price values, and if you want the middle value it is high+low/2 or low+high/2 makes no diffrance if adding

                    Learn fxDreema Without the Wait!

                    My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

                    The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

                    Don’t miss out

                    Click here➡️ https://mybook.to/fxDreema to get your copy today!

                    Enjoy! 😊

                    1 Reply Last reply Reply Quote 0
                    • T
                      tharindu999 last edited by

                      No bro, I need to calculate the "middle value", so then I can "subtract" the middle value from the "Low" to determine the "Stop loss" for the buy pending order I'm about to set at Low.

                      1 Reply Last reply Reply Quote 0
                      • T
                        tharindu999 last edited by

                        In this case, Sometimes the middle value has 6 decimal places, let's say I want to place buy pending order on EURUSD, stop loss has 6 decimal places, which will never place the pending order. (as I think)

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

                          I have done this many times, you just need to add the 2 together and divide by 2

                          Learn fxDreema Without the Wait!

                          My comprehensive book, available on Amazon, is packed with examples and invaluable insights to help you fast-track your learning journey.

                          The paperback and hardback editions include MT4 & MT5 QR codes for easy access to all prebuilt projects and robots, including my latest gold trading robot!

                          Don’t miss out

                          Click here➡️ https://mybook.to/fxDreema to get your copy today!

                          Enjoy! 😊

                          1 Reply Last reply Reply Quote 0
                          • T
                            tharindu999 last edited by

                            it working brother.. thanks for the support

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

                            Online Users

                            T
                            B
                            A
                            P
                            A
                            A
                            X

                            21
                            Online

                            146.7k
                            Users

                            22.4k
                            Topics

                            122.6k
                            Posts

                            Powered by NodeBB Forums | Contributors