fxDreema

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

    How to separate the last 2 real digits

    Questions & Answers
    3
    4
    723
    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.
    • N
      ntsikinis last edited by

      Hello community!

      I would love to know how to separate the last 2 real digits of a 5 digit broker.
      For example, i got 1.41267 and I want somehow to track the number 26

      Thanks in advance!

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

        This equals to 26

        (1.4126100 - MathFloor(1.4126100))*100

        Maybe it can be simplified.. I'm not that good in mathematics 🙂

        I tried to use the % operator, but I gor error in MQL4

        1 Reply Last reply Reply Quote 0
        • M
          miro1360 last edited by

          or you can play with strings, like:

          double Price1 = 1.12345; 
          string PrepareX=StringSubstr(DoubleToStr(Price1,4),5,2);
          double PriceX = StrToDouble(PrepareX);
          // PriceX value is "34"
          // beware of probably change position in StringSubstr when pairs are like 96.1234, 10000.1, etc. 
          

          Between trading and gambling is a very small gap, be careful.

          1 Reply Last reply Reply Quote 0
          • N
            ntsikinis last edited by

            Thank you both for your replies!

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

            Online Users

            S
            H
            A
            P
            L

            12
            Online

            146.7k
            Users

            22.4k
            Topics

            122.6k
            Posts

            Powered by NodeBB Forums | Contributors