fxDreema

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

    Rounding Account Balance*

    Questions & Answers
    2
    16
    581
    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.
    • Morpheus_0
      Morpheus_0 last edited by

      Hi Dreemas*

      I want to round the account balance to 2 decimal places and put that into a variable...

      Any maths wizards out there who would know which formula to use to do that...?

      Example: 570.632563 becomes 570.63

      Regards*

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

        DoubleToString(570.632563,2);

        This is rough and depends on where you add, you can use a variable name for your number...

        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! 😊

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

          @jstap said in Rounding Account Balance*:

          DoubleToString(570.632563,2);

          So in Formula block, formula is Account Balance > ?

          Regards*

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

            Yes add a link, or a picture showing what you mean if not working for you.

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

              So what would be the formula here...?
              Screenshot 2024-09-02 at 00-24-05 Tauriel Scalper Ultimate BTC Test.png

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

                Ok, so you want balance +1 which will make almost no difference?

                I would do this:
                DoubleToString(AccountBalance(),2)+1 in left operand (you can add as text code input encase)
                +
                0 in right operand

                This should save into your variable

                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! 😊

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

                  No....I want to round the account balance to 2 decimal places and put that into the variable....
                  Coz as you know, sometimes the account balance in MT4 shows as 570.632839273....for example....

                  But I don't know which formula would round it down to 2 decimal places....

                  There must be a way because it does it in the Comment Block.... :.)

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

                    @jstap said in Rounding Account Balance*:

                    DoubleToString(AccountBalance(),2)+1 in left operand

                    How would I put that in the Formula block....? :.D

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

                      I think I'm in over my head here....
                      Screenshot 2024-09-02 at 00-43-06 Tauriel Scalper Ultimate BTC Test.png

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

                        Not sure exactly what you need, but this would do it:
                        image.png

                        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! 😊

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

                          Well I can try that thanks....

                          So we're not even using the Formula Block then....*

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

                            @jstap said in Rounding Account Balance*:

                            Not sure exactly what you need, but this would do it:
                            ![image.png](/forum/assets/uploads/files/1725209094476-458b1d7b-6a08-4ecf-80eb-f1b846b4a7b1-image.png

                            Unfortunatley it's still printing the Account Balance with 10 decimal places on the chart......
                            Bal.JPG

                            Screenshot 2024-09-02 at 01-03-13 Tauriel Scalper Ultimate BTC Test.png

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

                              It shouldn't as it always worked for me, I see that it has worked for equity. I know of nothing else you could try...

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

                                It didn't work for Equity....It just happened to be that way. If a trade were to open Equity would print 10 decimal places too.... :.)

                                Must be a way coz as I said, BossMan Dreema did it when he coded the Comment Block....

                                Appreciate the help....*

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

                                  Does it prink 10 initially then revert to 2? if so it is just taking a second to work. I don't know about FX but he was the one that said about DoubleToString

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

                                    Yes that seems to be what happens. So when you have trades open, the Equity is constantly changing....
                                    So it's not perfect and it's still pretty ugly, but yes your code does seem to work...

                                    Regards*

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

                                    Online Users

                                    T
                                    E
                                    E
                                    F
                                    E
                                    G
                                    M
                                    C
                                    L
                                    K
                                    E
                                    S
                                    E

                                    43
                                    Online

                                    146.7k
                                    Users

                                    22.4k
                                    Topics

                                    122.6k
                                    Posts

                                    Powered by NodeBB Forums | Contributors